[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: info files deleted by "make"
From: |
Alexandre Duret-Lutz |
Subject: |
Re: info files deleted by "make" |
Date: |
Mon, 24 Feb 2003 20:48:40 +0100 |
User-agent: |
Gnus/5.090008 (Oort Gnus v0.08) Emacs/21.2 (i386-pc-linux-gnu) |
>>> "adl" == Alexandre Duret-Lutz <address@hidden> writes:
[...]
Bruno> 2003-02-22 Bruno Haible <address@hidden>
Bruno> * lib/am/texibuild.am: Don't remove the target info files. Instead,
Bruno> backup and restore them if makeinfo fails.
adl> I think the idea is fine, but this rule has changed in Automake 1.7.3 to
adl> better support DJGPP, and it won't work to say `mv "$$file" "$$file"~'
adl> there. I'll try to backup these file in a subdirectory, unless you
adl> can see something better to do.
Here is my proposal, based on yours. Anything blatantly wrong?
2003-02-22 Bruno Haible <address@hidden>
Alexandre Duret-Lutz <address@hidden>
* lib/am/texibuild.am: Don't remove the target info files. Instead,
back up and restore them if makeinfo fails.
* tests/txinfo20.test: New file.
* tests/Makefile.am (TESTS): Add txinfo20.test.
Index: NEWS
===================================================================
RCS file: /cvs/automake/automake/NEWS,v
retrieving revision 1.203
diff -u -r1.203 NEWS
--- NEWS 1 Feb 2003 23:17:22 -0000 1.203
+++ NEWS 24 Feb 2003 19:44:40 -0000
@@ -51,6 +51,8 @@
versions of Automake, because AC_PROG_CC defines this variable since
Autoconf 2.54.)
+* Texinfo rules back up and restore info files when makeinfo fails.
+
New in 1.7:
* Autoconf 2.54 is required.
Index: lib/am/texibuild.am
===================================================================
RCS file: /cvs/automake/automake/lib/am/texibuild.am,v
retrieving revision 1.14
diff -u -r1.14 texibuild.am
--- lib/am/texibuild.am 20 Feb 2003 16:49:44 -0000 1.14
+++ lib/am/texibuild.am 24 Feb 2003 19:44:42 -0000
@@ -20,19 +20,32 @@
?GENERIC_INFO?%SOURCE_SUFFIX%%DEST_SUFFIX%:
?!GENERIC_INFO?%DEST_PREFIX%%DEST_SUFFIX%: %SOURCE_INFO% %DEPS%
-## Note that we also remove the possible output files before running
-## makeinfo. Otherwise, if the texinfo file shrinks (or if you start
-## using --no-split), you'll be left with some dead info files lying
-## around -- dead files which will end up in the distribution.
-## *.iNN files are used on DJGPP. See the comments in install-info-am
- @rm -f $@ address@hidden address@hidden $(@:.info=).i[0-9]
$(@:.info=).i[0-9][0-9]
## It is wrong to have `info' files dependent on %DIRSTAMP%, because
## `info' files are distributed and %DIRSTAMP% isn't: a distributed file
## should never be dependent upon a non-distributed built file.
## Therefore we ensure that %DIRSTAMP% exists in the rule.
?DIRSTAMP? @test -f %DIRSTAMP% || $(MAKE) %DIRSTAMP%
+## Back up the info files before running makeinfo. This is the cheapest
+## way to ensure that
+## 1) If the texinfo file shrinks (or if you start using --no-split),
+## you'll not be left with some dead info files lying around -- dead
+## files which would end up in the distribution.
+## 2) If the texinfo file has some minor mistakes which cause makeinfo
+## to fail, the info files are not removed. (They are needed by the
+## developer while he writes documentation.)
+## *.iNN files are used on DJGPP. See the comments in install-info-am
+ backupdir="$(am__leading_dot)am$$$$" && \
+ rm -rf $$backupdir && mkdir $$backupdir && \
+ for f in $@ address@hidden address@hidden $(@:.info=).i[0-9]
$(@:.info=).i[0-9][0-9]; do \
+ test -f $$f && mv $$f $$backupdir; \
+ done; \
$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) %MAKEINFOFLAGS% \
- -o $@ `test -f '%SOURCE_INFO%' || echo '$(srcdir)/'`%SOURCE_INFO%
+ -o $@ `test -f '%SOURCE_INFO%' || echo '$(srcdir)/'`%SOURCE_INFO%; \
+ rc=$$?; \
+## Beware that backup info files might come from a subdirectory.
+ test $$rc != 0 && mv $$backupdir/* `echo "./$@" | sed 's|[^/]*$$||'`; \
+ rm -rf $$backupdir; \
+ exit $$rc
?GENERIC?%SOURCE_SUFFIX%.dvi:
?!GENERIC?%DEST_PREFIX%.dvi: %SOURCE% %DEPS% %DIRSTAMP%
Index: tests/Makefile.am
===================================================================
RCS file: /cvs/automake/automake/tests/Makefile.am,v
retrieving revision 1.471
diff -u -r1.471 Makefile.am
--- tests/Makefile.am 19 Feb 2003 19:12:56 -0000 1.471
+++ tests/Makefile.am 24 Feb 2003 19:44:42 -0000
@@ -425,6 +425,7 @@
txinfo17.test \
txinfo18.test \
txinfo19.test \
+txinfo20.test \
transform.test \
unused.test \
vars.test \
Index: tests/txinfo20.test
===================================================================
RCS file: tests/txinfo20.test
diff -N tests/txinfo20.test
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ tests/txinfo20.test 24 Feb 2003 19:44:42 -0000
@@ -0,0 +1,82 @@
+#! /bin/sh
+# Copyright (C) 2003 Free Software Foundation, Inc.
+#
+# This file is part of GNU Automake.
+#
+# GNU Automake is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# GNU Automake is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Automake; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+# Make sure info files survive makeinfo errors.
+
+required=makeinfo
+. ./defs || exit 1
+
+set -e
+
+echo AC_OUTPUT >> configure.in
+
+cat > Makefile.am << 'END'
+info_TEXINFOS = main.texi sub/main.texi
+END
+
+mkdir sub
+
+cat > main.texi << 'END'
+\input texinfo
address@hidden main
address@hidden main
address@hidden Top
+Hello walls.
address@hidden
+END
+
+cp main.texi sub/main.texi
+
+$ACLOCAL
+$AUTOMAKE --add-missing
+$AUTOCONF
+
+./configure
+$MAKE
+
+# Feign more info files.
+: > main-1
+: > sub/main-1
+
+# Break main.texi
+$sleep
+cp main.texi main.old
+cat > main.texi << 'END'
+\input texinfo
address@hidden main
address@hidden main
address@hidden Top
address@hidden walls.}
address@hidden
+END
+
+# makeinfo will bail out, but we should conserve the old info files.
+$MAKE && exit 1
+test -f main
+test -f main-1
+
+# Restore main.texi, and break sub/main.texi
+cp main.texi sub/main.texi
+mv main.old main.texi
+$MAKE && exit 1
+test -f main
+test ! -f main-1
+test -f sub/main
+test -f sub/main-1
--
Alexandre Duret-Lutz