Maintaining archives with makefiles
Donald S. Hearth
hearth at Unify.Com
Thu Mar 21 09:33:08 AEST 1991
I need some help. I am trying to create a makefile that will maintain
an archive. Here is what I have so far:
LIB=foo.a
OBJECTS= \
$(LIB)(foo1.o) \
$(LIB)(foo2.o) \
$(LIB)(foo3.o)
$(LIB): $(OBJECTS)
$(CC) -c $(CFLAGS) $(?:.o=.c)
ar crv ../../lib/$(LIB) `lorder *.o | tsort`
$(RANLIB) $(LIB)
rm -f *.o
.c.a :;
The problem with this makefile is that if foo2.c has a compiler error,
after I fix the problem and rerun make, all three source files get
remade. Now, for 3 source files, it is no big deal, but if there are
100 or more source files, it can be a BIG pain. Can somebody suggest
a solution to this problem?
--
***************************************************************************
* Donald S. Hearth * address: hearth at unify.com *
* UNIFY Corporation * *
* Sacramento, CA * Go 49ers, A's, and LA Kings! *
More information about the Comp.unix.programmer
mailing list