Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site harvard.ARPA Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!genrad!panda!talcott!harvard!draves From: draves@harvard.ARPA (Richard Draves) Newsgroups: net.lang.c Subject: make depend Message-ID: <404@harvard.ARPA> Date: Mon, 25-Feb-85 22:41:08 EST Article-I.D.: harvard.404 Posted: Mon Feb 25 22:41:08 1985 Date-Received: Thu, 28-Feb-85 01:13:11 EST Distribution: net Organization: Aiken Computation Laboratory, Harvard Lines: 29 I recently ran across an undocumented flag for cpp that makes the following entry for makefiles convenient. It automagically updates file dependencies. If your cpp doesn't have this feature, or you don't like depending on undocumented features, you can write you own shell script to accomplish the same thing. # This has only been tested on 4.2BSD CPP = /lib/cpp ED = /bin/ed CFILES = main.c depend : { echo '/^# DO NOT DELETE THIS LINE/+1,$$c'; \ for i in $(CFILES); do $(CPP) -M $$i; done; \ echo '.'; \ echo 'w'; \ } | $(ED) - Makefile # File Relationships # DO NOT DELETE THIS LINE -- make depends on it. # This line will be replaced by your file dependencies. Rich -- "a picture in the head is a gory murder in an art gallery" -- Stephen Kosslyn