Brian Vandenberg
unread,Dec 20, 2011, 4:56:10 PM12/20/11You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to
The documentation for .secondary gives the impression you can
use .SECONDARY with no targets to prevent make from deleting
intermediate files, but this approach has side-effects that can
prevent things from building.
As an example: I have a fairly large build with a large number of
headers used that are generated from Fortran code. The tool used to
generate the Fortran code is built within the same code-base. I added
targets of the form:
%.h : %.inc ${THE_TOOL}
${THE_TOOL} ${<}
The headers actually get symlinked to a separate location within the
build -- please, I don't need comments on this architecture, I'm
already pushing to eliminate that from the build. So, the symlinks
themselves are the targets being built, whereas the header is an
intermediate target.
${THE_TOOL} gets treated as an intermediate target when I
use .SECONDARY without any dependencies specified, which seems to have
some odd side effects. If I specify a given symlink as a primary
target, it induces the tool to build without problem, then the rule to
generate the header to be symlinked is kicked off -- everything is
fine.
However, when I run the full build, it delays building the tool quite
a bit, but the fact it isn't built yet doesn't prevent the recipe that
uses the tool from executing. I've traced it through the debug output
with '-d', and there isn't enough info for me to draw a conclusion
other than what I've outlined already.
Instead of using .SECONDARY, I tried using .PRECIOUS with:
.PRECIOUS: %.cc
... where some .cc files are generated dynamically. However, the
target building them is specified as:
/some/fully/qualified/path/something%.cc: whatever.cc
.PRECIOUS only matches if the target name matches -- it isn't using
the % to do pattern matching.
This differs in behavior from other areas where patterns are allowed.
As an example:
%_blah.o : SOME_VARIABLE = whatever
... will work, in spite of the fact the target that actually builds it
is given as:
%.o : %.cc
Comments? Questions? Suggestions?