Problem with make.

Joe Morrison joe at wateng.UUCP
Fri Jul 19 06:38:15 AEST 1985


In article <145 at iitcs.UUCP> draughn at iitcs.UUCP (Mark draughn) writes:
>I'm trying to use make to maintain an archive of .o files.  I want
>the archive modules to depend directly on the source files, so I don't
>need to keep the object files around.

Since adding something to an archive updates the timestamp, you could
use a makefile like the one below. This lists in one place the fact 
that the archive is dependent on all the files. If any files change,
the ones that have changed (this is what $? does) are recompiled and
stuffed back into the archive.
---------------------------------------------------------------------------
FILES 	=	routine1.c \
		routine2.c \
		routine3.c

stuff.a:	$(FILES)
	cc -c -O $?
	ar rv stuff.a *.o
	ranlib stuff.a
	rm *.o
---------------------------------------------------------------------------
-- 
	Joe Morrison
Systems on Silicon Group @ University of Waterloo

-- -- -- --  decvax  !
-- -- -- --  allegra ! watmath ! wateng ! joe
-- -- -- -- -- ihnp4 !



More information about the Comp.unix mailing list