* automake.in (%required_targets, %dependencies): Add dvi, info,
[platform/upstream/automake.git] / lib / am / texinfos.am
1 ## automake - create Makefile.in from Makefile.am
2 ## Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
3 ## Free Software Foundation, Inc.
4
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.
9
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.
14
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.
19
20 ## The way to make PostScript, for those who want it.
21 DVIPS = dvips
22 .dvi.ps:
23         $(DVIPS) $< -o $@
24
25 .PHONY: info info-am dvi dvi-am
26 ?SUBDIRS?.PHONY info: info-recursive
27 ?SUBDIRS?.PHONY dvi: dvi-recursive
28 ?!SUBDIRS?info: info-am
29 ?!SUBDIRS?dvi: dvi-am
30 info-am: $(INFO_DEPS)
31 dvi-am: $(DVIS)
32
33 ## Look in both . and srcdir because the info pages might have been
34 ## rebuilt in the build directory.  Can't cd to srcdir; that might
35 ## break a possible install-sh reference.
36 ##
37 ## Funny name due to --cygnus influence; we want to reserve
38 ## `install-info' for the user.
39 ##
40 ## TEXINFOS primary are always installed in infodir, hence install-data
41 ## is hard coded.
42 ?INSTALL-INFO?_am_installdirs += $(DESTDIR)$(infodir)
43 .PHONY: install-info-am
44 ?INSTALL-INFO?install-data-am: install-info-am
45 install-info-am: $(INFO_DEPS)
46         @$(NORMAL_INSTALL)
47         $(mkinstalldirs) $(DESTDIR)$(infodir)
48         @list='$(INFO_DEPS)'; \
49         for file in $$list; do \
50 ?CYGNUS?          if test -f $$file; then d=.; else d=$(srcdir); fi; \
51 ?!CYGNUS?         d=$(srcdir); \
52 ## We use these strange circumlocutions because we want the "ifile" to
53 ## be relative, for the install.
54           for ifile in `CDPATH=: && cd $$d && echo $$file $$file-[0-9] $$file-[0-9][0-9]`; do \
55             if test -f $$d/$$ifile; then \
56               echo " $(INSTALL_DATA) $$d/$$ifile $(DESTDIR)$(infodir)/$$ifile"; \
57               $(INSTALL_DATA) $$d/$$ifile $(DESTDIR)$(infodir)/$$ifile; \
58             else : ; fi; \
59           done; \
60         done
61         @$(POST_INSTALL)
62 ## Only run this code if install-info actually exists, and it is not
63 ## the Debian install-info.  FIXME: once Debian install-info goes
64 ## away, we can remove this hack.
65         @if $(SHELL) -c 'install-info --version | sed 1q | fgrep -s -v -i debian' >/dev/null 2>&1; then \
66           list='$(INFO_DEPS)'; \
67           for file in $$list; do \
68 ## Run `:' after install-info in case install-info fails.  We really
69 ## don't care about failures here, because they can be spurious.  For
70 ## instance if you don't have a dir file, install-info will fail.  I
71 ## think instead it should create a new dir file for you.  This bug
72 ## causes the `make distcheck' target to fail reliably.
73             echo " install-info --info-dir=$(DESTDIR)$(infodir) $(DESTDIR)$(infodir)/$$file";\
74 ## Use `|| :' here because Sun make passes -e to sh; if install-info
75 ## fails then we'd fail if we used `;'.
76             install-info --info-dir=$(DESTDIR)$(infodir) $(DESTDIR)$(infodir)/$$file || :;\
77           done; \
78         else : ; fi
79
80 .PHONY: uninstall-info
81 ?INSTALL-INFO?uninstall-am: uninstall-info
82 uninstall-info:
83         $(PRE_UNINSTALL)
84 ## Run two loops here so that we can handle PRE_UNINSTALL and
85 ## NORMAL_UNINSTALL correctly.
86         @if $(SHELL) -c 'install-info --version | sed 1q | fgrep -s -v -i debian' >/dev/null 2>&1; then \
87           list='$(INFO_DEPS)'; \
88           for file in $$list; do \
89 ## install-info needs the actual info file.  We use the installed one,
90 ## rather than relying on one still being in srcdir or builddir.
91             echo " install-info --info-dir=$(DESTDIR)$(infodir) --remove $(DESTDIR)$(infodir)/$$file"; \
92             install-info --info-dir=$(DESTDIR)$(infodir) --remove $(DESTDIR)$(infodir)/$$file; \
93           done; \
94         else :; fi
95         @$(NORMAL_UNINSTALL)
96         @list='$(INFO_DEPS)'; \
97         for file in $$list; do \
98           (if cd $(DESTDIR)$(infodir); then \
99              echo " rm -f $$file $$file-[0-9] $$file-[0-9][0-9])"; \
100              rm -f $$file $$file-[0-9] $$file-[0-9][0-9]; \
101            else :; fi); \
102         done
103
104 .PHONY: dist-info
105 dist-info: $(INFO_DEPS)
106         list='$(INFO_DEPS)'; \
107         for base in $$list; do \
108 ## In Cygnus mode, allow info file to be in source or build dir.  In
109 ## other modes, allow only source dir.
110 ?!CYGNUS?         d=$(srcdir); \
111 ?CYGNUS?          if test -f $$base; then d=.; else d=$(srcdir); fi; \
112           for file in `CDPATH=: && cd $$d && eval echo $$base*`; do \
113             test -f $(distdir)/$$file \
114             || cp -p $$d/$$file $(distdir)/$$file; \
115           done; \
116         done
117
118
119 ## How to clean.  The funny name is due to --cygnus influence; in
120 ## Cygnus mode, `clean-info' is a target that users can use.
121
122 .PHONY: mostlyclean-aminfo
123 mostlyclean-am: mostlyclean-aminfo
124 mostlyclean-aminfo:
125 %TEXICLEAN%
126
127 .PHONY: maintainer-clean-aminfo
128 maintainer-clean-am: maintainer-clean-aminfo
129 maintainer-clean-aminfo:
130 ## Eww.  But how else can we find all the output files from makeinfo?
131 ?!CYGNUS?       cd $(srcdir) && \
132         for i in $(INFO_DEPS); do \
133           rm -f $$i; \
134           if test "`echo $$i-[0-9]*`" != "$$i-[0-9]*"; then \
135             rm -f $$i-[0-9]*; \
136           fi; \
137         done
138
139 ?CYGNUS?.PHONY: clean-info
140 ?CYGNUS?clean-info: mostlyclean-aminfo