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