Path: utzoo!utgpu!news-server.csri.toronto.edu!dgp.toronto.edu!flaps Newsgroups: comp.lang.c From: flaps@dgp.toronto.edu (Alan J Rosenthal) Subject: Re: C + Make Message-ID: <1990Sep11.120637.22997@jarvis.csri.toronto.edu> References: Date: 11 Sep 90 16:06:37 GMT Lines: 23 bevan@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.)