>Not so. GNU make will check the timestamp of the target file after the >rule is run and, if it hasn't changed, it will assume that the target >was not updated.
This is a good thing!
>Second, in both cases above you're updating the target (if the stat.pl >output is equal you still "touch $@"). The whole point here is to _NOT_ >update the target if the content has not changed. That means that >targets that depend on this one won't be rebuilt.
Actually, though the primary point is to not have targets that depend on foo.exp rebuild when it is not physically changed, the secondary point IS to touch the foo.exp target. By touching it when it is rebuilt, then the next time that make is run, if none of the $(ALL_FOO_OFILES) have changed, then the neither foo.exp or foo.so is rebuilt.
The solution provided below will always rebuild foo.exp and foo.so.
Note that a subtle but on-purpose aspect of the design is to have one target,
foo.exp, be responsible for two derived objects, namely foo.exp and foo.so. This is because some downstream targets need to depend on foo.exp only
(while still requiring the existance of a proper foo.so) and some depend
on just foo.so. The solution needs to work with -jN, so we have to make
certain that the foo.exp target does not complete without a proper foo.so
having been generated.
Note that foo.exp _is_ the export list of symbols. This file is used by the link line of foo.so to tell the linker which symbols need to be exported by the shared library. Thus, foo.exp must occur before foo.so. But to support -jN, the foo.exp target cannot complete without a valid foo.so. (linking foo.so takes a while...)
Perhaps this:
foo.exp : $(ALL_FOO_OFILES)
create_export_list.pl [EMAIL PROTECTED] $^
if [ "x`stat.pl [EMAIL PROTECTED]" = "x`stat.pl [EMAIL PROTECTED]" ]; then \
rm [EMAIL PROTECTED]; \
else \
mv [EMAIL PROTECTED] $@; \
endif
foo.so : $(ALL_FOO_OFILES) foo.exp
create_sharedlib.pl $(basename $@).so $(filter-out foo.exp,$^)It doesn't look like touching the file at the end of the build will work since if foo.exp is touched, then foo.so is out of date, and so on and so on. It needs to be touched during the rule. And the above still results with foo.exp always running until it can finally do the 'mv'..
That was one reason for the $(old <target>) idea - tell gmake that this target is really old and ignore its newness on the fly.
?
Thanks! -sandy
>Try rewriting it something like this: > > foo.exp : $(ALL_FOO_OFILES) > create_export_list.pl [EMAIL PROTECTED] $^ > create_sharedlib.pl $(basename $@).so $^ > if [ "x`stat.pl [EMAIL PROTECTED]" = "x`stat.pl [EMAIL PROTECTED]" ]; then \ > rm [EMAIL PROTECTED]; \ > else \ > mv [EMAIL PROTECTED] $@; \ > endif
_______________________________________________ Help-make mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/help-make
