Problem with Make

fnf at unisoft.UUCP fnf at unisoft.UUCP
Thu Jul 25 04:44:53 AEST 1985


In article <723 at lsuc.UUCP> dave at lsuc.UUCP (David Sherman) writes:
>>	how do you make objects INSIDE archives depend on their
>>	sources (so the objects don't have to keep lying around)?
>
>Here's a usable makefile, stripped down from one of our system makefiles:

There are a couple of bugs in your example, no "-c" in the $(CC) line
and no objects to archive in the ar line.  A partial solution to this 
problem is found in the "AUGMAKE" section of the system V Support
Tools Guide.  Unfortunately, the example there is missing a couple of
critical lines to suppress the built in rule that augmake (augmented
make) has for maintaining archives.  A correct example (for system V
with the new augmented make) follows:

.SUFFIXES:	.a .c

# Suppress built in rule, VERY important.
.c.a:;

LIB =	lib.a

$(LIB):	$(LIB)(file1.o) $(LIB)(file2.o)
	$(CC) -c $(CFLAGS) $(?:.o=.c)
	ar rv $@ $?
	rm $?

Note that the built in rule is EXTREMELY SLOW for large archives since
it does each object (compile, replace in archive) one at a time.
This one does all the compilations first then replaces all the out
of date objects in one ar operation.

-Fred

===========================================================================
Fred Fish    UniSoft Systems Inc, 739 Allston Way, Berkeley, CA  94710  USA
{ucbvax,decvax}!unisoft!fnf	(415) 644 1230 		TWX 11 910 366-2145
===========================================================================



More information about the Comp.unix mailing list