From: Brian Candler Date: 2003-03-22T22:45:53+09:00 Subject: Re: Rake problem? On Sat, Mar 22, 2003 at 10:19:41PM +0900, Jim Weirich wrote: > If all we are doing with the sub-directory rakefile is record > dependencies, then there are several ways of handling it. For example > > (1) Record dependencies in a rakefile in each subdirectory and > recursively include them. > (2) Calculate and append the dependencies to a master Rakefile. > (3) Calculate and store the dependencies in a single file, but separate > from the master Rakefile. > (4) Recalculate the dependencies dynamically each time Rake is invoked. > (5) Calculate and store the dependencies in a serialized format (e.g. > using Marshall or PStore). When you say 'calculate dependencies' do you mean like 'make depend' - i.e. running the source code through the preprocessor to determine which additional files it uses? I was just thinking about explicit (hand-written) rules. If you have a subdirectory with certain source files in it, then to me it makes sense to include the build rules within that directory - especially if that directory ends up getting grafted into a different project. I don't think it should be much less efficient than having a central file. As for 'make depend'-type dependencies: fixing that would be a big bonus. ISTM that whenever you compile foo.c to foo.o, that is the right time also to determine (and store) the automatic dependencies. gcc -M or -MD gives you output in Makefile format of course, so it still needs to be parsed - but sticking it into a serialised object seems a very good way to make it persist (whether that be one per directory, or one per project) Doing it this way would mean never having to do a 'make depend'! Regards, Brian.