generating code to run multiple targets

Richard A. O'Keefe ok at quintus.UUCP
Fri Apr 21 20:05:18 AEST 1989


In article <11319 at tekecs.GWD.TEK.COM> andrew at frip.wv.tek.com (Andrew Klossner) writes:
>.>I posted a "machine" shell script last year which checks for a whole bunch of
>.>machines, it was always the One Right UNIXy thing to have *one* command
>.>	machine		# write the processor type to stdout
>.>so that one would simply say
>.>	case `machine` of ...
>
>But this mechanism allows only one machine type.
>On a Sun-3, for example, I would expect both 'sun' and 'm68k' to be true.

It's precisely for Suns that I wanted it.  We have Sun-2s, Sun-3s, Sun-4s,
and a Sun-386i.  The question I wanted an answer to was "which of my
 ~/bin/* directories shall I put in my $PATH", and the answer is
	PATH=$HOME/bin/`machine`:$PATH
/bin/arch would have been ideal, except that our Sun-2s run SunOS 2.3,
which hasn't got /bin/arch.  Similarly, knowing that a machine is an
Apollo machine isn't enough.  Even knowing that it is an Apollo and an
m68k rather than a DN10000 isn't enough.  You don't want to try executing
68020 instructions on a 68010.  (Apollo have a $NODETYPE which tells you
what you want to know, and my script echoes it if it can.)

I don't claim that this is the only question you want to answer, only
that it provides users with a single place to look for the answer to
this particular question, no matter which of our machines is used.



More information about the Comp.unix.wizards mailing list