On 2/22/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
I'm having a problem with automatic dependency generation from source-files that depend on auto-generated header files.
The order-only prerequisites added to GNU Make in version 3.80 provide a fairly clean solution for this. In order for the make to succeed before any dependency information have been generated, make will need to build the auto-generated files first. So, add an order-only dependency of all the object files on the auto-generated files.
SRC := main.cpp A.cpp # NOTE: A.cpp is auto-generated by the IDL tool OBJS := $(SRC:.cpp=.o) DEPS := $(SRC:.cpp=.d)
$(OBJS): | A.cpp ...
* I could make some phony targets and make sure that all auto-generation steps are performed first. This doesn't help much though when the auto-generated files are in another module. I would have to litter the makefiles with "high-level" dependecies between modules. I suspect that this will quickly deteriorate to a scheme that will be equivalent to remaking all other modules prior to making the current module.
IMHO, the problem here is that the overall setup is broken. If the modules are truly independent, then install the dependent module's 'output' files somewhere for use by the other modules instead of (re)building them as part of other modules. If they *aren't* independent, then go read the "Recursive Make Considered Harmful" paper and stop pounding your head on the problems that recursive make creates. (After reading that paper many years ago, I redid the make setup on the project I work on to not be recursive and the results have been wonderful. The biggest problem was that an earlier version of the project that still used recursive make was maintained for most of the period: whenever I had to fix something in the old version, I had to suffer through the problems of the uncorrected build system. The project currently has 9 auto-generated source files in 5 directories out of over 600 source files in 87 directories.) Philip Guenther _______________________________________________ Help-make mailing list [email protected] http://lists.gnu.org/mailman/listinfo/help-make
