summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexandre Duret-Lutz <adl@gnu.org>2003-11-08 13:01:13 +0000
committerAlexandre Duret-Lutz <adl@gnu.org>2003-11-08 13:01:13 +0000
commit9bfd1b3f4f7fb0ad7ba169a5742edeba77f84ff6 (patch)
tree6ab2331e575db111189e2ca873d52941abdab8c5
parent05fac00979a763296aa2d0c01c2e08837cee0ac5 (diff)
downloadautomake-9bfd1b3f4f7fb0ad7ba169a5742edeba77f84ff6.tar.gz
* lib/am/texibuild.am (%DEST_PREFIX%%DEST_SUFFIX%): Rename as ...
(%DEST_INFO_PREFIX%%DEST_SUFFIX%): ... this, and honor ?INSRC? to select $(srcdir) or `.' builds. (INFO_DEPS): Define here. * lib/am/texinfos.am (dist-info): Strip filename starting with "$(srcdir)/". * automake.in (output_texinfo_build_rules): Take a new argument $insrc, and adjust substitutions in 'texibuild'. (handle_texinfo_helper): Compute a regex of all user-cleaned files, and use this to select whether to build .info files in `.' or $(srcdir). Give an account of the $(srcdir) vs `.' debacle. Alway build the version.texi and stamp files in $(srcdir). Do not define INFO_DEPS. * tests/Makefile.am (TESTS): Add txinfo23.test, txinfo24.test, and txinfo25.test. * tests/txinfo23.test, tests/txinfo24.test, tests/txinfo25.test: New files. * tests/txinfo13.test, tests/txinfo16.test, tests/txinfo3.test, tests/vtexi.test: Adjust to new rules.
-rw-r--r--ChangeLog22
-rw-r--r--NEWS6
-rwxr-xr-xautomake.in174
-rw-r--r--doc/Makefile.in42
-rw-r--r--lib/am/texibuild.am20
-rw-r--r--lib/am/texinfos.am4
-rw-r--r--tests/Makefile.am3
-rw-r--r--tests/Makefile.in3
-rwxr-xr-xtests/txinfo13.test3
-rwxr-xr-xtests/txinfo16.test13
-rwxr-xr-xtests/txinfo23.test66
-rwxr-xr-xtests/txinfo24.test83
-rwxr-xr-xtests/txinfo25.test110
-rwxr-xr-xtests/txinfo3.test4
-rwxr-xr-xtests/vtexi.test9
15 files changed, 507 insertions, 55 deletions
diff --git a/ChangeLog b/ChangeLog
index e5e4d5c7c..476761d23 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,25 @@
+2003-11-08 Alexandre Duret-Lutz <adl@gnu.org>
+
+ * lib/am/texibuild.am (%DEST_PREFIX%%DEST_SUFFIX%): Rename as ...
+ (%DEST_INFO_PREFIX%%DEST_SUFFIX%): ... this, and honor ?INSRC?
+ to select $(srcdir) or `.' builds.
+ (INFO_DEPS): Define here.
+ * lib/am/texinfos.am (dist-info): Strip filename starting with
+ "$(srcdir)/".
+ * automake.in (output_texinfo_build_rules): Take a new argument
+ $insrc, and adjust substitutions in 'texibuild'.
+ (handle_texinfo_helper): Compute a regex of all user-cleaned
+ files, and use this to select whether to build .info files in `.'
+ or $(srcdir). Give an account of the $(srcdir) vs `.' debacle.
+ Alway build the version.texi and stamp files in $(srcdir). Do not
+ define INFO_DEPS.
+ * tests/Makefile.am (TESTS): Add txinfo23.test, txinfo24.test,
+ and txinfo25.test.
+ * tests/txinfo23.test, tests/txinfo24.test, tests/txinfo25.test:
+ New files.
+ * tests/txinfo13.test, tests/txinfo16.test, tests/txinfo3.test,
+ tests/vtexi.test: Adjust to new rules.
+
2003-11-05 Alexandre Duret-Lutz <adl@gnu.org>
* m4/init.m4 (AM_INIT_AUTOMAKE): Require Autoconf 2.58.
diff --git a/NEWS b/NEWS
index ea61b08ea..d1e9fb82d 100644
--- a/NEWS
+++ b/NEWS
@@ -175,6 +175,12 @@ New in 1.7a:
- Do not assume that make files are called Makefile in cleaning rules.
+ - Update .info files in the source tree, not in the build tree. This
+ is what the GNU Coding Standard recommend. Only Automake 1.7.x
+ used to update these files in the build tree (previous versions did
+ it in the source tree too), and it caused several problems, varying
+ from mere annoyance to portability issues.
+
* Miscellaneous
- The Automake manual is now distributed under the terms of the GNU FDL.
diff --git a/automake.in b/automake.in
index 11bbe4fd7..1277f3b55 100755
--- a/automake.in
+++ b/automake.in
@@ -2595,14 +2595,15 @@ sub scan_texinfo_file ($)
# ($DIRSTAMP, @CLEAN_FILES)
-# output_texinfo_build_rules ($SOURCE, $DEST, @DEPENDENCIES)
-# ----------------------------------------------------------
+# output_texinfo_build_rules ($SOURCE, $DEST, $INSRC, @DEPENDENCIES)
+# ------------------------------------------------------------------
# SOURCE - the source Texinfo file
# DEST - the destination Info file
+# INSRC - wether DEST should be built in the source tree
# DEPENDENCIES - known dependencies
-sub output_texinfo_build_rules ($$@)
+sub output_texinfo_build_rules ($$$@)
{
- my ($source, $dest, @deps) = @_;
+ my ($source, $dest, $insrc, @deps) = @_;
# Split `a.texi' into `a' and `.texi'.
my ($spfx, $ssfx) = ($source =~ /^(.*?)(\.[^.]*)?$/);
@@ -2612,8 +2613,8 @@ sub output_texinfo_build_rules ($$@)
$dsfx ||= "";
# We can output two kinds of rules: the "generic" rules use Make
- # suffix rules and are appropriate when $source and $dest lie in
- # the current directory; the "specific" rules are needed in the other
+ # suffix rules and are appropriate when $source and $dest do not lie
+ # in a sub-directory; the "specific" rules are needed in the other
# case.
#
# The former are output only once (this is not really apparent here,
@@ -2634,6 +2635,15 @@ sub output_texinfo_build_rules ($$@)
$makeinfoflags = "-I $sdir -I \$(srcdir)/$sdir";
}
+ # A directory can contain two kinds of info files: some built in the
+ # source tree, and some built in the build tree. The rules are
+ # different in each case. However we cannot output two different
+ # set of generic rules. Because in-source builds are more usual, we
+ # use generic rules in this case and fall back to "specific" rules
+ # for build-dir builds. (It should not be a problem to invert this
+ # if needed.)
+ $generic = 0 unless $insrc;
+
# We cannot use a suffix rule to build info files with an empty
# extension. Otherwise we would output a single suffix inference
# rule, with separate dependencies, as in
@@ -2652,20 +2662,26 @@ sub output_texinfo_build_rules ($$@)
# make sure this directory will exist.
my $dirstamp = require_build_directory_maybe ($dest);
+ my $dipfx = ($insrc ? '$(srcdir)/' : '') . $dpfx;
+
$output_rules .= file_contents ('texibuild',
new Automake::Location,
- GENERIC => $generic,
- GENERIC_INFO => $generic_info,
- SOURCE_SUFFIX => $ssfx,
- SOURCE => ($generic ? '$<' : $source),
- SOURCE_INFO => ($generic_info ?
- '$<' : $source),
- SOURCE_REAL => $source,
- DEST_PREFIX => $dpfx,
- DEST_SUFFIX => $dsfx,
- MAKEINFOFLAGS => $makeinfoflags,
- DEPS => "@deps",
- DIRSTAMP => $dirstamp);
+ DEPS => "@deps",
+ DEST_PREFIX => $dpfx,
+ DEST_INFO_PREFIX => $dipfx,
+ DEST_SUFFIX => $dsfx,
+ DIRSTAMP => $dirstamp,
+ GENERIC => $generic,
+ GENERIC_INFO => $generic_info,
+ INSRC => $insrc,
+ MAKEINFOFLAGS => $makeinfoflags,
+ SOURCE => ($generic
+ ? '$<' : $source),
+ SOURCE_INFO => ($generic_info
+ ? '$<' : $source),
+ SOURCE_REAL => $source,
+ SOURCE_SUFFIX => $ssfx,
+ );
return ($dirstamp, "$dpfx.dvi", "$dpfx.pdf", "$dpfx.ps", "$dpfx.html");
}
@@ -2682,6 +2698,15 @@ sub handle_texinfo_helper ($)
my $done = 0;
my @texi_cleans;
+ # Build a regex matching user-cleaned files.
+ my $d = var 'DISTCLEANFILES';
+ my $c = var 'CLEANFILES';
+ my @f = ();
+ push @f, $d->value_as_list_recursive (TRUE) if $d;
+ push @f, $c->value_as_list_recursive (TRUE) if $c;
+ @f = map { s|[^A-Za-z_0-9*\[\]\-]|\\$&|g; s|\*|[^/]*|g; $_; } @f;
+ my $user_cleaned_files = '^(?:' . join ('|', @f) . ')$';
+
foreach my $texi ($info_texinfos->value_as_list_recursive ('all'))
{
my $infobase = $texi;
@@ -2711,10 +2736,114 @@ sub handle_texinfo_helper ($)
$outdir = "" if $outdir eq './';
$out_file = $outdir . $out_file;
+ # Until Automake 1.6.3, .info files were built in the
+ # source tree. This was an obstacle to the support of
+ # non-distributed .info files, and non-distributed .texi
+ # files.
+ #
+ # * Non-distributed .texi files is important in some packages
+ # where .texi files are built at make time, probably using
+ # other binaries built in the package itself, maybe using
+ # tools or information found on the build host. Because
+ # these files are not distributed they are always rebuilt
+ # at make time; they should therefore not lie in the source
+ # directory. One plan was to support this using
+ # nodist_info_TEXINFOS or something similar. (Doing this
+ # requires some sanity checks. For instance Automake should
+ # not allow:
+ # dist_info_TEXINFO = foo.texi
+ # nodist_foo_TEXINFO = included.texi
+ # because a distributed file should never depend on a
+ # non-distributed file.)
+ #
+ # * If .texi files are not distributed, then .info files should
+ # not be distributed either. There are also cases where one
+ # want to distribute .texi files, but do not want to
+ # distribute the .info files. For instance the Texinfo package
+ # distributes the tool used to build these files; it would
+ # be a waste of space to distribute them. It's not clear
+ # which syntax we should use to indicate that .info files should
+ # not be distributed. Akim Demaille suggested that eventually
+ # we switch to a new syntax:
+ # | Maybe we should take some inspiration from what's already
+ # | done in the rest of Automake. Maybe there is too much
+ # | syntactic sugar here, and you want
+ # | nodist_INFO = bar.info
+ # | dist_bar_info_SOURCES = bar.texi
+ # | bar_texi_DEPENDENCIES = foo.texi
+ # | with a bit of magic to have bar.info represent the whole
+ # | bar*info set. That's a lot more verbose that the current
+ # | situation, but it is # not new, hence the user has less
+ # | to learn.
+ # |
+ # | But there is still too much room for meaningless specs:
+ # | nodist_INFO = bar.info
+ # | dist_bar_info_SOURCES = bar.texi
+ # | dist_PS = bar.ps something-written-by-hand.ps
+ # | nodist_bar_ps_SOURCES = bar.texi
+ # | bar_texi_DEPENDENCIES = foo.texi
+ # | here bar.texi is dist_ in line 2, and nodist_ in 4.
+ #
+ # Back to the point, it should be clear that in order to support
+ # non-distributed .info files, we need to build them in the
+ # build tree, not in the source tree (non-distributed .texi
+ # files are less of a problem, because we do not output build
+ # rules for them). In Automake 1.7 .info build rules have been
+ # largely cleaned up so that .info files get always build in the
+ # build tree, even when distributed. The idea was that
+ # (1) if during a VPATH build the .info file was found to be
+ # absent or out-of-date (in the source tree or in the
+ # build tree), Make would rebuild it in the build tree.
+ # If an up-to-date source-tree of the .info file existed,
+ # make would not rebuild it in the build tree.
+ # (2) having two copies of .info files, one in the source tree
+ # and one (newer) in the build tree is not a problem
+ # because `make dist' always pick files in the build tree
+ # first.
+ # However it turned out the be a bad idea for several reasons:
+ # * Tru64, OpenBSD, and FreeBSD (not NetBSD) Make do behave
+ # like GNU Make on point (1) above. These implementations
+ # of Make would always rebuild .info files in the build
+ # tree, even if such files were up to date in the source
+ # tree. Consequently, it was impossible the perform a VPATH
+ # build of a package containing Texinfo files using these
+ # Make implementations.
+ # (Refer to the Autoconf Manual, section "Limitation of
+ # Make", paragraph "VPATH", item "target lookup", for
+ # an account of the differences between these
+ # implementations.)
+ # * The GNU Coding Standards require these files to be built
+ # in the source-tree (when they are distributed, that is).
+ # * Keeping a fresher copy of distributed files in the
+ # build tree can be annoying during development because
+ # - if the files is kept under CVS, you really want it
+ # to be updated in the source tree
+ # - it os confusing that `make distclean' does not erase
+ # all files in the build tree.
+ #
+ # Consequently, starting with Automake 1.8, .info files are
+ # built in the source tree again. Because we still plan to
+ # support non-distributed .info files at some point, we
+ # have a single variable ($INSRC) that controls whether
+ # the current .info file must be built in the source tree
+ # or in the build tree. Actually this variable is switched
+ # off for .info files that appear to be cleaned; this is
+ # for backward compatibility with package such as Texinfo,
+ # which do things like
+ # info_TEXINFOS = texinfo.txi info-stnd.texi info.texi
+ # DISTCLEANFILES = texinfo texinfo-* info*.info*
+ # # Do not create info files for distribution.
+ # dist-info:
+ # in order not to distribute .info files.
+ my $insrc = ($out_file =~ $user_cleaned_files) ? 0 : 1;
+
+ my $soutdir = '$(srcdir)/' . $outdir;
+ $outdir = $soutdir if $insrc;
+
# If user specified file_TEXINFOS, then use that as explicit
# dependency list.
@texi_deps = ();
- push (@texi_deps, "$outdir$vtexi") if $vtexi;
+ push (@texi_deps, "$soutdir$vtexi") if $vtexi;
my $canonical = canonicalize ($infobase);
if (var ($canonical . "_TEXINFOS"))
@@ -2724,7 +2853,7 @@ sub handle_texinfo_helper ($)
}
my ($dirstamp, @cfiles) =
- output_texinfo_build_rules ($texi, $out_file, @texi_deps);
+ output_texinfo_build_rules ($texi, $out_file, $insrc, @texi_deps);
push (@texi_cleans, @cfiles);
push (@info_deps_list, $out_file);
@@ -2769,8 +2898,8 @@ sub handle_texinfo_helper ($)
new Automake::Location,
TEXI => $texi,
VTI => $vti,
- STAMPVTI => "${outdir}stamp-$vti",
- VTEXI => "$outdir$vtexi",
+ STAMPVTI => "${soutdir}stamp-$vti",
+ VTEXI => "$soutdir$vtexi",
MDDIR => $conf_dir,
DIRSTAMP => $dirstamp);
}
@@ -2814,7 +2943,6 @@ sub handle_texinfo_helper ($)
unshift (@all, '$(INFO_DEPS)');
}
- define_variable ("INFO_DEPS", "@info_deps_list", INTERNAL);
define_files_variable ("DVIS", @infobase, 'dvi', INTERNAL);
define_files_variable ("PDFS", @infobase, 'pdf', INTERNAL);
define_files_variable ("PSS", @infobase, 'ps', INTERNAL);
diff --git a/doc/Makefile.in b/doc/Makefile.in
index ba2560e1c..c19e04a0b 100644
--- a/doc/Makefile.in
+++ b/doc/Makefile.in
@@ -43,15 +43,15 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/amversion.m4 \
$(top_srcdir)/m4/strip.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
-DIST_COMMON = $(automake_TEXINFOS) $(srcdir)/Makefile.in Makefile.am \
- stamp-vti version.texi
+DIST_COMMON = $(automake_TEXINFOS) $(srcdir)/Makefile.in \
+ $(srcdir)/stamp-vti $(srcdir)/version.texi Makefile.am
mkinstalldirs = $(SHELL) $(top_srcdir)/lib/mkinstalldirs
CONFIG_CLEAN_FILES =
SOURCES =
DIST_SOURCES =
+INFO_DEPS = $(srcdir)/automake.info
TEXINFO_TEX = $(top_srcdir)/lib/texinfo.tex
am__TEXINFO_TEX_DIR = $(top_srcdir)/lib
-INFO_DEPS = automake.info
DVIS = automake.dvi
PDFS = automake.pdf
PSS = automake.ps
@@ -173,6 +173,7 @@ $(ACLOCAL_M4): $(am__aclocal_m4_deps)
.texi.info:
restore=: && \
backupdir="$(am__leading_dot)am$$$$" && \
+ am__cwd=`pwd` && cd $(srcdir) && \
rm -rf $$backupdir && mkdir $$backupdir && \
for f in $@ $@-[0-9] $@-[0-9][0-9] $(@:.info=).i[0-9] $(@:.info=).i[0-9][0-9]; do \
if test -f $$f; then \
@@ -180,10 +181,15 @@ $(ACLOCAL_M4): $(am__aclocal_m4_deps)
restore=mv; \
fi; \
done; \
+ cd "$$am__cwd"; \
if $(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir) \
- -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \
- then rc=0; else \
+ -o $@ $<; \
+ then \
+ rc=0; \
+ cd $(srcdir); \
+ else \
rc=$$?; \
+ cd $(srcdir) && \
$$restore $$backupdir/* `echo "./$@" | sed 's|[^/]*$$||'`; \
fi; \
rm -rf $$backupdir; \
@@ -202,29 +208,29 @@ $(ACLOCAL_M4): $(am__aclocal_m4_deps)
.texi.html:
$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) --html -I $(srcdir) \
-o $@ $<
-automake.info: automake.texi version.texi $(automake_TEXINFOS)
-automake.dvi: automake.texi version.texi $(automake_TEXINFOS)
-automake.pdf: automake.texi version.texi $(automake_TEXINFOS)
-automake.html: automake.texi version.texi $(automake_TEXINFOS)
-version.texi: stamp-vti
-stamp-vti: automake.texi $(top_srcdir)/configure
+$(srcdir)/automake.info: automake.texi $(srcdir)/version.texi $(automake_TEXINFOS)
+automake.dvi: automake.texi $(srcdir)/version.texi $(automake_TEXINFOS)
+automake.pdf: automake.texi $(srcdir)/version.texi $(automake_TEXINFOS)
+automake.html: automake.texi $(srcdir)/version.texi $(automake_TEXINFOS)
+$(srcdir)/version.texi: $(srcdir)/stamp-vti
+$(srcdir)/stamp-vti: automake.texi $(top_srcdir)/configure
@(dir=.; test -f ./automake.texi || dir=$(srcdir); \
set `$(SHELL) $(top_srcdir)/lib/mdate-sh $$dir/automake.texi`; \
echo "@set UPDATED $$1 $$2 $$3"; \
echo "@set UPDATED-MONTH $$2 $$3"; \
echo "@set EDITION $(VERSION)"; \
echo "@set VERSION $(VERSION)") > vti.tmp
- @cmp -s vti.tmp version.texi \
- || (echo "Updating version.texi"; \
- cp vti.tmp version.texi)
+ @cmp -s vti.tmp $(srcdir)/version.texi \
+ || (echo "Updating $(srcdir)/version.texi"; \
+ cp vti.tmp $(srcdir)/version.texi)
-@rm -f vti.tmp
- @cp version.texi $@
+ @cp $(srcdir)/version.texi $@
mostlyclean-vti:
-rm -f vti.tmp
maintainer-clean-vti:
- -rm -f stamp-vti version.texi
+ -rm -f $(srcdir)/stamp-vti $(srcdir)/version.texi
.dvi.ps:
$(DVIPS) -o $@ $<
@@ -251,8 +257,12 @@ uninstall-info-am:
done
dist-info: $(INFO_DEPS)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
list='$(INFO_DEPS)'; \
for base in $$list; do \
+ case $$base in \
+ $(srcdir)/*) base=`echo "$$base" | sed "s|^$$srcdirstrip/||"`;; \
+ esac; \
if test -f $$base; then d=.; else d=$(srcdir); fi; \
for file in $$d/$$base*; do \
relfile=`expr "$$file" : "$$d/\(.*\)"`; \
diff --git a/lib/am/texibuild.am b/lib/am/texibuild.am
index c2ee9a9b5..d8dc4fc8c 100644
--- a/lib/am/texibuild.am
+++ b/lib/am/texibuild.am
@@ -19,12 +19,12 @@
?GENERIC_INFO?%SOURCE_SUFFIX%%DEST_SUFFIX%:
-?!GENERIC_INFO?%DEST_PREFIX%%DEST_SUFFIX%: %SOURCE_INFO% %DEPS%
+?!GENERIC_INFO?%DEST_INFO_PREFIX%%DEST_SUFFIX%: %SOURCE_INFO% %DEPS%
## 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%
+?!INSRC??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),
@@ -36,6 +36,7 @@
## *.iNN files are used on DJGPP. See the comments in install-info-am
restore=: && \
backupdir="$(am__leading_dot)am$$$$" && \
+?INSRC? am__cwd=`pwd` && cd $(srcdir) && \
rm -rf $$backupdir && mkdir $$backupdir && \
for f in $@ $@-[0-9] $@-[0-9][0-9] $(@:.info=).i[0-9] $(@:.info=).i[0-9][0-9]; do \
if test -f $$f; then \
@@ -43,16 +44,25 @@
restore=mv; \
fi; \
done; \
+?INSRC? cd "$$am__cwd"; \
if $(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) %MAKEINFOFLAGS% \
- -o $@ `test -f '%SOURCE_INFO%' || echo '$(srcdir)/'`%SOURCE_INFO%; \
- then rc=0; else \
+?!INSRC? -o $@ `test -f '%SOURCE_INFO%' || echo '$(srcdir)/'`%SOURCE_INFO%; \
+?INSRC??!GENERIC_INFO? -o $@ $(srcdir)/%SOURCE_INFO%; \
+?INSRC??GENERIC_INFO? -o $@ $<; \
+ then \
+ rc=0; \
+?INSRC? cd $(srcdir); \
+ else \
rc=$$?; \
## Beware that backup info files might come from a subdirectory.
+?INSRC? cd $(srcdir) && \
$$restore $$backupdir/* `echo "./$@" | sed 's|[^/]*$$||'`; \
fi; \
rm -rf $$backupdir; \
exit $$rc
+INFO_DEPS += %DEST_INFO_PREFIX%%DEST_SUFFIX%
+
?GENERIC?%SOURCE_SUFFIX%.dvi:
?!GENERIC?%DEST_PREFIX%.dvi: %SOURCE% %DEPS% %DIRSTAMP%
TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \
@@ -83,7 +93,7 @@
## (Don't wonder about %DIRSTAMP% here, this is used only by non-generic
## rules.)
if %?GENERIC_INFO%
-%DEST_PREFIX%%DEST_SUFFIX%: %SOURCE_REAL% %DEPS%
+%DEST_INFO_PREFIX%%DEST_SUFFIX%: %SOURCE_REAL% %DEPS%
endif %?GENERIC_INFO%
if %?GENERIC%
%DEST_PREFIX%.dvi: %SOURCE_REAL% %DEPS%
diff --git a/lib/am/texinfos.am b/lib/am/texinfos.am
index a6cc47337..95ce1e9cc 100644
--- a/lib/am/texinfos.am
+++ b/lib/am/texinfos.am
@@ -222,8 +222,12 @@ endif ! %?LOCAL-TEXIS%
if %?LOCAL-TEXIS%
.PHONY: dist-info
dist-info: $(INFO_DEPS)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
list='$(INFO_DEPS)'; \
for base in $$list; do \
+ case $$base in \
+ $(srcdir)/*) base=`echo "$$base" | sed "s|^$$srcdirstrip/||"`;; \
+ esac; \
if test -f $$base; then d=.; else d=$(srcdir); fi; \
for file in $$d/$$base*; do \
## Strip leading '$$d/'.
diff --git a/tests/Makefile.am b/tests/Makefile.am
index e5646c26e..715d0d857 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -476,6 +476,9 @@ txinfo19.test \
txinfo20.test \
txinfo21.test \
txinfo22.test \
+txinfo23.test \
+txinfo24.test \
+txinfo25.test \
transform.test \
unused.test \
vars.test \
diff --git a/tests/Makefile.in b/tests/Makefile.in
index 9dcff8f22..b1a364c6a 100644
--- a/tests/Makefile.in
+++ b/tests/Makefile.in
@@ -588,6 +588,9 @@ txinfo19.test \
txinfo20.test \
txinfo21.test \
txinfo22.test \
+txinfo23.test \
+txinfo24.test \
+txinfo25.test \
transform.test \
unused.test \
vars.test \
diff --git a/tests/txinfo13.test b/tests/txinfo13.test
index b32e98d40..9a005e6b1 100755
--- a/tests/txinfo13.test
+++ b/tests/txinfo13.test
@@ -62,4 +62,5 @@ mkdir build
cd build
../configure
$MAKE distcheck
-test -f subdir/main.info
+test -f ../subdir/main.info
+test ! -f subdir/main.info
diff --git a/tests/txinfo16.test b/tests/txinfo16.test
index a3fe2653e..ab089a8cf 100755
--- a/tests/txinfo16.test
+++ b/tests/txinfo16.test
@@ -18,7 +18,7 @@
# the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA.
-# Check that info files are built in $(srcdir).
+# Check that info files are not built in $(srcdir).
required='makeinfo tex'
. ./defs || exit 1
@@ -49,15 +49,20 @@ mkdir build
cd build
../configure
$MAKE
-test -f main.info
+test -f ../main.info
+test ! -f main.info
+test -f ../stamp-vti
+test ! -f stamp-vti
+test -f ../version.texi
+test ! -f version.texi
cd ..
-rm -rf build
+rm -rf build make.info* stamp-vti version.texi
./configure
$MAKE
test -f main.info
-# Make sur stamp-vti is older that version.texi.
+# Make sure stamp-vti is older that version.texi.
# (A common situation in a real tree.)
# This is needed to test the "subtle" issue described below.
test -f stamp-vti
diff --git a/tests/txinfo23.test b/tests/txinfo23.test
new file mode 100755
index 000000000..9bccece68
--- /dev/null
+++ b/tests/txinfo23.test
@@ -0,0 +1,66 @@
+#! /bin/sh
+# Copyright (C) 2002, 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 autoconf; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+# Check for subdir Texinfo in $(srcdir).
+# (Similar to txinfo13.test, plus DISTCLEANFILES.)
+
+required='makeinfo tex texi2dvi-o'
+. ./defs || exit 1
+
+set -e
+
+echo AC_OUTPUT >> configure.in
+
+cat > Makefile.am << 'END'
+DISTCLEANFILES = subdir/*.info*
+info_TEXINFOS = subdir/main.texi
+subdir_main_TEXINFOS = subdir/inc.texi
+
+installcheck-local:
+ test -f $(infodir)/main.info
+END
+
+mkdir subdir
+
+cat > subdir/main.texi << 'END'
+\input texinfo
+@setfilename main.info
+@settitle main
+@node Top
+Hello walls.
+@include version.texi
+@include inc.texi
+@bye
+END
+
+cat > subdir/inc.texi << 'END'
+I'm included.
+END
+
+
+$ACLOCAL
+$AUTOMAKE --add-missing
+$AUTOCONF
+
+mkdir build
+cd build
+../configure
+$MAKE distcheck
+test -f subdir/main.info
diff --git a/tests/txinfo24.test b/tests/txinfo24.test
new file mode 100755
index 000000000..f0063ee12
--- /dev/null
+++ b/tests/txinfo24.test
@@ -0,0 +1,83 @@
+#! /bin/sh
+# Copyright (C) 2002, 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 autoconf; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+# Check that info files are built in builddir when needed.
+# (Similar to txinfo16.test, plus CLEANFILES.)
+
+required='makeinfo tex'
+. ./defs || exit 1
+
+set -e
+
+echo AC_OUTPUT >> configure.in
+
+cat > Makefile.am << 'END'
+CLEANFILES = main.info
+info_TEXINFOS = main.texi
+END
+
+cat > main.texi << 'END'
+\input texinfo
+@setfilename main.info
+@settitle main
+@node Top
+Hello walls.
+@include version.texi
+@bye
+END
+
+$ACLOCAL
+$AUTOMAKE --add-missing
+$AUTOCONF
+
+mkdir build
+cd build
+../configure
+$MAKE
+test -f main.info
+
+cd ..
+rm -rf build
+./configure
+$MAKE
+test -f main.info
+
+# Make sure stamp-vti is older that version.texi.
+# (A common situation in a real tree.)
+test -f stamp-vti
+test -f version.texi
+$sleep
+touch stamp-vti
+
+$MAKE distclean
+test -f stamp-vti
+test -f version.texi
+
+mkdir build
+cd build
+../configure
+$MAKE
+# main.info should be rebuilt in the current directory
+test -f main.info
+test ! -f ../main.info
+$MAKE dvi
+test -f main.dvi
+
+$MAKE distcheck
diff --git a/tests/txinfo25.test b/tests/txinfo25.test
new file mode 100755
index 000000000..d09c84343
--- /dev/null
+++ b/tests/txinfo25.test
@@ -0,0 +1,110 @@
+#! /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 autoconf; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+# Similar to texinfo24.test, but with two info files, only one of
+# which being cleaned.
+
+required='makeinfo tex'
+. ./defs || exit 1
+
+set -e
+
+echo AC_OUTPUT >> configure.in
+
+cat > Makefile.am << 'END'
+CLEANFILES = [a-m]*.info
+info_TEXINFOS = main.texi other.texi
+END
+
+cat > main.texi << 'END'
+\input texinfo
+@setfilename main.info
+@settitle main
+@node Top
+Hello walls.
+@include version.texi
+@bye
+END
+
+cat > other.texi << 'END'
+\input texinfo
+@setfilename other.info
+@settitle other
+@node Top
+Hello walls.
+@include version2.texi
+@bye
+END
+
+$ACLOCAL
+$AUTOMAKE --add-missing
+$AUTOCONF
+
+mkdir build
+cd build
+../configure
+$MAKE
+test -f main.info
+test ! -f ../main.info
+test ! -f other.info
+test -f ../other.info
+
+cd ..
+rm -rf build
+./configure
+$MAKE
+test -f main.info
+test -f other.info
+
+# Make sure stamp-vti is older that version.texi.
+# (A common situation in a real tree.)
+# This is needed to test the "subtle" issue described below.
+test -f stamp-vti
+test -f version.texi
+test -f stamp-1
+test -f version2.texi
+$sleep
+touch stamp-vti
+touch stamp-1
+
+$MAKE distclean
+test -f stamp-vti
+test -f stamp-1
+test -f version.texi
+test -f version2.texi
+
+mkdir build
+cd build
+../configure
+$MAKE
+# other.info should not be rebuilt in the current directory, since
+# it's up-to-date in $(srcdir).
+# This can be caused by a subtle issue related to VPATH handling
+# of version.texi (see also the comment in texi-vers.am): because
+# stamp-vti is newer than version.texi, the `version.texi: stamp-vti'
+# rule is always triggered. Still that's not a reason for `make'
+# to think `version.texi' has been created...
+test -f main.info
+test ! -f other.info
+$MAKE dvi
+test -f main.dvi
+test -f other.dvi
+
+$MAKE distcheck
diff --git a/tests/txinfo3.test b/tests/txinfo3.test
index 9f59c516c..abf8476b1 100755
--- a/tests/txinfo3.test
+++ b/tests/txinfo3.test
@@ -1,5 +1,5 @@
#! /bin/sh
-# Copyright (C) 1997, 2001, 2002 Free Software Foundation, Inc.
+# Copyright (C) 1997, 2001, 2002, 2003 Free Software Foundation, Inc.
#
# This file is part of GNU Automake.
#
@@ -49,7 +49,7 @@ grep '^INFO_DEPS.*textutils$' Makefile.in
# We should not use single suffix inference rules (with separate
# dependencies), this confuses Solaris make.
grep '^.texi:$' Makefile.in && exit 1
-grep '^textutils: textutils.texi' Makefile.in
+grep 'textutils: textutils.texi' Makefile.in
./configure
$MAKE distcheck
diff --git a/tests/vtexi.test b/tests/vtexi.test
index 619ed8766..6548cd7ce 100755
--- a/tests/vtexi.test
+++ b/tests/vtexi.test
@@ -1,5 +1,6 @@
#!/bin/sh
-# Copyright (C) 1996, 1997, 2000, 2001, 2002 Free Software Foundation, Inc.
+# Copyright (C) 1996, 1997, 2000, 2001, 2002, 2003
+# Free Software Foundation, Inc.
#
# This file is part of GNU Automake.
#
@@ -46,15 +47,15 @@ $AUTOMAKE
# textutils.info: textutils.texi version.texi
# (Today this should be `textutils.info: version.texi')
-grep '^textutils\.info:.*version\.texi$' Makefile.in
+grep 'textutils\.info:.*version\.texi$' Makefile.in
# Test for bug reported by Lars Hecking:
# When running the first version of configure.ac aware automake,
# @CONFIGURE_AC@ was not properly substituted.
-$EGREP '^stamp-vti:.*textutils\.texi( .*)?$' Makefile.in
-$EGREP '^stamp-vti:.*\$\(top_srcdir\)/configure( .*)?$' Makefile.in
+$EGREP 'stamp-vti:.*textutils\.texi( .*)?$' Makefile.in
+$EGREP 'stamp-vti:.*\$\(top_srcdir\)/configure( .*)?$' Makefile.in
# Check that the path to mdate-sh is correct. Over escaping of `$'