Update.
[glibc.git] / manual / Makefile
blob8af1d6c1a2037281a99b74970dac1f6392f53291
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 # Get glibc's configuration info.
32 ifneq (,$(wildcard ../Makeconfig))
33 include ../Makeconfig
34 else
35 MAKEINFO = makeinfo
36 TEXI2DVI = texi2dvi
37 endif
39 ifneq ($(strip $(MAKEINFO)),)
40 all: info
41 info: libc.info dir-add.info
42 endif
44 # scripts we use
45 ifndef move-if-change
46 move-if-change = ./move-if-change
47 endif
48 mkinstalldirs = $(..)scripts/mkinstalldirs
50 chapters = $(addsuffix .texi, \
51 intro errno memory ctype string mbyte locale message search \
52 pattern io stdio llio filesys pipe socket terminal math \
53 arith time setjmp signal startup process job nss users \
54 sysinfo conf)
55 add-chapters = $(wildcard $(patsubst %, ../%.texi, \
56 $(join $(add-ons:=/),$(add-ons))))
57 appendices = lang.texi header.texi install.texi maint.texi contrib.texi
59 -include texis
60 texis: $(chapters) $(add-chapters) $(appendices) lgpl.texinfo
61 $(AWK) -f texis.awk $^ > $@.T
62 mv -f $@.T $@
64 nonexamples = $(filter-out %.c.texi, $(texis))
65 examples = $(filter %.c.texi, $(texis))
67 # Kludge: implicit rule so Make knows the one command does it all.
68 chapters.% top-menu.%: $(texis)
69 AWK=$(AWK) $(SHELL) libc-texinfo.sh \
70 '$(chapters)' '$(add-chapters)' '$(appendices)'
72 libc.dvi libc.info: chapters.texi top-menu.texi
73 libc.dvi: texinfo.tex
75 # Generate the summary from the Texinfo source files for each chapter.
76 summary.texi: stamp-summary ;
77 stamp-summary: summary.awk $(chapters) $(chapters-incl)
78 $(AWK) -f $^ \
79 | sort -df +1 -2 | tr '\014' '\012' > summary-tmp
80 $(move-if-change) summary-tmp summary.texi
81 touch $@
83 # Generate a file which can be added to the `dir' content to provide direct
84 # access to the documentation of the function, variables, and other
85 # definitions.
86 dir-add.texinfo: xtract-typefun.awk $(texis)
87 (echo "@dircategory GNU C library functions"; \
88 echo "@direntry"; \
89 $(AWK) -f $^; \
90 echo "@end direntry") > $@.new
91 mv -f $@.new $@
93 # Generate Texinfo files from the C source for the example programs.
94 %.c.texi: examples/%.c
95 sed -e 's,[{}],@&,g' \
96 -e 's,/\*\(@.*\)\*/,\1,g' \
97 -e 's,/\* *,/* @r{,g' -e 's, *\*/,} */,' \
98 -e 's/\(@[a-z][a-z]*\)@{\([^}]*\)@}/\1{\2}/g'\
99 $< | expand > $@.new
100 mv -f $@.new $@
102 %.info: %.texinfo
103 $(MAKEINFO) $<
105 %.dvi: %.texinfo
106 $(TEXI2DVI) $<
108 # Distribution.
109 minimal-dist = summary.awk texis.awk libc-texinfo.sh libc.texinfo \
110 $(filter-out summary.texi, $(nonexamples)) \
111 $(patsubst %.c.texi,examples/%.c, $(examples))
113 doc-only-dist = Makefile COPYING.LIB
114 distribute = $(minimal-dist) $(examples) texis stdio-fp.c \
115 libc.info* libc.?? libc.??s texinfo.tex stamp-summary \
116 xtract-typefun.awk dir-add.texinfo dir-add.info dir \
117 chapters.texi top-menu.texi
118 export distribute := $(distribute)
120 tar-it = tar chovf $@ $^
122 manual.tar: $(doc-only-dist) $(minimal-dist) ; $(tar-it)
123 mandist.tar: $(doc-only-dist) $(distribute) ; $(tar-it)
125 edition := $(shell sed -n 's/^@set EDITION \([0-9][0-9.]*\)[^0-9.]*.*$$/\1/p' \
126 libc.texinfo)
128 glibc-doc-$(edition).tar: $(doc-only-dist) $(distribute)
129 @rm -f glibc-doc-$(edition)
130 ln -s . glibc-doc-$(edition)
131 tar chovf $@ $(addprefix glibc-doc-$(edition)/,$^)
132 rm -f glibc-doc-$(edition)
134 %.Z: %
135 compress -c $< > $@.new
136 mv -f $@.new $@
137 %.gz: %
138 gzip -9 -c $< > $@.new
139 mv -f $@.new $@
140 %.uu: %
141 uuencode $< < $< > $@.new
142 mv -f $@.new $@
144 .PHONY: mostlyclean distclean realclean clean
145 mostlyclean:
146 -rm -f libc.dvi libc.tmp libc.info* dir-add.info
147 -rm -f $(objpfx)stubs $(objpfx)distinfo
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 texis 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.texinfo
156 -rm -f top-menu.texi chapters.texi
158 .PHONY: install subdir_install installdirs install-data
159 install-data subdir_install: install
160 ifneq ($(strip $(MAKEINFO)),)
161 install: $(inst_infodir)/libc.info dir-add.info
162 @if $(SHELL) -c '$(INSTALL_INFO) --version' >/dev/null 2>&1; then \
163 test -f $(inst_infodir)/dir || cp dir $(inst_infodir);\
164 $(INSTALL_INFO) --info-dir=$(inst_infodir) $(inst_infodir)/libc.info;\
165 $(INSTALL_INFO) --info-dir=$(inst_infodir) dir-add.info;\
166 else : ; fi
167 endif
168 # Catchall implicit rule for other installation targets from the parent.
169 install-%: ;
171 $(inst_infodir)/libc.info: libc.info installdirs
172 for file in $<*; do \
173 name=`basename $$file`; \
174 $(INSTALL_DATA) $$file \
175 `echo $@ | sed "s,$<\$$,$$name,"`; \
176 done
178 installdirs:
179 $(mkinstalldirs) $(inst_infodir)
181 .PHONY: dist
182 dist: # glibc-doc-$(edition).tar.gz
184 ifneq (,$(wildcard ../Make-dist))
185 dist: ../Make-dist
186 $(MAKE) -f $< $(Make-dist-args)
187 endif
189 ifndef ETAGS
190 ETAGS = etags -T
191 endif
192 TAGS: $(minimal-dist)
193 $(ETAGS) -o $@ $^
195 # The parent makefile sometimes invokes us with targets `subdir_REAL-TARGET'.
196 subdir_%: % ;
197 # For targets we don't define, do nothing.
198 subdir_%: ;
200 # These are targets that each glibc subdirectory is expected to understand.
201 # ../Rules defines them for code subdirectories; for us, they are no-ops.
202 # None of these should be `subdir_TARGET'; those targets are transformed
203 # by the implicit rule above into `TARGET' deps.
204 glibc-targets := lib objects objs others tests lint.out \
205 echo-headers echo-distinfo
206 .PHONY: $(glibc-targets)
207 $(glibc-targets):
209 # Create stamp files if they don't exist, so the parent makefile's rules for
210 # updating the library archives are happy with us, and never think we have
211 # changed the library.
212 lib: $(foreach o,$(object-suffixes-for-libc),$(objpfx)stamp$o)
213 ifdef objpfx
214 .PHONY: stubs
215 stubs: $(objpfx)stubs
216 endif
217 $(objpfx)stubs ../po/manual.pot $(objpfx)stamp%:
218 $(make-target-directory)
219 touch $@
221 # Make the target directory if it doesn't exist, using the `mkinstalldirs'
222 # script that does `mkdir -p' even if `mkdir' doesn't support that flag.
223 define make-target-directory
224 $(addprefix $(mkinstalldirs) ,\
225 $(filter-out $(wildcard $(@D:%/=%)),$(@D:%/=%)))
226 endef
228 # The top-level glibc Makefile expects subdir_install to update the stubs file.
229 subdir_install: stubs
231 # Get rid of these variables if they came from the parent.
232 routines =
233 aux =
234 sources =
235 objects =
236 headers =