>lib/ > foo.h > foo.c >src/ > main.c > >In this scenario, foo.h declares a "library" function defined in foo.c. >This function is called in main.c, which includes foo.h. As far as I >know, this is the generally accepted way to modularize things. However, >gcc's dependency generation doesn't trace main.c's dependency on foo.c, >only on foo.h. How can this dependency be known? Or even assumed, >given that there is a corresponding .c file for .h file?
One trick I use is cproto. I never write .h files myself, I let cproto write them for me. Once the writing of .h files is automated, chains of implicit rules can be used: %.h : %.c cproto ... %.o : %.h gcc ... OBJS=foo.o bar.o main.o all: $(OBJS) The other trick I use is a recursive search of pre-requisites. A script will take a list of directories and a file name as an argument, will open the file, and recursively search down the #include'd files and generate a series of target:pre-requisites that I load in the makefile with '-include', as explained on the paulandlesley web site. It is not easy, but it works. Hope this helps, Martin _______________________________________________ Help-make mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/help-make
