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