From 966ba774770c7b84f8e8788470d2672fafd6afb3 Mon Sep 17 00:00:00 2001 From: Alexandre Duret-Lutz Date: Sun, 25 Aug 2002 20:45:51 +0000 Subject: [PATCH] For PR automake/343: * automake.in (scan_texinfo_file) : Remove dvi, ps, and pdf. (output_texinfo_build_rules): Define %DIRSTAMP% when processing texibuild.am. Return $dirstamp and a list of files to clean. (handle_texinfo_helper): Process texi-vers.am after the call to output_texinfo_build_rules and use $dirstamp to define %DIRSTAMP%. * lib/am/texi-vers.am (%STAMPVTI%): Build %DIRSTAMP% if needed. * lib/am/texibuild.am (%DEST_PREFIX%%DEST_SUFFIX%): Likewise. (%DEST_PREFIX%.dvi, %DEST_PREFIX%.pdf): Depend on %DIRSTAMP%. * tests/texinfo13.test: New file. * tests/Makefile.am (TESTS): Add texinfo13.test. * lib/am/texinfos.am (install-info-am, dist-info): Looks for info files in build or source directory. This completes the change from 2002-07-30 (for PR automake/168). --- ChangeLog | 18 ++++++++++++++ Makefile.in | 48 ++++++++++++++++++------------------ NEWS | 1 + automake.in | 69 +++++++++++++++++++++++----------------------------- lib/am/texi-vers.am | 5 ++++ lib/am/texibuild.am | 11 +++++++-- lib/am/texinfos.am | 9 ++----- tests/Makefile.am | 1 + tests/Makefile.in | 1 + tests/texinfo13.test | 44 +++++++++++++++++++++++++++++++++ 10 files changed, 135 insertions(+), 72 deletions(-) create mode 100755 tests/texinfo13.test diff --git a/ChangeLog b/ChangeLog index e26d841..a04286b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,21 @@ +2002-08-25 Alexandre Duret-Lutz + + For PR automake/343: + * automake.in (scan_texinfo_file) : Remove dvi, ps, + and pdf. + (output_texinfo_build_rules): Define %DIRSTAMP% when processing + texibuild.am. Return $dirstamp and a list of files to clean. + (handle_texinfo_helper): Process texi-vers.am after the call to + output_texinfo_build_rules and use $dirstamp to define %DIRSTAMP%. + * lib/am/texi-vers.am (%STAMPVTI%): Build %DIRSTAMP% if needed. + * lib/am/texibuild.am (%DEST_PREFIX%%DEST_SUFFIX%): Likewise. + (%DEST_PREFIX%.dvi, %DEST_PREFIX%.pdf): Depend on %DIRSTAMP%. + * tests/texinfo13.test: New file. + * tests/Makefile.am (TESTS): Add texinfo13.test. + * lib/am/texinfos.am (install-info-am, dist-info): Looks for + info files in build or source directory. + This completes the change from 2002-07-30 (for PR automake/168). + 2002-08-24 Alexandre Duret-Lutz * automake.in (CLEAN, MAINTAINER_CLEAN): New constants. diff --git a/Makefile.in b/Makefile.in index 9309335..bfcfed3 100644 --- a/Makefile.in +++ b/Makefile.in @@ -177,6 +177,24 @@ uninstall-binSCRIPTS: echo " rm -f $(DESTDIR)$(bindir)/$$f"; \ rm -f $(DESTDIR)$(bindir)/$$f; \ done + +.texi.info: + @rm -f $@ $@-[0-9] $@-[0-9][0-9] + $(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir) \ + `test -f '$<' || echo '$(srcdir)/'`$< -o $@ + +.texi.dvi: + TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \ + MAKEINFO='$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir)' \ + $(TEXI2DVI) `test -f '$<' || echo '$(srcdir)/'`$< -o $@ + +.texi.pdf: + TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \ + MAKEINFO='$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir)' \ + $(TEXI2PDF) `test -f '$<' || echo '$(srcdir)/'`$< -o $@ +automake.info: version.texi +automake.dvi: version.texi +automake.pdf: version.texi version.texi: stamp-vti stamp-vti: automake.texi $(top_srcdir)/configure.in @(dir=.; test -f ./automake.texi || dir=$(srcdir); \ @@ -196,24 +214,6 @@ mostlyclean-vti: maintainer-clean-vti: -rm -f stamp-vti version.texi - -.texi.info: - @rm -f $@ $@-[0-9] $@-[0-9][0-9] - $(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir) \ - `test -f '$<' || echo '$(srcdir)/'`$< -o $@ - -.texi.dvi: - TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \ - MAKEINFO='$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir)' \ - $(TEXI2DVI) `test -f '$<' || echo '$(srcdir)/'`$< -o $@ - -.texi.pdf: - TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \ - MAKEINFO='$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir)' \ - $(TEXI2PDF) `test -f '$<' || echo '$(srcdir)/'`$< -o $@ -automake.info: version.texi -automake.dvi: version.texi -automake.pdf: version.texi TEXI2DVI = texi2dvi TEXI2PDF = $(TEXI2DVI) --pdf @@ -243,7 +243,7 @@ uninstall-info-am: dist-info: $(INFO_DEPS) list='$(INFO_DEPS)'; \ for base in $$list; do \ - d=$(srcdir); \ + if test -f $$base; then d=.; else d=$(srcdir); fi; \ for file in $$d/$$base*; do \ relfile=`expr "$$file" : "$$d/\(.*\)"`; \ test -f $(distdir)/$$relfile || \ @@ -253,12 +253,12 @@ dist-info: $(INFO_DEPS) mostlyclean-aminfo: -rm -f automake.aux automake.cm automake.cp automake.cps automake.cv \ - automake.dvi automake.fn automake.ky automake.log automake.op \ - automake.ov automake.pdf automake.pg automake.ps automake.tmp \ - automake.toc automake.tp automake.tr automake.vr automake.vrs + automake.fn automake.ky automake.log automake.op automake.ov \ + automake.pg automake.tmp automake.toc automake.tp automake.tr \ + automake.vr automake.vrs automake.dvi automake.pdf \ + automake.ps maintainer-clean-aminfo: - cd $(srcdir) && \ list='$(INFO_DEPS)'; for i in $$list; do \ rm -f $$i; \ if test "`echo $$i-[0-9]*`" != "$$i-[0-9]*"; then \ @@ -563,7 +563,7 @@ install-info-am: $(INFO_DEPS) $(mkinstalldirs) $(DESTDIR)$(infodir) @list='$(INFO_DEPS)'; \ for file in $$list; do \ - d=$(srcdir); \ + if test -f $$file; then d=.; else d=$(srcdir); fi; \ for ifile in echo $$d/$$file $$d/$$file-[0-9] $$d/$$file-[0-9][0-9]; do \ if test -f $$ifile; then \ relfile=`expr "$$ifile" : "$$d/\(.*\)"`; \ diff --git a/NEWS b/NEWS index fb27007..9663aef 100644 --- a/NEWS +++ b/NEWS @@ -17,6 +17,7 @@ New in 1.6c: when `make installcheck' is run. This is enabled by --gnits. * Texinfo rules now support the `ps' and `pdf' targets. * Info files are now created in the build directory, not the source directory. +* info_TEXINFOS supports files in subdirectories. * `make distcheck' will enforce DESTDIR support by attempting a DESTDIR install. * `+=' can be used in conditionals, even if the augmented variable diff --git a/automake.in b/automake.in index 686b8c0..4b8f147 100755 --- a/automake.in +++ b/automake.in @@ -3448,7 +3448,7 @@ sub scan_texinfo_file # These are always created, no matter whether indexes are used or not. # (Actually tmp is only created if an @macro is used and a certain e-TeX # feature is not available.) - my @clean_suffixes = qw(aux dvi log pdf ps toc tmp + my @clean_suffixes = qw(aux log toc tmp cp fn ky vr tp pg); # grep new.*index texinfo.tex # There are predefined indexes which don't follow the regular rules. @@ -3533,6 +3533,7 @@ sub scan_texinfo_file return ($outfile, $vfile, (sort keys %clean_files)); } +# ($DIRSTAMP, @CLEAN_FILES) # output_texinfo_build_rules ($SOURCE, $DEST, @DEPENDENCIES) # ---------------------------------------------------------- # SOURCE - the source Texinfo file @@ -3576,21 +3577,6 @@ sub output_texinfo_build_rules ($$@) # make sure this directory will exist. my $dirstamp = require_build_directory_maybe ($dest); - # It is wrong to make $SOURCE dependent on $DIRSTAMP, because - # $SOURCE is distributed and $DIRSTAMP is not. A generated file - # should never be dependent upon a non-distributed built file. - # - # So don't do that: - # - # push @deps, $dirstamp; - # - # Instead we append all dirstamps to the $(am__texinfo_dirstamps) - # variable and have this variable in the dependencies of - # info, dvi, etc. (FIXME: this is not done yet -- support for - # Texinfo files in subdirectories is not complete.) - macro_define ('am__texinfo_dirstamps', VAR_AUTOMAKE, '+', 'TRUE', - $dirstamp, 'internal'); - $output_rules .= &file_contents ('texibuild', GENERIC => $generic, SOURCE_SUFFIX => $ssfx, @@ -3598,7 +3584,9 @@ sub output_texinfo_build_rules ($$@) DEST_PREFIX => $dpfx, DEST_SUFFIX => $dsfx, MAKEINFOFLAGS => $makeinfoflags, - DEPS => "@deps"); + DEPS => "@deps", + DIRSTAMP => $dirstamp); + return ($dirstamp, "$dpfx.dvi", "$dpfx.pdf", "$dpfx.ps"); } @@ -3648,6 +3636,28 @@ sub handle_texinfo_helper $outdir = "" if $outdir eq './'; $out_file = $outdir . $out_file; + # If user specified file_TEXINFOS, then use that as explicit + # dependency list. + @texi_deps = (); + push (@texi_deps, "$outdir$vtexi") if $vtexi; + + my $canonical = &canonicalize ($infobase); + if (variable_defined ($canonical . "_TEXINFOS")) + { + push (@texi_deps, '$(' . $canonical . '_TEXINFOS)'); + &push_dist_common ('$(' . $canonical . '_TEXINFOS)'); + } + + my ($dirstamp, @cfiles) = + output_texinfo_build_rules ($info_cursor, $out_file, @texi_deps); + push (@texi_cleans, @cfiles); + + push (@info_deps_list, $out_file); + push (@dvis_list, $infobase . '.dvi'); + push (@pdfs_list, $infobase . '.pdf'); + push (@pss_list, $infobase . '.ps'); + + # If a vers*.texi file is needed, emit the rule. if ($vtexi) { err_am ("`$vtexi', included in `$info_cursor', " @@ -3683,33 +3693,14 @@ sub handle_texinfo_helper { $conf_dir = '$(srcdir)/'; } - $output_rules .= &file_contents ('texi-vers', + $output_rules .= &file_contents ('texi-vers', TEXI => $info_cursor, VTI => $vti, STAMPVTI => "${outdir}stamp-$vti", VTEXI => "$outdir$vtexi", - MDDIR => $conf_dir); - } - - # If user specified file_TEXINFOS, then use that as explicit - # dependency list. - @texi_deps = (); - push (@texi_deps, "$outdir$vtexi") if $vtexi; - - my $canonical = &canonicalize ($infobase); - if (variable_defined ($canonical . "_TEXINFOS")) - { - push (@texi_deps, '$(' . $canonical . '_TEXINFOS)'); - &push_dist_common ('$(' . $canonical . '_TEXINFOS)'); + MDDIR => $conf_dir, + DIRSTAMP => $dirstamp); } - - output_texinfo_build_rules ($info_cursor, $out_file, - @texi_deps); - - push (@info_deps_list, $out_file); - push (@dvis_list, $infobase . '.dvi'); - push (@pdfs_list, $infobase . '.pdf'); - push (@pss_list, $infobase . '.ps'); } # Handle location of texinfo.tex. diff --git a/lib/am/texi-vers.am b/lib/am/texi-vers.am index 4429e62..cacc429 100644 --- a/lib/am/texi-vers.am +++ b/lib/am/texi-vers.am @@ -29,6 +29,11 @@ DIST_COMMON += %VTEXI% %STAMPVTI% ## Depend on %CONFIGURE-AC% so that version number updates cause a ## rebuild. %STAMPVTI%: %TEXI% $(top_srcdir)/%CONFIGURE-AC% +## It is wrong to have %STAMPTVTI% dependent on %DIRSTAMP%, because +## %STAMPVTI% is 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% @(dir=.; test -f ./%TEXI% || dir=$(srcdir); \ set `$(SHELL) %MDDIR%mdate-sh $$dir/%TEXI%`; \ echo "@set UPDATED $$1 $$2 $$3"; \ diff --git a/lib/am/texibuild.am b/lib/am/texibuild.am index aee95ab..a834f49 100644 --- a/lib/am/texibuild.am +++ b/lib/am/texibuild.am @@ -25,11 +25,16 @@ ## using --no-split), you'll be left with some dead info files lying ## around -- dead files which will end up in the distribution. @rm -f $@ $@-[0-9] $@-[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% $(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) %MAKEINFOFLAGS% \ `test -f '%SOURCE%' || echo '$(srcdir)/'`%SOURCE% -o $@ ?GENERIC?%SOURCE_SUFFIX%.dvi: -?!GENERIC?%DEST_PREFIX%.dvi: %SOURCE% %DEPS% +?!GENERIC?%DEST_PREFIX%.dvi: %SOURCE% %DEPS% %DIRSTAMP% TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \ ## Must set MAKEINFO like this so that version.texi will be found even ## if it is in srcdir (-I $(srcdir) is set in %MAKEINFOFLAGS%). @@ -37,7 +42,7 @@ $(TEXI2DVI) `test -f '%SOURCE%' || echo '$(srcdir)/'`%SOURCE% -o $@ ?GENERIC?%SOURCE_SUFFIX%.pdf: -?!GENERIC?%DEST_PREFIX%.pdf: %SOURCE% %DEPS% +?!GENERIC?%DEST_PREFIX%.pdf: %SOURCE% %DEPS% %DIRSTAMP% TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \ ## Must set MAKEINFO like this so that version.texi will be found even ## if it is in srcdir (-I $(srcdir) is set in %MAKEINFOFLAGS%). @@ -45,6 +50,8 @@ $(TEXI2PDF) `test -f '%SOURCE%' || echo '$(srcdir)/'`%SOURCE% -o $@ ## If we are using the generic rules, we need separate dependencies. +## (Don't wonder about %DIRSTAMP% here, this is used only by non-generic +## rules.) if %?GENERIC% %DEST_PREFIX%%DEST_SUFFIX%: %DEPS% %DEST_PREFIX%.dvi: %DEPS% diff --git a/lib/am/texinfos.am b/lib/am/texinfos.am index 59deefe..2e70c70 100644 --- a/lib/am/texinfos.am +++ b/lib/am/texinfos.am @@ -120,8 +120,7 @@ install-info-am: $(INFO_DEPS) $(mkinstalldirs) $(DESTDIR)$(infodir) @list='$(INFO_DEPS)'; \ for file in $$list; do \ -?CYGNUS? if test -f $$file; then d=.; else d=$(srcdir); fi; \ -?!CYGNUS? d=$(srcdir); \ + if test -f $$file; then d=.; else d=$(srcdir); fi; \ for ifile in echo $$d/$$file $$d/$$file-[0-9] $$d/$$file-[0-9][0-9]; do \ if test -f $$ifile; then \ ## Strip leading '$$d/'. @@ -204,10 +203,7 @@ if %?LOCAL-TEXIS% dist-info: $(INFO_DEPS) list='$(INFO_DEPS)'; \ for base in $$list; do \ -## In Cygnus mode, allow info file to be in source or build dir. In -## other modes, allow only source dir. -?!CYGNUS? d=$(srcdir); \ -?CYGNUS? if test -f $$base; then d=.; else d=$(srcdir); fi; \ + if test -f $$base; then d=.; else d=$(srcdir); fi; \ for file in $$d/$$base*; do \ ## Strip leading '$$d/'. relfile=`expr "$$file" : "$$d/\(.*\)"`; \ @@ -235,7 +231,6 @@ mostlyclean-aminfo: maintainer-clean-am: maintainer-clean-aminfo maintainer-clean-aminfo: ## Eww. But how else can we find all the output files from makeinfo? -?!CYGNUS? cd $(srcdir) && \ list='$(INFO_DEPS)'; for i in $$list; do \ rm -f $$i; \ if test "`echo $$i-[0-9]*`" != "$$i-[0-9]*"; then \ diff --git a/tests/Makefile.am b/tests/Makefile.am index 8fc1264..b0af7f0 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -389,6 +389,7 @@ texinfo7.test \ texinfo8.test \ texinfo9.test \ texinfo10.test \ +texinfo13.test \ texinfo16.test \ transform.test \ unused.test \ diff --git a/tests/Makefile.in b/tests/Makefile.in index 5e1d4da..724ab36 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -477,6 +477,7 @@ texinfo7.test \ texinfo8.test \ texinfo9.test \ texinfo10.test \ +texinfo13.test \ texinfo16.test \ transform.test \ unused.test \ diff --git a/tests/texinfo13.test b/tests/texinfo13.test new file mode 100755 index 0000000..737ef0b --- /dev/null +++ b/tests/texinfo13.test @@ -0,0 +1,44 @@ +#! /bin/sh + +# Check for subdir Texinfo. +# PR/343 + +required='GNUmake makeinfo' +. $srcdir/defs || exit 1 + +set -e + +echo AC_OUTPUT >> configure.in + +cat > Makefile.am << 'END' +info_TEXINFOS = subdir/main.texi +subdir_main_TEXINFOS = subdir/inc.texi +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 -- 2.7.4