Path: utzoo!attcan!uunet!husc6!uwvax!tank!ncar!gatech!mcnc!rti!sunpix!matthew From: matthew@sunpix.UUCP ( Sun NCAA) Newsgroups: comp.unix.questions Subject: Re: Telling csh about multiple, machine-dependent libraries Summary: solved... Keywords: csh bin libraries Message-ID: <277@greens.UUCP> Date: 18 Nov 88 16:01:50 GMT References: <173@heart-of-gold> Organization: Sun Microsystems, Research Triangle Park, NC Lines: 64 In article <173@heart-of-gold>, jc@heart-of-gold (John M Chambers) writes: > Here's one that someone has gotta have solved already: > > We have NFS-mounted filesystems on a lot of different kinds of machines, > and of course there is a problem with trying to execute binary files on > the wrong machine. It's pretty easy to build the binaries, of course; > I just set up a heirarchy: > ~foo/src contains generic source. > ~foo/sun2 contains a Makefile and binaries for a Sun2 > ~foo/sun3 contains a Makefile and binaries for a Sun3 > ~foo/vax contains a Makefile and binaries for a VAX > ~foo/x286 contains a Makefile and binaries for a 80286/Xenix > ~foo/x386 contains a Makefile and binaries for a 80386/Xenix > and so on. Source files are linked from src as necessary. > > Now, when I log in, I'd like to include the right directory in my search > path. My latest (failed) attempt in cshrc looks like: > > | set mtype = bin > | if (`sun2`) set mtype = sun2 > | if (`sun3`) set mtype = sun3 > | if (`sun4`) set mtype = sun4 > | set path=(. ~/{$mtype,sh,csh,awk} /bin /usr/{ucb,etc,local,local/{$mtype,sh},bin,lib,dos,hosts,games,demo,NeWS/{bin,demo}} /etc) > Close, but not quite right. We have to do build for not just different machines, but different OS also. What you need to do is use the `arch` command to differenciet(sp?) between the different machine types. IE: set mtype = `arch` is what you are looking for. We also use a shell script to determine the OS level also. Here it is: #! /bin/csh -f # Prints "os3", "os4", or "os_unknown" # Set rel_str to the string following "Release" in /vmunix #/*note: following two line are actually one. broken here due to length > 80 */ set rel_str = `strings /vmunix | grep Release | awk '{ for (i=0; i