%% sandy currier <[EMAIL PROTECTED]> writes:

  sc> There seems to be a problem when trying to convert this trick to a
  sc> non-recusive build.  The problem is that in a non-recursive system,
  sc> the command rules of the export list target are always executed when,
  sc> in this scenario, the object files that comprise the shared library
  sc> have changed.  This happens whether the export file ends up being changed
  sc> or remains the same.  But, even when the export file is not modified,
  sc> that fact that the rules have fired appears to tell gmake to remake all
  sc> the targets that depend on this (export file) target.

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.

  sc> Have I missed something here?

Yep :).

  sc> Is there a way to do something like the following:

  sc> foo.exp : $(ALL_FOO_OFILES)
  sc>   create_export_list.pl [EMAIL PROTECTED] $^
  sc>   create_sharedlib.pl $(basename $@).so $^
  sc> ifeq ($(shell stat.pl $@),$(shell stat.pl [EMAIL PROTECTED]))
  sc> $(old $@)
  sc>   rm [EMAIL PROTECTED] && touch $@
  sc> else
  sc>   mv [EMAIL PROTECTED] $@
  sc> endif

This can't work.  First, remember the distinction between command
scripts and makefile commands.  The ifeq line is a make preprocessor
statement: it is evaluated when the makefile is read in, _NOT_ when the
command script was run.  You have to make the comparison part of the
command script so it gets evaluated when the rule is run.

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.

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


-- 
-------------------------------------------------------------------------------
 Paul D. Smith <[EMAIL PROTECTED]>          Find some GNU make tips at:
 http://www.gnu.org                      http://make.paulandlesley.org
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist


_______________________________________________
Help-make mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/help-make

Reply via email to