Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site lsuc.UUCP Path: utzoo!lsuc!dave From: dave@lsuc.UUCP (David Sherman) Newsgroups: net.unix Subject: Re: Problem with Make Message-ID: <723@lsuc.UUCP> Date: Fri, 19-Jul-85 13:55:11 EDT Article-I.D.: lsuc.723 Posted: Fri Jul 19 13:55:11 1985 Date-Received: Fri, 19-Jul-85 16:17:15 EDT References: <145@iitcs.UUCP> <165@husky.uucp> Reply-To: dave@lsuc.UUCP (David Sherman) Organization: Law Society of Upper Canada, Toronto Lines: 40 Summary: $? and "ar ru" In article <165@husky.uucp> mj@husky.uucp (Mark A. Johnson) writes: || || A recent letter to net.unix from draughn@iitcs.UUCP || (Mark Draughn) was asking about a problem with make: || 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: CC = cc CFLAGS = -O CFILES = file1.c file2.c OFILES = file1.o file2.o lib.a: $(CFILES) $(CC) $(CFLAGS) $? ar ruv lib.a rm -f $(OFILES) all: $(CFILES) $(CC) $(CFLAGS) $(CFILES) make mklib rm -f $(OFILES) mklib: ar cr lib.a $(OFILES) This lets make compile those .c files which have later dates than the archive ($?), and then uses the "ru" feature of ar to update only those .o files which have later dates than the archive. Presto. Dave Sherman The Law Society of Upper Canada Toronto -- { ihnp4!utzoo pesnta utcs hcr decvax!utcsri } !lsuc!dave