From d2cce769a77412f933865e7fbcc85fada9cdfa70 Mon Sep 17 00:00:00 2001 From: Alexandre Duret-Lutz Date: Sat, 17 Jul 2004 09:48:11 +0000 Subject: [PATCH] * lib/am/texibuild.am (?GENERIC?%SOURCE_SUFFIX%.html, ?!GENERIC?%DEST_PREFIX%.html): Output .htp, and then rename to .html on success. In case the target is a directory, this ensures its time stamp is updated and the no files are left over inside. * tests/txinfo21.test: Augment to test missing timestamp update reported by Akim Demaille. --- ChangeLog | 8 ++++++++ lib/am/texibuild.am | 24 +++++++++++++++++++----- tests/txinfo21.test | 11 ++++++++++- 3 files changed, 37 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6a9f42684..4cc0f3a38 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,8 +1,16 @@ 2004-07-17 Alexandre Duret-Lutz + * lib/am/texibuild.am (?GENERIC?%SOURCE_SUFFIX%.html, + ?!GENERIC?%DEST_PREFIX%.html): Output .htp, and then rename to .html + on success. In case the target is a directory, this ensures its + time stamp is updated and the no files are left over inside. + * tests/txinfo21.test: Augment to test missing timestamp update + reported by Akim Demaille. + * doc/automake.texi (Top level): Rename as ... (Directories): ... this, and split into ... (Subdirectories, Conditional Subdirectories): ... these. + (Subdirectories): Illustrate the use of `.'. (Conditional Subdirectories): Describe SUBDIRS and DIST_SUBDIRS before the example. Append a discussion about non-configured conditional directories. diff --git a/lib/am/texibuild.am b/lib/am/texibuild.am index f2c96f1da..d71b2c45e 100644 --- a/lib/am/texibuild.am +++ b/lib/am/texibuild.am @@ -80,13 +80,27 @@ INFO_DEPS += %DEST_INFO_PREFIX%%DEST_SUFFIX% ?GENERIC?%SOURCE_SUFFIX%.html: ?!GENERIC?%DEST_PREFIX%.html: %SOURCE% %DEPS% %DIRSTAMP% - $(MAKEINFOHTML) $(AM_MAKEINFOHTMLFLAGS) $(MAKEINFOFLAGS) %MAKEINFOFLAGS% \ -?GENERIC? -o $@ %SOURCE% -?!GENERIC? -o $@ `test -f '%SOURCE%' || echo '$(srcdir)/'`%SOURCE% +## When --split (the default) is used, makeinfo will output a +## directory. However it will not update the time stamp of a +## previously existing directory, and when the names of the nodes +## in the manual change, it may leave unused pages. Our fix +## is to build under a temporary name, and replace the target on +## success. + rm -rf ${@:.html=.htp} + if $(MAKEINFOHTML) $(AM_MAKEINFOHTMLFLAGS) $(MAKEINFOFLAGS) %MAKEINFOFLAGS% \ +?GENERIC? -o ${@:.html=.htp} %SOURCE%; \ +?!GENERIC? -o ${@:.html=.htp} `test -f '%SOURCE%' || echo '$(srcdir)/'`%SOURCE%; \ + then \ + rm -rf $@; \ ## Work around a bug in Texinfo 4.1 (-o foo.html outputs files in foo/ ## instead of foo.html/). - if test ! -d $@ && test -d $(@:.html=); then \ - mv $(@:.html=) $@; else :; fi + if test ! -d ${@:.html=.htp} && test -d $(@:.html=); then \ + mv $(@:.html=) $@; else mv $(@:.html=.htp) $@; fi; \ + else \ + if test ! -d ${@:.html=.htp} && test -d $(@:.html=); then \ + rm -rf $(@:.html=); else rm -Rf $(@:.html=.htp) $@; fi; \ + exit 1; \ + fi ## If we are using the generic rules, we need separate dependencies. ## (Don't wonder about %DIRSTAMP% here, this is used only by non-generic diff --git a/tests/txinfo21.test b/tests/txinfo21.test index 44e7177af..66f1722c7 100755 --- a/tests/txinfo21.test +++ b/tests/txinfo21.test @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 2003 Free Software Foundation, Inc. +# Copyright (C) 2003, 2004 Free Software Foundation, Inc. # # This file is part of GNU Automake. # @@ -61,11 +61,20 @@ $AUTOCONF $MAKE +$sleep # Test production of split-per-node HTML. $MAKE html test -d main.html test -d sub/main.html test -d rec/main.html + +# Rebuilding main.html should cause its timestamp to be updated. +test `ls -1td main.texi main.html | sed 1q` = main.html +$sleep +touch main.texi +$MAKE html +test `ls -1td main.texi main.html | sed 1q` = main.html + $MAKE clean test ! -d main.html test ! -d sub/main.html -- 2.34.1