Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!apple!agate!sunspot.berkeley.edu!ericco From: ericco@ssl.berkeley.edu (Eric C. Olson) Newsgroups: comp.unix.programmer Subject: Re: Makefiles -- .c and .h Message-ID: Date: 19 Nov 90 19:23:08 GMT References: <9011151442.AA02010@decpa.pa.dec.com> <1990Nov15.172323.23431@athena.mit.edu> <6268@minyos.xx.rmit.oz.au> <1990Nov16.171816.7173@ssd.kodak.com> <1990Nov18.204706.7044@athena.mit.edu> Sender: usenet@agate.berkeley.edu (USENET Administrator) Organization: CEA @ UC Berkeley, Berkeley, CA, USA. Lines: 34 In-Reply-To: jik@athena.mit.edu's message of 18 Nov 90 20:47:06 GMT Why not compile the object files directly into a compilation dependent library. Like: lib1.a : $(SRC) cc $(CFLAGS1) $? | exit ar a $@ $(?:.c=.o) /bin/rm $(?:.c=.o) lib2.a : $(SRC) cc $(CFLAGS2) $? | exit ar a $@ $(?:.c=.o) /bin/rm $(?:.c=.o) exe1 : main.c lib1.a cc $(LFLAGS) -o $@ main.c lib1.a exe2 : main.c lib2.a cc $(LFLAGS) -o $@ main.c lib2.a If the compilation fails, you may get into trouble, i think the exit will take care of this. In general, in Sun make, this could be: all : exeDEF1 exeDEF2 exeDEF3 lib%.a : $(SRC) cc -c -D% $? | exit ar a $@ $(?:.c=.o) /bin/rm $(?:.c=.o) exe% : main.c lib%.a cc -o $@ main.c lib%.a -- Eric ericco@ssl.berkeley.edu