Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site rlgvax.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!godot!harvard!seismo!rlgvax!guy From: guy@rlgvax.UUCP (Guy Harris) Newsgroups: net.lang.c Subject: Re: make depend Message-ID: <524@rlgvax.UUCP> Date: Thu, 28-Feb-85 02:48:46 EST Article-I.D.: rlgvax.524 Posted: Thu Feb 28 02:48:46 1985 Date-Received: Fri, 1-Mar-85 09:26:51 EST References: <404@harvard.ARPA> Distribution: net Organization: CCI Office Systems Group, Reston, VA Lines: 27 > 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 > depend : > { echo '/^# DO NOT DELETE THIS LINE/+1,$$c'; \ > for i in $(CFILES); do $(CPP) -M $$i; done; \ Well, I just tested it on 4.2BSD and it says 0: unknown flag -M Somebody at your site must have added it to "cpp". You can do a "cpp -E" and suck out all the "# " lines and make a list of included files out of that. "-M" probably just suppresses all output except lines indicating that an include file is being read. Unfortunately, if "cpp" isn't a separate program, or if it produces different kinds of output for included files, or if it doesn't support "cpp -E", you're out of luck. Guy Harris {seismo,ihnp4,allegra}!rlgvax!guy