OK to apply?  With this, if only `ChangeLog' (and `configure.ac' for
ltversion.in) are newer than the respective target, we avoid updating.
This fixes the bug where
  touch $srcdir/libltdl/config/ltmain.m4sh  # or edit otherwise

would fail to update ltmain.sh and thus libtool.

This seems to more or less work with the make implementations of Solaris
10, AIX 4.3.3, FreeBSD 6, and of course GNU.  More or less meaning: the
proprietary make implementations will keep rerunning autotools and
config.status for a while, but eventually they will settle on something.

Cheers,
Ralf

2007-04-27  Ralf Wildenhues  <[EMAIL PROTECTED]>

        * Makefile.am (clean-ltmain-sh): Removed.
        (libtool, $(srcdir)/$(m4dir)/ltversion.m4)
        ($(srcdir)/$(auxdir)/ltmain.sh): Updated to not depend on any
        phony rules.  Test `$?' for prerequisites that should always
        cause us to update the target.  Fixes rebuilding rules, at the
        cost of sometimes updating too much with non-GNU make.

Index: Makefile.am
===================================================================
RCS file: /cvsroot/libtool/libtool/Makefile.am,v
retrieving revision 1.218
diff -u -r1.218 Makefile.am
--- Makefile.am 26 Apr 2007 22:34:05 -0000      1.218
+++ Makefile.am 26 Apr 2007 23:01:31 -0000
@@ -89,12 +89,15 @@
 # We used to do this with a 'stamp-vcl' file, but non-gmake builds
 # would rerun configure on every invocation, so now we manually
 # check the version numbers from the build rule when necessary.
-libtool: clean-ltmain-sh $(top_builddir)/config.status 
$(srcdir)/$(auxdir)/ltmain.sh ChangeLog
+libtool: $(top_builddir)/config.status $(srcdir)/$(auxdir)/ltmain.sh ChangeLog
        @target=libtool; $(rebuild); \
        if test -f "$$target"; then \
          set dummy `./$$target --version | sed 1q`; actualver="$$5"; \
          test "$$actualver" = "$$correctver" && rebuild=false; \
        fi; \
+       for prereq in $?; do \
+         case $$prereq in *ChangeLog);; *) rebuild=:;; esac; \
+       done; \
        if $$rebuild; then \
          echo $(SHELL) ./config.status $$target; \
          cd $(top_builddir) && $(SHELL) ./config.status $$target; \
@@ -144,15 +147,6 @@
 CLEANFILES     += libtool libtoolize libtoolize.tmp \
                  $(auxdir)/ltmain.tmp $(m4dir)/ltversion.tmp
 
-
-## We used to build ltmain.sh in the build tree, but now it is created
-## in the source tree by bootstrap.  This rule removes stale copies from
-## previous builds left behind in the build tree, that would override the
-## source tree version in current builds.
-clean-ltmain-sh:
-       @-test "$(srcdir)" = "$(top_builddir)" || \
-         rm -f "$(top_builddir)/$(auxdir)/ltmain.sh" stamp-vcl
-
 ## We build ltversion.m4 here, instead of from config.status,
 ## because config.status is rerun each time one of configure's
 ## dependencies change and ltversion.m4 happens to be a configure
@@ -164,13 +158,16 @@
 ## Use `$(srcdir)/m4' for the benefit of non-GNU makes: this is
 ## how ltversion.m4 appears in our dependencies.
 EXTRA_DIST += $(m4dir)/ltversion.in $(srcdir)/$(m4dir)/ltversion.m4
-$(srcdir)/$(m4dir)/ltversion.m4: clean-ltmain-sh $(m4dir)/ltversion.in 
configure.ac ChangeLog
+$(srcdir)/$(m4dir)/ltversion.m4: $(m4dir)/ltversion.in configure.ac ChangeLog
        @target='$(srcdir)/$(m4dir)/ltversion.m4'; $(rebuild); \
        if test -f "$$target"; then \
          set dummy `sed -n '/^# serial /p' "$$target"`; shift; \
          actualver=1.$$3; \
          test "$$actualver" = "$$correctver" && rebuild=false; \
        fi; \
+       for prereq in $?; do \
+         case $$prereq in *ChangeLog | *configure.ac);; *) rebuild=:;; esac; \
+       done; \
        if $$rebuild; then \
          cd $(srcdir); \
          rm -f $(m4dir)/ltversion.tmp; \
@@ -197,17 +194,22 @@
 ##           distcheck (at least) by rebuilding ltmain.sh in the source
 ##           tree whenever config.status regenerates the Makefile.
 EXTRA_DIST += $(srcdir)/$(auxdir)/ltmain.sh
-$(srcdir)/$(auxdir)/ltmain.sh: clean-ltmain-sh $(sh_files) 
$(auxdir)/ltmain.m4sh configure.ac ChangeLog
+$(srcdir)/$(auxdir)/ltmain.sh: $(sh_files) $(auxdir)/ltmain.m4sh configure.ac 
ChangeLog
        @target='$(srcdir)/$(auxdir)/ltmain.sh'; $(rebuild); \
        if test -f "$$target"; then \
          eval `sed -n '/^package_revision=/p' "$$target"`; \
          actualver=$$package_revision; \
          test "$$actualver" = "$$correctver" && rebuild=false; \
        fi; \
+       for prereq in $?; do \
+         case $$prereq in *ChangeLog);; *) rebuild=:;; esac; \
+       done; \
        if $$rebuild; then \
          cd $(srcdir); \
          rm -f $(auxdir)/ltmain.in $(auxdir)/ltmain.tmp \
            $(auxdir)/ltmain.sh; \
+         echo $(M4SH) -B $(auxdir) $(auxdir)/ltmain.m4sh \
+           \> $(auxdir)/ltmain.in; \
          $(M4SH) -B $(auxdir) $(auxdir)/ltmain.m4sh \
            > $(auxdir)/ltmain.in; \
          input="ltmain.m4sh"; \


Reply via email to