make depend
Guy Harris
guy at rlgvax.UUCP
Thu Feb 28 17:48:46 AEST 1985
> 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 "# <linenumber> <include-file>" 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
More information about the Comp.lang.c
mailing list