|Subject:||Method to generate a variable containing targets matching a pattern?|
|Date:||Wed, 31 Oct 2012 13:01:55 -0500|
Hello gnu-make community,
Is there a method by which the existence of targets matching a certain pattern can be deduced? For example, is there any way to collect the list targets which end in ‘.h’ or ‘.hh’, such that an order only pattern rule could be applied to force execution of any rules which generate a header file before any rules that generate a ‘.o’ file?
For example is there way to create behavior like:
%.o : | $(targets-matching *.h) $(targets-matching *.hh)
-Ruben E. Brown
I’m replacing a system analogous to the “Basic Auto-Dependencies” described at http://mad-scientist.net/make/autodep.html with the more advanced system described in the same document.
The prior system would introduce an explicit dependency of ‘%.o’ file on any header which was not found during the $(MAKEDEPEND) execution (for this purpose gcc –M –MG –MP, with missing files being provided without warning by -MG). Changing this to gcc –MMD and outputting the dependency as a side effect of compilation removes the –MG behavior, and no rule is now automatically created to link object file generation to a dynamic header file generation. However the rules for generating the header files still exist, but not as pre-requisites of the %.o target execution.
Note, the system I’m working on defines these header generation rules in a ‘user’ makefile which includes the boiler plate rules which I have control over, and have changed to improve the dependency file generation method. These ‘user’ makefiles cannot be modified to include an explicit rule which links the object file to the dynamically generated header file, at least not without significantly breaking backward compatibility.
|[Prev in Thread]||Current Thread||[Next in Thread]|