Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!bloom-beacon!athena.mit.edu!jfc From: jfc@athena.mit.edu (John F Carr) Newsgroups: comp.unix.wizards Subject: Re: generating code to run multiple targets/configurations from single Message-ID: <10510@bloom-beacon.MIT.EDU> Date: 11 Apr 89 11:49:02 GMT References: <18927@adm.BRL.MIL> <10445@bloom-beacon.MIT.EDU> <3129@stpstn.UUCP> Sender: daemon@bloom-beacon.MIT.EDU Reply-To: jfc@athena.mit.edu (John F Carr) Organization: Massachusetts Institute of Technology Lines: 37 There is a program at Athena called "machtype" which tells you what kind of machine you are on (and other trivia, like CPU type and display hardware, if you care). This is also a shell variable, "hosttype", in our version of tcsh. I put in my .login "setenv HOSTTYPE $hosttype", and make other programs depend on this (those that I can't modify the source for with #ifdef ). Such a program is extremely useful when using NFS, since there is otherwise no convenient way of determining what hardware you are running on. In particular, $PATH must be set to point to the correct bin directories on NFS filesystems exported to multiple machine types. Our naming convention is to add the machine type as a prefix to "bin", so we have "vaxbin" and "rtbin" subdirectories of most exported filesystems (as well as "vaxlib" and "rtlib" if appropriate). The Andrew File System has built in support for machine type, being able to substitute it automatically in a filename (but as a suffix -- we managed to choose opposite conventions). Solutions I have heard to the multiple target machines types include: 1. Create lots of symlinks. Run make in the correct directory and it will do the right thing. 2. Have disctinct make targets per machine type. So, to compile for the RT one runs "make rt"; for a vax "make vax". 3. Use an environment variable, modify make to define a variable, or otherwise get it to notice the machine type. Like (2) except make makes the distinction between target machine types, instead of the programmer. Now if only we can get X to distinguish between a 16" and a 19" display... -- John Carr "When they turn the pages of history, jfc@Athena.mit.edu When these days have passed long ago, bloom-beacon! Will they read of us with sadness athena.mit.edu!jfc For the seeds that we let grow?" --Neil Peart