Update automake to version 1.10
[msysgit.git] / share / automake-1.10 / am / texibuild.am
blob6ec84e6f743f369b1ecabd81d0ee5b6223cd7c60
1 ## automake - create Makefile.in from Makefile.am
2 ## Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
3 ##   2003, 2004, 2005  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., 51 Franklin Street, Fifth Floor, Boston, MA
18 ## 02110-1301, 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) $(AM_MAKEFLAGS) %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=: && backupdir="$(am__leading_dot)am$$$$" && \
38 ?INSRC? am__cwd=`pwd` && cd $(srcdir) && \
39         rm -rf $$backupdir && mkdir $$backupdir && \
40 ## If makeinfo is not installed we must not backup the files so
41 ##`missing' can do its job and touch $@ if it exists.
42         if ($(MAKEINFO) --version) >/dev/null 2>&1; then \
43           for f in $@ $@-[0-9] $@-[0-9][0-9] $(@:.info=).i[0-9] $(@:.info=).i[0-9][0-9]; do \
44             if test -f $$f; then mv $$f $$backupdir; restore=mv; else :; fi; \
45           done; \
46         else :; fi && \
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; exit $$rc
63 INFO_DEPS += %DEST_INFO_PREFIX%%DEST_SUFFIX%
65 ?GENERIC?%SOURCE_SUFFIX%.dvi:
66 ?!GENERIC?%DEST_PREFIX%.dvi: %SOURCE% %DEPS% %DIRSTAMP%
67         TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \
68 ## Must set MAKEINFO like this so that version.texi will be found even
69 ## if it is in srcdir (-I $(srcdir) is set in %MAKEINFOFLAGS%).
70         MAKEINFO='$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) %MAKEINFOFLAGS%' \
71 ## Do not use `-o' unless necessary: it is only supported since Texinfo 4.1.
72 ?GENERIC?       $(TEXI2DVI) %SOURCE%
73 ?!GENERIC?      $(TEXI2DVI) -o $@ `test -f '%SOURCE%' || echo '$(srcdir)/'`%SOURCE%
75 ?GENERIC?%SOURCE_SUFFIX%.pdf:
76 ?!GENERIC?%DEST_PREFIX%.pdf: %SOURCE% %DEPS% %DIRSTAMP%
77         TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \
78 ## Must set MAKEINFO like this so that version.texi will be found even
79 ## if it is in srcdir (-I $(srcdir) is set in %MAKEINFOFLAGS%).
80         MAKEINFO='$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) %MAKEINFOFLAGS%' \
81 ## Do not use `-o' unless necessary: it is only supported since Texinfo 4.1.
82 ?GENERIC?       $(TEXI2PDF) %SOURCE%
83 ?!GENERIC?      $(TEXI2PDF) -o $@ `test -f '%SOURCE%' || echo '$(srcdir)/'`%SOURCE%
85 ?GENERIC?%SOURCE_SUFFIX%.html:
86 ?!GENERIC?%DEST_PREFIX%.html: %SOURCE% %DEPS% %DIRSTAMP%
87 ## When --split (the default) is used, makeinfo will output a
88 ## directory.  However it will not update the time stamp of a
89 ## previously existing directory, and when the names of the nodes
90 ## in the manual change, it may leave unused pages.  Our fix
91 ## is to build under a temporary name, and replace the target on
92 ## success.
93         rm -rf $(@:.html=.htp)
94         if $(MAKEINFOHTML) $(AM_MAKEINFOHTMLFLAGS) $(MAKEINFOFLAGS) %MAKEINFOFLAGS% \
95 ?GENERIC?        -o $(@:.html=.htp) %SOURCE%; \
96 ?!GENERIC?       -o $(@:.html=.htp) `test -f '%SOURCE%' || echo '$(srcdir)/'`%SOURCE%; \
97         then \
98           rm -rf $@; \
99 ## Work around a bug in Texinfo 4.1 (-o foo.html outputs files in foo/
100 ## instead of foo.html/).
101           if test ! -d $(@:.html=.htp) && test -d $(@:.html=); then \
102             mv $(@:.html=) $@; else mv $(@:.html=.htp) $@; fi; \
103         else \
104           if test ! -d $(@:.html=.htp) && test -d $(@:.html=); then \
105             rm -rf $(@:.html=); else rm -Rf $(@:.html=.htp) $@; fi; \
106           exit 1; \
107         fi
109 ## If we are using the generic rules, we need separate dependencies.
110 ## (Don't wonder about %DIRSTAMP% here, this is used only by non-generic
111 ## rules.)
112 if %?GENERIC_INFO%
113 %DEST_INFO_PREFIX%%DEST_SUFFIX%: %SOURCE_REAL% %DEPS%
114 endif %?GENERIC_INFO%
115 if %?GENERIC%
116 %DEST_PREFIX%.dvi: %SOURCE_REAL% %DEPS%
117 %DEST_PREFIX%.pdf: %SOURCE_REAL% %DEPS%
118 %DEST_PREFIX%.html: %SOURCE_REAL% %DEPS%
119 endif %?GENERIC%