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