automake-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

FYI: PR/343: support for Texinfo files in subdirectories.


From: Alexandre Duret-Lutz
Subject: FYI: PR/343: support for Texinfo files in subdirectories.
Date: 25 Aug 2002 22:34:31 +0200
User-agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7

I'm installing this patch for PR/343.

The main difficulty was to ensure that the subdirectory exist
before we create files into it.  The idiom used in other places
is to have targets dependents on `subdir/.dirstamp' and create
the directory as a side-effect of the `subdir/.distamp' rule.

As explained in the text of PR/343 or in the comments of this
patch, we can't use this for `.info' files: a distributed file
(the `.info' file), should never depends on a non-distributed
built file (.dirstamp), else it gets always rebuilt and there is
no reason to distribute it!

So instead of depending on `.dirstamp', I've augmented the
`.info' rules with:
    test -f subdir/.dirstamp || $(MAKE) subdir/.dirstamp

For `.ps', `.pdf, and `.dvi' files, depending on `.dirstamp' is
ok because they are not distributed.  It will be an issue if
people try to distribute these file though, but that's not
something Automake claims to support.  Some projects have
hacks to distribute `.ps' manuals, there should be no concern as
long as they don't use subdirectories (no .dirstamp dependency).

(This suggests that using `.dirstamp' to build directory
is not the panacea; but I'm not sure how else it could be done.
Maybe from ./configure like we do for DEP_FILES?)

The last item in the ChangeLog is a fix for a bug from an old
patch: while patching Automake to create info files in the build
directory instead of the source directory, I forgot to update
the install-info-am and dist-info targets.  This bug is
triggered by the test case included (texinfo13.test).

(Leaving Makefile.in in the patch to show the change in the
non-subdir case.)

2002-08-25  Alexandre Duret-Lutz  <address@hidden>

        For PR automake/343:
        * automake.in (scan_texinfo_file) <clean_suffixes>: 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): Look for
        info files in build or source directory.
        This completes the change from 2002-07-30 (for PR automake/168).

Index: Makefile.in
===================================================================
RCS file: /cvs/automake/automake/Makefile.in,v
retrieving revision 1.382
diff -u -r1.382 Makefile.in
--- Makefile.in 30 Jul 2002 20:15:31 -0000      1.382
+++ Makefile.in 25 Aug 2002 20:08:52 -0000
@@ -177,6 +177,24 @@
          echo " rm -f $(DESTDIR)$(bindir)/$$f"; \
          rm -f $(DESTDIR)$(bindir)/$$f; \
        done
+
+.texi.info:
+       @rm -f $@ address@hidden address@hidden
+       $(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 @@
 
 maintainer-clean-vti:
        -rm -f stamp-vti version.texi
-
-.texi.info:
-       @rm -f $@ address@hidden address@hidden
-       $(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 @@
 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 @@
 
 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 @@
        $(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/\(.*\)"`; \
Index: NEWS
===================================================================
RCS file: /cvs/automake/automake/NEWS,v
retrieving revision 1.190
diff -u -r1.190 NEWS
--- NEWS        31 Jul 2002 19:58:25 -0000      1.190
+++ NEWS        25 Aug 2002 20:08:54 -0000
@@ -17,6 +17,7 @@
   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
Index: automake.in
===================================================================
RCS file: /cvs/automake/automake/automake.in,v
retrieving revision 1.1343
diff -u -r1.1343 automake.in
--- automake.in 24 Aug 2002 20:43:01 -0000      1.1343
+++ automake.in 25 Aug 2002 20:09:18 -0000
@@ -3448,7 +3448,7 @@
     # 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 @@
     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 @@
   # 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 @@
                                    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 @@
        $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 @@
            {
                $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.
Index: lib/am/texi-vers.am
===================================================================
RCS file: /cvs/automake/automake/lib/am/texi-vers.am,v
retrieving revision 1.21
diff -u -r1.21 texi-vers.am
--- lib/am/texi-vers.am 30 Jul 2002 20:15:32 -0000      1.21
+++ lib/am/texi-vers.am 25 Aug 2002 20:09:21 -0000
@@ -29,6 +29,11 @@
 ## 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"; \
Index: lib/am/texibuild.am
===================================================================
RCS file: /cvs/automake/automake/lib/am/texibuild.am,v
retrieving revision 1.6
diff -u -r1.6 texibuild.am
--- lib/am/texibuild.am 30 Jul 2002 20:15:32 -0000      1.6
+++ lib/am/texibuild.am 25 Aug 2002 20:09:21 -0000
@@ -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 $@ address@hidden address@hidden
+## 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%
Index: lib/am/texinfos.am
===================================================================
RCS file: /cvs/automake/automake/lib/am/texinfos.am,v
retrieving revision 1.96
diff -u -r1.96 texinfos.am
--- lib/am/texinfos.am  8 Jul 2002 19:41:23 -0000       1.96
+++ lib/am/texinfos.am  25 Aug 2002 20:09:22 -0000
@@ -120,8 +120,7 @@
        $(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 @@
 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 @@
 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 \
Index: tests/Makefile.am
===================================================================
RCS file: /cvs/automake/automake/tests/Makefile.am,v
retrieving revision 1.431
diff -u -r1.431 Makefile.am
--- tests/Makefile.am   23 Aug 2002 19:11:31 -0000      1.431
+++ tests/Makefile.am   25 Aug 2002 20:09:22 -0000
@@ -389,6 +389,7 @@
 texinfo8.test \
 texinfo9.test \
 texinfo10.test \
+texinfo13.test \
 texinfo16.test \
 transform.test \
 unused.test \
Index: tests/Makefile.in
===================================================================
RCS file: /cvs/automake/automake/tests/Makefile.in,v
retrieving revision 1.553
diff -u -r1.553 Makefile.in
--- tests/Makefile.in   23 Aug 2002 19:11:32 -0000      1.553
+++ tests/Makefile.in   25 Aug 2002 20:09:22 -0000
@@ -477,6 +477,7 @@
 texinfo8.test \
 texinfo9.test \
 texinfo10.test \
+texinfo13.test \
 texinfo16.test \
 transform.test \
 unused.test \
Index: tests/texinfo13.test
===================================================================
RCS file: tests/texinfo13.test
diff -N tests/texinfo13.test
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ tests/texinfo13.test        25 Aug 2002 20:09:23 -0000
@@ -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
address@hidden main.info
address@hidden main
address@hidden Top
+Hello walls.
address@hidden version.texi
address@hidden inc.texi
address@hidden
+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


-- 
Alexandre Duret-Lutz





reply via email to

[Prev in Thread] Current Thread [Next in Thread]