* automake.in (handle_emacs_lisp): Define $(ELCFILES) as
[automake.git] / lib / am / texibuild.am
blobcfb3be22069f499019c131bc64822da6d460da4d
1 ## automake - create Makefile.in from Makefile.am
2 ## Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
3 ## Free Software Foundation, Inc.
5 ## This program is free software; you can redistribute it and/or modify
6 ## it under the terms of the GNU General Public License as published by
7 ## the Free Software Foundation; either version 2, or (at your option)
8 ## any later version.
10 ## This program is distributed in the hope that it will be useful,
11 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 ## GNU General Public License for more details.
15 ## You should have received a copy of the GNU General Public License
16 ## along with this program; if not, write to the Free Software
17 ## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
18 ## 02111-1307, USA.
21 ?GENERIC_INFO?%SOURCE_SUFFIX%%DEST_SUFFIX%:
22 ?!GENERIC_INFO?%DEST_INFO_PREFIX%%DEST_SUFFIX%: %SOURCE_INFO% %DEPS%
23 ## It is wrong to have `info' files dependent on %DIRSTAMP%, because
24 ## `info' files are distributed and %DIRSTAMP% isn't: a distributed file
25 ## should never be dependent upon a non-distributed built file.
26 ## Therefore we ensure that %DIRSTAMP% exists in the rule.
27 ?!INSRC??DIRSTAMP?      @test -f %DIRSTAMP% || $(MAKE) %DIRSTAMP%
28 ## Back up the info files before running makeinfo. This is the cheapest
29 ## way to ensure that
30 ## 1) If the texinfo file shrinks (or if you start using --no-split),
31 ##    you'll not be left with some dead info files lying around -- dead
32 ##    files which would end up in the distribution.
33 ## 2) If the texinfo file has some minor mistakes which cause makeinfo
34 ##    to fail, the info files are not removed.  (They are needed by the
35 ##    developer while he writes documentation.)
36 ## *.iNN files are used on DJGPP.  See the comments in install-info-am
37         restore=: && \
38         backupdir="$(am__leading_dot)am$$$$" && \
39 ?INSRC? am__cwd=`pwd` && cd $(srcdir) && \
40         rm -rf $$backupdir && mkdir $$backupdir && \
41         for f in $@ $@-[0-9] $@-[0-9][0-9] $(@:.info=).i[0-9] $(@:.info=).i[0-9][0-9]; do \
42           if test -f $$f; then \
43             mv $$f $$backupdir; \
44             restore=mv; \
45           fi; \
46         done; \
47 ?INSRC? cd "$$am__cwd"; \
48         if $(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) %MAKEINFOFLAGS% \
49 ?!INSRC?         -o $@ `test -f '%SOURCE_INFO%' || echo '$(srcdir)/'`%SOURCE_INFO%; \
50 ?INSRC??!GENERIC_INFO?   -o $@ $(srcdir)/%SOURCE_INFO%; \
51 ?INSRC??GENERIC_INFO?    -o $@ $<; \
52         then \
53           rc=0; \
54 ?INSRC?   cd $(srcdir); \
55         else \
56           rc=$$?; \
57 ## Beware that backup info files might come from a subdirectory.
58 ?INSRC?   cd $(srcdir) && \
59           $$restore $$backupdir/* `echo "./$@" | sed 's|[^/]*$$||'`; \
60         fi; \
61         rm -rf $$backupdir; \
62         exit $$rc
64 INFO_DEPS += %DEST_INFO_PREFIX%%DEST_SUFFIX%
66 ?GENERIC?%SOURCE_SUFFIX%.dvi:
67 ?!GENERIC?%DEST_PREFIX%.dvi: %SOURCE% %DEPS% %DIRSTAMP%
68         TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \
69 ## Must set MAKEINFO like this so that version.texi will be found even
70 ## if it is in srcdir (-I $(srcdir) is set in %MAKEINFOFLAGS%).
71         MAKEINFO='$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) %MAKEINFOFLAGS%' \
72 ## Do not use `-o' unless necessary: it is only supported since Texinfo 4.1.
73 ?GENERIC?       $(TEXI2DVI) %SOURCE%
74 ?!GENERIC?      $(TEXI2DVI) -o $@ `test -f '%SOURCE%' || echo '$(srcdir)/'`%SOURCE%
76 ?GENERIC?%SOURCE_SUFFIX%.pdf:
77 ?!GENERIC?%DEST_PREFIX%.pdf: %SOURCE% %DEPS% %DIRSTAMP%
78         TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \
79 ## Must set MAKEINFO like this so that version.texi will be found even
80 ## if it is in srcdir (-I $(srcdir) is set in %MAKEINFOFLAGS%).
81         MAKEINFO='$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) %MAKEINFOFLAGS%' \
82 ## Do not use `-o' unless necessary: it is only supported since Texinfo 4.1.
83 ?GENERIC?       $(TEXI2PDF) %SOURCE%
84 ?!GENERIC?      $(TEXI2PDF) -o $@ `test -f '%SOURCE%' || echo '$(srcdir)/'`%SOURCE%
86 ?GENERIC?%SOURCE_SUFFIX%.html:
87 ?!GENERIC?%DEST_PREFIX%.html: %SOURCE% %DEPS% %DIRSTAMP%
88         $(MAKEINFOHTML) $(AM_MAKEINFOHTMLFLAGS) $(MAKEINFOFLAGS) %MAKEINFOFLAGS% \
89 ?GENERIC?        -o $@ %SOURCE%
90 ?!GENERIC?       -o $@ `test -f '%SOURCE%' || echo '$(srcdir)/'`%SOURCE%
91 ## Work around a bug in Texinfo 4.1 (-o foo.html outputs files in foo/
92 ## instead of foo.html/).
93         if test ! -d $@ && test -d $(@:.html=); then \
94           mv $(@:.html=) $@; else :; fi
96 ## If we are using the generic rules, we need separate dependencies.
97 ## (Don't wonder about %DIRSTAMP% here, this is used only by non-generic
98 ## rules.)
99 if %?GENERIC_INFO%
100 %DEST_INFO_PREFIX%%DEST_SUFFIX%: %SOURCE_REAL% %DEPS%
101 endif %?GENERIC_INFO%
102 if %?GENERIC%
103 %DEST_PREFIX%.dvi: %SOURCE_REAL% %DEPS%
104 %DEST_PREFIX%.pdf: %SOURCE_REAL% %DEPS%
105 %DEST_PREFIX%.html: %SOURCE_REAL% %DEPS%
106 endif %?GENERIC%