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)

Thanks,
-Ruben E. Brown

Context:

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.
_______________________________________________
Bug-make mailing list
Bug-make@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-make

Reply via email to