On 2/23/07, Patrick Lögdahl <[EMAIL PROTECTED]> wrote:
Philip Guenther wrote:
...
> 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 > great, this is probably exactly what i'm looking for. I see how that would fix the problem. But my question is why not $(OBJS): | A.h ? (maybe a typo...)
Yeah, it was a thinko (though in this case it would have done the trick).
In my actual system I added a variable AUTOGEN_FILES, that all modules adds their autogenerated files to, and the root Makefile has a order-only dependency $(OBJS) : | $(AUTOGEN_FILES)
Perfect. ...
Well, I actually already have a non-recursive setup.
Cool, so the above really does Just Work. ...
The thing is that over time, the set of modules that are "pre-compiled" will change, and will also vary from time to time (ie a developer could be fixing bugs or working on add-ons that require new functionality in the baseline). The developer could then just check out the source tree for Mod_X and (hopefully) just 'make' as usual
If the toplevel Makefile includes the rules for each module on when that module is present, then you should automatically get the desired effect: if a module that generates a file used by other module isn't actually checked out, then the rule to install the generated file won't be in effect (so other modules can be built fine), but when you check it out you'll get the rule to build and install the generated file. The effect can be spooky at times if you forget a dependency exists. "Why's _that_ building?!? Oh, that's part of the tool that generates a header used by the module I'm working on..." Philip Guenther _______________________________________________ Help-make mailing list [email protected] http://lists.gnu.org/mailman/listinfo/help-make
