I'm half convinced this patch is wrong, but I'd like a second opinion.
Not creating these temporary files makes things quite a lot tidier, but
I suspect that the original idea was to change the target files atomically
to avoid races in parallel makes... if that's the case, then instead of
this patch I'll write another to apply that rule consistently, since
there are plenty of rules that happily append to a target file as the
bytes come down a pipe or out of a process.

Push or apply atomic target file creation consistently throughout in
a replacement patch?

* Makefile.am (CLEANFILES): Remove temporary file entries.
(libtoolize.in, libltdl/config/ltmain.sh, libltdl/m4/ltversion.m4)
(tests/defs, tests/testsuite): Factor away temporary files.

Signed-off-by: Gary V. Vaughan <g...@gnu.org>
---
 ChangeLog   |    5 +++++
 Makefile.am |   35 ++++++++++++++---------------------
 2 files changed, 19 insertions(+), 21 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index ba2c3a5..e478899 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2010-08-31  Gary V. Vaughan  <g...@gnu.org>
 
+       build: eliminate superfluous temporary files from `Makefile.am'.
+       * Makefile.am (CLEANFILES): Remove temporary file entries.
+       (libtoolize.in, libltdl/config/ltmain.sh, libltdl/m4/ltversion.m4)
+       (tests/defs, tests/testsuite): Factor away temporary files.
+
        build: eliminate `ltmain.in' intermediate file.
        * Makefile.am (libltdl/config/ltmain.sh): Pipe the output of
        `$(LT_M4SH)' directly into `$(bootstrap_edit)' to avoid use
diff --git a/Makefile.am b/Makefile.am
index 16e1a69..5d84b2c 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -74,9 +74,7 @@ EXTRA_DIST     += bootstrap $(srcdir)/libtoolize.in 
$(auxdir)/ltmain.m4sh \
                  ChangeLog.2002 ChangeLog.2003 ChangeLog.2004 \
                  ChangeLog.2005 ChangeLog.2006 ChangeLog.2007 \
                  ChangeLog.2008 ChangeLog.2009
-CLEANFILES     += libtool libtoolize libtoolizeT \
-                 tests/defsT tests/testsuitT \
-                 $(auxdir)/ltmain.shT $(m4dir)/ltversion.m4T
+CLEANFILES     += libtool libtoolize
 
 ## These are the replacements that need to be made at bootstrap time,
 ## because they must be static in distributed files, and not accidentally
@@ -117,13 +115,12 @@ $(srcdir)/$(m4dir)/ltversion.m4: $(m4dir)/ltversion.in 
configure.ac ChangeLog
          case $$prereq in *ChangeLog | *configure.ac);; *) rebuild=:;; esac; \
        done; \
        if $$rebuild; then \
-         rm -f "$...@t"; \
+         rm -f "$@"; \
          in=`echo "$@" | sed 's:\.m4$$:.in:'`; \
          serial=`echo "$$revision" | sed 's,^1[.],,g'`; \
          echo "$(bootstrap_edit) $$in > $@"; \
-         $(bootstrap_edit) "$$in" > "$...@t"; \
-         chmod a-w "$...@t"; \
-         mv -f "$...@t" "$@"; \
+         $(bootstrap_edit) "$$in" > "$@"; \
+         chmod a-w "$@"; \
        fi
 
 ## And for similar reasons, ltmain.sh can't be built from config.status.
@@ -148,11 +145,10 @@ $(srcdir)/$(auxdir)/ltmain.sh: $(sh_files) 
$(auxdir)/ltmain.m4sh configure.ac Ch
        done; \
        if $$rebuild; then \
          in=`echo "$@" | sed 's:\.sh$$:.m4sh:'`; \
-         rm -f "$...@t" "$@"; \
+         rm -f "$@"; \
          echo "$(LT_M4SH) $$in | $(bootstrap_edit) > $@"; \
-         $(LT_M4SH) "$$in" | $(bootstrap_edit) > "$...@t"; \
-         chmod a-w "$...@t"; \
-         mv -f "$...@t" "$@"; \
+         $(LT_M4SH) "$$in" | $(bootstrap_edit) > "$@"; \
+         chmod a-w "$@"; \
        fi
 
 # Use `$(srcdir)' for the benefit of non-GNU makes: this is
@@ -220,11 +216,10 @@ configure_edit = sed \
 bin_SCRIPTS = libtoolize libtool
 
 libtoolize: $(srcdir)/libtoolize.in $(top_builddir)/config.status
-       rm -f "$...@t" "$@"
-       $(configure_edit) $(srcdir)/libtoolize.in > "$...@t"
-       chmod a+x "$...@t"
-       chmod a-w "$...@t"
-       mv -f "$...@t" "$@"
+       rm -f "$@"
+       $(configure_edit) $(srcdir)/libtoolize.in > "$@"
+       chmod a+x "$@"
+       chmod a-w "$@"
 
 # We used to do this with a 'stamp-vcl' file, but non-gmake builds
 # would rerun configure on every invocation, so now we manually
@@ -529,8 +524,7 @@ INSTALLCHECK_ENVIRONMENT = \
 # Use `$(srcdir)' for the benefit of non-GNU makes: this is
 # how `testsuite' appears in our dependencies.
 $(srcdir)/$(TESTSUITE): $(srcdir)/tests/package.m4 $(TESTSUITE_AT) Makefile.am
-       $(AUTOTEST) -I $(srcdir)/tests $(TESTSUITE_AT) -o "$...@t"
-       mv -f "$...@t" "$@"
+       $(AUTOTEST) -I $(srcdir)/tests $(TESTSUITE_AT) -o "$@"
 
 $(srcdir)/tests/package.m4: $(srcdir)/configure.ac Makefile.am
        { \
@@ -885,9 +879,8 @@ DIST_SUBDIRS   += $(CONF_SUBDIRS)
 # regenerated since the source tree can be read-only.
 check-recursive: tests/defs
 tests/defs: $(srcdir)/tests/defs.in
-       rm -f "$...@t" "$@"
-       $(configure_edit) "$^" > "$...@t"
-       mv -f "$...@t" "$@"
+       rm -f "$@"
+       $(configure_edit) "$^" > "$@"
 
 # Use `$(srcdir)/tests' for the benefit of non-GNU makes: this is
 # how defs.in appears in our dependencies.
-- 
1.7.3


Reply via email to