C + Make
Alan J Rosenthal
flaps at dgp.toronto.edu
Wed Sep 12 02:06:37 AEST 1990
bevan at cs.man.ac.uk (Stephen J Bevan) writes:
>If you have .h files that include other .h files ...
>then inorder to get `make' to update foo.c if anything in the headers
>change, you have to do something like :-
>
>foo.o: foo.c foo.h a.h b.h ... any file that a.h/b.h includes
...
>2. If its an ok idea, has somebody got a solution that will update all
> the dependencies with just one run of `make'.
How about something like:
/lib/cpp -I{stuff} {.c file} | grep '#' | awk '{ print $3 }' | sort -u
For greater excitement, also pipe through: tr -s '"\012 ' ' '
The tr is probably bsd-specific; other things may be as well but I don't think
so. They're certainly unix-specific.
Various compilers have dependency-listing features...
I also wrote my own dependency-listing program so we could use it on multiple
platforms. It was easy. (Although I didn't put in the last 10% to get the
sibling-include stuff quite right.)
More information about the Comp.lang.c
mailing list