texinfo install fix
[platform/upstream/automake.git] / lib / am / texinfos.am
1 ## automake - create Makefile.in from Makefile.am
2 ## Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc.
3
4 ## This program is free software; you can redistribute it and/or modify
5 ## it under the terms of the GNU General Public License as published by
6 ## the Free Software Foundation; either version 2, or (at your option)
7 ## any later version.
8
9 ## This program is distributed in the hope that it will be useful,
10 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
11 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 ## GNU General Public License for more details.
13
14 ## You should have received a copy of the GNU General Public License
15 ## along with this program; if not, write to the Free Software
16 ## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
17 ## 02111-1307, USA.
18 .texi.info:
19 ## We want to force the .info file to be built in srcdir.  This is
20 ## probably the simplest way.  However, at Cygnus .info files are
21 ## always put into the build directory.  So at runtime we select which
22 ## rule to use.
23 NOTCYGNUS       cd $(srcdir) \
24 NOTCYGNUS         && $(MAKEINFO) `echo $< | sed 's,.*/,,'`
25 CYGNUS  $(MAKEINFO) -I $(srcdir) $<
26
27 .texi.dvi:
28         TEXINPUTS=@TEXINFODIR@:$$TEXINPUTS \
29 ## Must set MAKEINFO like this so that version.texi will be found even
30 ## if it is in srcdir.
31           MAKEINFO='$(MAKEINFO) -I $(srcdir)' $(TEXI2DVI) $<
32
33 .texi:
34 ## We want to force the .info file to be built in srcdir.  This is
35 ## probably the simplest way.  However, at Cygnus .info files are
36 ## always put into the build directory.  So at runtime we select which
37 ## rule to use.
38 NOTCYGNUS       cd $(srcdir) \
39 NOTCYGNUS         && $(MAKEINFO) `echo $< | sed 's,.*/,,'`
40 CYGNUS  $(MAKEINFO) -I $(srcdir) $<
41
42 .texinfo.info:
43 ## We want to force the .info file to be built in srcdir.  This is
44 ## probably the simplest way.  However, at Cygnus .info files are
45 ## always put into the build directory.  So at runtime we select which
46 ## rule to use.
47 NOTCYGNUS       cd $(srcdir) \
48 NOTCYGNUS         && $(MAKEINFO) `echo $< | sed 's,.*/,,'`
49 CYGNUS  $(MAKEINFO) $<
50
51 .texinfo:
52 ## We want to force the .info file to be built in srcdir.  This is
53 ## probably the simplest way.  However, at Cygnus .info files are
54 ## always put into the build directory.  So at runtime we select which
55 ## rule to use.
56 NOTCYGNUS       cd $(srcdir) \
57 NOTCYGNUS         && $(MAKEINFO) `echo $< | sed 's,.*/,,'`
58 CYGNUS  $(MAKEINFO) $<
59
60 .texinfo.dvi:
61         TEXINPUTS=@TEXINFODIR@:$$TEXINPUTS \
62 ## Must set MAKEINFO like this so that version.texi will be found even
63 ## if it is in srcdir.
64           MAKEINFO='$(MAKEINFO) -I $(srcdir)' $(TEXI2DVI) $<
65
66 ## The way to make PostScript, for those who want it.
67 DVIPS = dvips
68 .dvi.ps:
69         $(DVIPS) $< -o $@
70
71 ## Look in both . and srcdir because the info pages might have been
72 ## rebuilt in the build directory.  Can't cd to srcdir; that might
73 ## break a possible install-sh reference.
74 ## Funny name due to --cygnus influence; we want to reserve
75 ## `install-info' for the user.
76 install-info-am: $(INFO_DEPS)
77         @$(NORMAL_INSTALL)
78         $(mkinstalldirs) $(infodir)
79         @for file in $(INFO_DEPS); do \
80 CYGNUS    if test -f $$file; then d=.; else d=$(srcdir); fi; \
81 NOTCYGNUS         d=$(srcdir); \
82 ## We use these strange circumlocutions because we want the "ifile" to
83 ## be relative, for the install.
84           for ifile in `cd $$d && echo $$file $$file-[0-9] $$file-[0-9][0-9]`; do \
85             if test -f $$d/$$ifile; then \
86               echo " $(INSTALL_DATA) $$d/$$ifile $(infodir)/$$ifile"; \
87               $(INSTALL_DATA) $$d/$$ifile $(infodir)/$$ifile; \
88             else : ; fi; \
89           done; \
90         done
91         @$(POST_INSTALL)
92 ## Only run this code if install-info actually exists.
93         @if $(SHELL) -c 'install-info --version' >/dev/null 2>&1; then \
94           for file in $(INFO_DEPS); do \
95 ## Run `:' after install-info in case install-info fails.  We really
96 ## don't care about failures here, because they can be spurious.  For
97 ## instance if you don't have a dir file, install-info will fail.  I
98 ## think instead it should create a new dir file for you.  This bug
99 ## causes the `make distcheck' target to fail reliably.
100             echo " install-info --info-dir=$(infodir) $(infodir)/$$file";\
101             install-info --info-dir=$(infodir) $(infodir)/$$file; :;\
102           done; \
103         else : ; fi
104
105 uninstall-info:
106         $(PRE_UNINSTALL)
107 ## Run two loops here so that we can handle PRE_UNINSTALL and
108 ## NORMAL_UNINSTALL correctly.
109         if $(SHELL) -c 'install-info --version' >/dev/null 2>&1; then \
110           ii=yes; \
111         else ii=; fi; \
112         for file in $(INFO_DEPS); do \
113           test -z $ii || install-info --info-dir=$(infodir) --remove $$file; \
114         done
115         $(NORMAL_UNINSTALL)
116         for file in $(INFO_DEPS); do \
117           (cd $(infodir) && rm -f $$file $$file-[0-9] $$file-[0-9][0-9]); \
118         done
119
120 dist-info: $(INFO_DEPS)
121         for base in $(INFO_DEPS); do \
122 ## In Cygnus mode, allow info file to be in source or build dir.  In
123 ## other modes, allow only source dir.
124 NOTCYGNUS         d=$(srcdir); \
125 CYGNUS    if test -f $$base; then d=.; else d=$(srcdir); fi; \
126           for file in `cd $$d && eval echo $$base*`; do \
127             test -f $(distdir)/$$file \
128             || ln $$d/$$file $(distdir)/$$file 2> /dev/null \
129             || cp -p $$d/$$file $(distdir)/$$file; \
130           done; \
131         done