Update.
[glibc.git] / manual / Makefile
blobbc36978ebbd6ca73f566bc452f7c652b7aab0df0
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 # scripts we use
68 move-if-change = $(..)scripts/move-if-change
69 mkinstalldirs = $(..)scripts/mkinstalldirs
71 libc.dvi libc.info: $(chapters) summary.texi $(chapters-incl)
72 libc.dvi: texinfo.tex
74 %.info: %.texinfo
75 $(MAKEINFO) $<
77 %.dvi: %.texinfo
78 $(TEXI2DVI) $<
80 # Generate the summary from the Texinfo source files for each chapter.
81 summary.texi: stamp-summary ;
82 stamp-summary: summary.awk $(chapters) $(chapters-incl)
83 $(AWK) -f $^ \
84 | sort -df +1 -2 | tr '\014' '\012' > summary-tmp
85 $(move-if-change) summary-tmp summary.texi
86 touch $@
88 # Generate a file which can be added to the `dir' content to provide direct
89 # access to the documentation of the function, variables, and other
90 # definitions.
91 dir-add.texinfo: xtract-typefun.awk $(chapters) $(chapters-incl)
92 $(SHELL) -c '(echo "@dircategory GNU C library functions"; \
93 echo "@direntry"; \
94 $(AWK) -f $^; \
95 echo "@end direntry";)' > $@.new
96 mv -f $@.new $@
98 # Generate Texinfo files from the C source for the example programs.
99 %.c.texi: examples/%.c
100 sed -e 's,[{}],@&,g' \
101 -e 's,/\*\(@.*\)\*/,\1,g' \
102 -e 's,/\* *,/* @r{,g' -e 's, *\*/,} */,' \
103 -e 's/\(@[a-z][a-z]*\)@{\([^}]*\)@}/\1{\2}/g'\
104 $< | expand > $@.new
105 mv -f $@.new $@
108 minimal-dist = summary.awk libc.texinfo $(chapters) \
109 $(patsubst %.c.texi,examples/%.c, \
110 $(filter-out summary.texi,$(chapters-incl)))
111 doc-only-dist = Makefile COPYING.LIB
112 distribute = $(minimal-dist) \
113 $(patsubst examples/%.c,%.c.texi,$(filter examples/%.c, \
114 $(minimal-dist))) \
115 libc.info* libc.?? libc.??s texinfo.tex summary.texi \
116 stamp-summary chapters chapters-incl1 chapters-incl2 \
117 xtract-typefun.awk dir-add.texinfo dir-add.info dir \
118 stdio-fp.c
119 export distribute := $(distribute)
121 tar-it = tar chovf $@ $^
123 manual.tar: $(doc-only-dist) $(minimal-dist) ; $(tar-it)
124 mandist.tar: $(doc-only-dist) $(distribute) ; $(tar-it)
126 edition := $(shell sed -n 's/^@set EDITION \([0-9][0-9.]*\)[^0-9.]*.*$$/\1/p' \
127 libc.texinfo)
129 glibc-doc-$(edition).tar: $(doc-only-dist) $(distribute)
130 @rm -f glibc-doc-$(edition)
131 ln -s . glibc-doc-$(edition)
132 tar chovf $@ $(addprefix glibc-doc-$(edition)/,$^)
133 rm -f glibc-doc-$(edition)
135 %.Z: %
136 compress -c $< > $@.new
137 mv -f $@.new $@
138 %.gz: %
139 gzip -9 -c $< > $@.new
140 mv -f $@.new $@
141 %.uu: %
142 uuencode $< < $< > $@.new
143 mv -f $@.new $@
145 .PHONY: mostlyclean distclean realclean clean
146 mostlyclean:
147 -rm -f libc.dvi libc.info* dir-add.info stubs
148 -rm -f $(foreach o,$(object-suffixes-for-libc),$(objpfx)stamp$o)
149 clean: mostlyclean
150 distclean: clean
151 indices = cp fn pg tp vr ky
152 realclean: distclean
153 -rm -f chapters chapters-incl* summary.texi stamp-summary *.c.texi
154 -rm -f $(foreach index,$(indices),libc.$(index) libc.$(index)s)
155 -rm -f libc.log libc.aux libc.toc dir-add.texi
157 .PHONY: install subdir_install installdirs install-data
158 install-data subdir_install: install
159 ifneq ($(strip $(MAKEINFO)),)
160 install: $(inst_infodir)/libc.info dir-add.info
161 @if $(SHELL) -c '$(INSTALL_INFO) --version' >/dev/null 2>&1; then \
162 test -f $(inst_infodir)/dir || cp dir $(inst_infodir);\
163 $(INSTALL_INFO) --info-dir=$(inst_infodir) $(inst_infodir)/libc.info;\
164 $(INSTALL_INFO) --info-dir=$(inst_infodir) dir-add.info;\
165 else : ; fi
166 endif
167 # Catchall implicit rule for other installation targets from the parent.
168 install-%: ;
170 $(inst_infodir)/libc.info: libc.info installdirs
171 for file in $<*; do \
172 name=`basename $$file`; \
173 $(INSTALL_DATA) $$file \
174 `echo $@ | sed "s,$<\$$,$$name,"`; \
175 done
177 installdirs:
178 $(mkinstalldirs) $(inst_infodir)
180 .PHONY: dist
181 dist: # glibc-doc-$(edition).tar.gz
183 ifneq (,$(wildcard ../Make-dist))
184 dist: ../Make-dist
185 $(MAKE) -f $< $(Make-dist-args)
186 endif
188 ifndef ETAGS
189 ETAGS = etags -T
190 endif
191 TAGS: $(minimal-dist)
192 $(ETAGS) -o $@ $^
194 # The parent makefile sometimes invokes us with targets `subdir_REAL-TARGET'.
195 subdir_%: % ;
196 # For targets we don't define, do nothing.
197 subdir_%: ;
199 # These are targets that each glibc subdirectory is expected to understand.
200 # ../Rules defines them for code subdirectories; for us, they are no-ops.
201 # None of these should be `subdir_TARGET'; those targets are transformed
202 # by the implicit rule above into `TARGET' deps.
203 glibc-targets := lib objects objs others tests lint.out \
204 echo-headers echo-distinfo
205 .PHONY: $(glibc-targets)
206 $(glibc-targets):
208 # Create stamp files if they don't exist, so the parent makefile's rules for
209 # updating the library archives are happy with us, and never think we have
210 # changed the library.
211 lib: $(foreach o,$(object-suffixes-for-libc),$(objpfx)stamp$o)
212 ifdef objpfx
213 .PHONY: stubs
214 stubs: $(objpfx)stubs
215 endif
216 $(objpfx)stubs ../po/manual.pot $(objpfx)stamp%:
217 $(make-target-directory)
218 touch $@
220 # Make the target directory if it doesn't exist, using the `mkinstalldirs'
221 # script that does `mkdir -p' even if `mkdir' doesn't support that flag.
222 define make-target-directory
223 $(addprefix $(mkinstalldirs) ,\
224 $(filter-out $(wildcard $(@D:%/=%)),$(@D:%/=%)))
225 endef
227 # The top-level glibc Makefile expects subdir_install to update the stubs file.
228 subdir_install: stubs
230 # Get rid of these variables if they came from the parent.
231 routines =
232 aux =
233 sources =
234 objects =
235 headers =