Update.
[glibc.git] / manual / Makefile
blobd4c33e68a9ef851d9a82c4e03951415a20ede90f
1 # Copyright (C) 1992, 93, 94, 95, 96, 97, 98 Free Software Foundation, Inc.
2 # This file is part of the GNU C Library.
4 # The GNU C Library is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU Library General Public License
6 # as published by the Free Software Foundation; either version 2 of
7 # the License, or (at your option) any later version.
9 # The GNU C Library 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 GNU
12 # Library General Public License for more details.
14 # You should have received a copy of the GNU Library General Public
15 # License along with the GNU C Library; see the file COPYING.LIB. If not,
16 # write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 # Boston, MA 02111-1307, USA.
19 # Makefile for the GNU C Library manual.
21 subdir := manual
22 export subdir := $(subdir)
24 # Allow override
25 INSTALL_INFO = install-info
27 .PHONY: all dvi info
28 all: dvi
29 dvi: libc.dvi
31 ifneq ($(strip $(MAKEINFO)),)
32 all: info
33 info: libc.info dir-add.info
34 endif
36 # Get glibc's configuration info.
37 ifneq (,$(wildcard ../Makeconfig))
38 include ../Makeconfig
39 endif
41 # Set chapters and chapters-incl[12].
42 -include chapters
43 chapters: libc.texinfo
44 $(find-includes)
45 ifdef chapters
46 # @includes in chapter files
47 -include chapters-incl1
48 chapters-incl1: $(chapters)
49 $(find-includes)
50 chapters-incl1 := $(filter-out summary.texi,$(chapters-incl1))
51 endif
52 ifdef chapters-incl1
53 # @includes in files included by chapter files, if any
54 -include chapters-incl2
55 chapters-incl2: $(chapters-incl1)
56 $(find-includes)
57 endif
59 chapters-incl := $(chapters-incl1) $(chapters-incl2)
61 define find-includes
62 (echo '$(@F) :=' \\ ;\
63 $(AWK) '$$1 == "@include" { print $$2 " \\" }' $^) > $@.new
64 mv -f $@.new $@
65 endef
67 libc.dvi libc.info: $(chapters) summary.texi $(chapters-incl)
68 libc.dvi: texinfo.tex
70 %.info: %.texinfo
71 $(MAKEINFO) $<
73 %.dvi: %.texinfo
74 $(TEXI2DVI) $<
76 # Generate the summary from the Texinfo source files for each chapter.
77 summary.texi: stamp-summary ;
78 stamp-summary: summary.awk $(chapters) $(chapters-incl)
79 $(AWK) -f $^ \
80 | sort -df +1 -2 | tr '\014' '\012' > summary-tmp
81 ./move-if-change summary-tmp summary.texi
82 # touch is broken on our machines. Sigh.
83 date > $@
85 # Generate a file which can be added to the `dir' content to provide direct
86 # access to the documentation of the function, variables, and other
87 # definitions.
88 dir-add.texinfo: xtract-typefun.awk $(chapters) $(chapters-incl)
89 $(SHELL) -c '(echo "@dircategory GNU C library functions"; \
90 echo "@direntry"; \
91 $(AWK) -f $^; \
92 echo "@end direntry";)' > $@.new
93 mv -f $@.new $@
95 # Generate Texinfo files from the C source for the example programs.
96 %.c.texi: examples/%.c
97 sed -e 's,[{}],@&,g' \
98 -e 's,/\*\(@.*\)\*/,\1,g' \
99 -e 's,/\* *,/* @r{,g' -e 's, *\*/,} */,' \
100 -e 's/\(@[a-z][a-z]*\)@{\([^}]*\)@}/\1{\2}/g'\
101 $< | expand > $@.new
102 mv -f $@.new $@
105 minimal-dist = summary.awk move-if-change libc.texinfo $(chapters) \
106 $(patsubst %.c.texi,examples/%.c, \
107 $(filter-out summary.texi,$(chapters-incl)))
108 doc-only-dist = Makefile COPYING.LIB mkinstalldirs
109 distribute = $(minimal-dist) \
110 $(patsubst examples/%.c,%.c.texi,$(filter examples/%.c, \
111 $(minimal-dist))) \
112 libc.info* libc.?? libc.??s texinfo.tex summary.texi \
113 stamp-summary chapters chapters-incl1 chapters-incl2 \
114 xtract-typefun.awk dir-add.texinfo dir-add.info dir \
115 stdio-fp.c
116 export distribute := $(distribute)
118 tar-it = tar chovf $@ $^
120 manual.tar: $(doc-only-dist) $(minimal-dist) ; $(tar-it)
121 mandist.tar: $(doc-only-dist) $(distribute) ; $(tar-it)
123 edition := $(shell sed -n 's/^@set EDITION \([0-9][0-9.]*\)[^0-9.]*.*$$/\1/p' \
124 libc.texinfo)
126 glibc-doc-$(edition).tar: $(doc-only-dist) $(distribute)
127 @rm -f glibc-doc-$(edition)
128 ln -s . glibc-doc-$(edition)
129 tar chovf $@ $(addprefix glibc-doc-$(edition)/,$^)
130 rm -f glibc-doc-$(edition)
132 %.Z: %
133 compress -c $< > $@.new
134 mv -f $@.new $@
135 %.gz: %
136 gzip -9 -c $< > $@.new
137 mv -f $@.new $@
138 %.uu: %
139 uuencode $< < $< > $@.new
140 mv -f $@.new $@
142 .PHONY: mostlyclean distclean realclean clean
143 mostlyclean:
144 -rm -f libc.dvi libc.info* dir-add.info $(common-objpfx)stub-manual
145 -rm -f $(foreach o,$(object-suffixes-for-libc),$(objpfx)stamp$o)
146 clean: mostlyclean
147 distclean: clean
148 indices = cp fn pg tp vr ky
149 realclean: distclean
150 -rm -f chapters chapters-incl* summary.texi stamp-summary *.c.texi
151 -rm -f $(foreach index,$(indices),libc.$(index) libc.$(index)s)
152 -rm -f libc.log libc.aux libc.toc dir-add.texi
154 .PHONY: install subdir_install installdirs install-data
155 install-data subdir_install: install
156 ifneq ($(strip $(MAKEINFO)),)
157 install: $(inst_infodir)/libc.info dir-add.info
158 @if $(SHELL) -c '$(INSTALL_INFO) --version' >/dev/null 2>&1; then \
159 test -f $(inst_infodir)/dir || cp dir $(inst_infodir);\
160 $(INSTALL_INFO) --info-dir=$(inst_infodir) $(inst_infodir)/libc.info;\
161 $(INSTALL_INFO) --info-dir=$(inst_infodir) dir-add.info;\
162 else : ; fi
163 endif
164 # Catchall implicit rule for other installation targets from the parent.
165 install-%: ;
167 $(inst_infodir)/libc.info: libc.info installdirs
168 for file in $<*; do \
169 name=`basename $$file`; \
170 $(INSTALL_DATA) $$file \
171 `echo $@ | sed "s,$<\$$,$$name,"`; \
172 done
174 installdirs: $(firstword $(wildcard mkinstalldirs ../mkinstalldirs))
175 $(dir $<)$(notdir $<) $(inst_infodir)
177 .PHONY: dist
178 dist: # glibc-doc-$(edition).tar.gz
180 ifneq (,$(wildcard ../Make-dist))
181 dist: ../Make-dist
182 $(MAKE) -f $< $(Make-dist-args)
183 endif
185 ifndef ETAGS
186 ETAGS = etags -T
187 endif
188 TAGS: $(minimal-dist)
189 $(ETAGS) -o $@ $^
191 # The parent makefile sometimes invokes us with targets `subdir_REAL-TARGET'.
192 subdir_%: % ;
193 # For targets we don't define, do nothing.
194 subdir_%: ;
196 # These are targets that each glibc subdirectory is expected to understand.
197 # ../Rules defines them for code subdirectories; for us, they are no-ops.
198 # None of these should be `subdir_TARGET'; those targets are transformed
199 # by the implicit rule above into `TARGET' deps.
200 glibc-targets := lib objects objs others tests lint.out \
201 echo-headers echo-distinfo stubs
202 .PHONY: $(glibc-targets)
203 $(glibc-targets):
205 # Create stamp files if they don't exist, so the parent makefile's rules for
206 # updating the library archives are happy with us, and never think we have
207 # changed the library.
208 lib: $(foreach o,$(object-suffixes-for-libc),$(objpfx)stamp$o)
209 stubs: $(common-objpfx)stub-manual
210 $(common-objpfx)stub-manual ../po/manual.pot $(objpfx)stamp%:
211 $(make-target-directory)
212 cp /dev/null $@
215 # Make the target directory if it doesn't exist, using the `mkinstalldirs'
216 # script that does `mkdir -p' even if `mkdir' doesn't support that flag.
217 define make-target-directory
218 $(addprefix $(..)./mkinstalldirs ,\
219 $(filter-out $(wildcard $(@D:%/=%)),$(@D:%/=%)))
220 endef
222 # The top-level glibc Makefile expects subdir_install to update the stubs file.
223 subdir_install: stubs
225 # Get rid of these variables if they came from the parent.
226 routines =
227 aux =
228 sources =
229 objects =
230 headers =