Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!rutgers!ames!ucbcad!ucbvax!decvax!ima!minya!jc From: jc@minya.UUCP (John Chambers) Newsgroups: comp.unix.wizards Subject: Re: sources in a heterogenous enviroment Message-ID: <121@minya.UUCP> Date: Thu, 20-Aug-87 20:58:15 EDT Article-I.D.: minya.121 Posted: Thu Aug 20 20:58:15 1987 Date-Received: Sat, 22-Aug-87 14:20:49 EDT References: <390@sdics.ucsd.EDU> Organization: home Lines: 35 Summary: Yeah, use multiple directories... In article <390@sdics.ucsd.EDU>, wallen@sdics.ucsd.EDU (Mark Wallen) writes: > With all the discussion about how to handle binaries > for different processors in a heterogenous NFS environment, > I have a related question. How do you folks handle > your source files? This comes up all the time in places where you have to do cross-compiling for multiple target machines. There are two solutions. Both of them involve putting your source in one directory, say ".../src", and having other parallel directories for compilation. Say you are compiling for machines "foo" and "bar". You have the directories: .../src .../foo .../bar To compile for foo, you cd to .../foo, where there is a makefile with entries like: blech.o: blech.c; cc $(CFLAGS) -O blech.c blech.c: ../src/blech.c; ln .../src/blech.c . Alternatively, you can take advantage of the fact that many C compilers put their .o files into the current directory by default, even if the source is off somewhere else. If your compiler for foo acts this way, you can simply say: blech.o: ../src/blech.c; cc $(CFLAGS) -O ../src/blech.c and all will work just fine. In both cases, of course, CFLAGS contains the stuff to customize the software for the foo processor. There's no way to avoid multiple .o files, but by doing links or remote compiles, you at least avoid having multiple source files. (Unless the src directory is on another file system, in which case you lose! :-) To get really clever, you can put a makefile in the ... directory that knows how to cd to each subdirectory and make all. -- John Chambers <{adelie,ima,maynard}!minya!{jc,root}> (617/484-6393)