Update.
[glibc.git] / manual / Makefile
blob3c6640e8a771b40d51735ac9000bb27f7104da22
1 # Copyright (C) 1992, 93, 94, 95, 96, 97, 98, 99 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 AWK = gawk
38 endif
40 ifneq ($(strip $(MAKEINFO)),)
41 all: info
42 info: libc.info dir-add.info
43 endif
45 # scripts we use
46 ifndef move-if-change
47 move-if-change = ./move-if-change
48 endif
49 mkinstalldirs = $(..)scripts/mkinstalldirs
51 chapters = $(addsuffix .texi, \
52 intro errno memory ctype string charset locale \
53 message search pattern io stdio llio filesys \
54 pipe socket terminal math arith time setjmp \
55 signal startup process job nss users sysinfo conf)
56 add-chapters = $(wildcard $(foreach d, $(add-ons), ../$d/$d.texi))
57 appendices = lang.texi header.texi install.texi maint.texi contrib.texi
59 -include texis
60 texis: texis.awk $(chapters) $(add-chapters) $(appendices) lgpl.texinfo
61 $(AWK) -f $^ > $@.T
62 mv -f $@.T $@
64 nonexamples = $(filter-out $(add-chapters) %.c.texi, $(texis))
65 examples = $(filter-out $(foreach d, $(add-ons), ../$d/%.c.texi), \
66 $(filter %.c.texi, $(texis)))
68 # Kludge: implicit rule so Make knows the one command does it all.
69 chapters.% top-menu.%: libc-texinfo.sh $(texis)
70 AWK=$(AWK) $(SHELL) $< '$(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 $(filter-out summary.texi, $(texis))
78 $(AWK) -f $^ | sort -t'\f' -df +0 -1 | tr '\014' '\012' > summary-tmp
79 $(move-if-change) summary-tmp summary.texi
80 touch $@
82 # Generate a file which can be added to the `dir' content to provide direct
83 # access to the documentation of the function, variables, and other
84 # definitions.
85 dir-add.info: xtract-typefun.awk $(texis)
86 (echo "INFO-DIR-SECTION GNU C library functions"; \
87 echo "START-INFO-DIR-ENTRY"; \
88 $(AWK) -f $^ | sort; \
89 echo "END-INFO-DIR-ENTRY") > $@.new
90 mv -f $@.new $@
92 # Generate Texinfo files from the C source for the example programs.
93 %.c.texi: examples/%.c
94 sed -e 's,[{}],@&,g' \
95 -e 's,/\*\(@.*\)\*/,\1,g' \
96 -e 's,/\* *,/* @r{,g' -e 's, *\*/,} */,' \
97 -e 's/\(@[a-z][a-z]*\)@{\([^}]*\)@}/\1{\2}/g'\
98 $< | expand > $@.new
99 mv -f $@.new $@
101 %.info: %.texinfo
102 LANGUAGE=C LC_ALL=C $(MAKEINFO) $<
104 %.dvi: %.texinfo
105 $(TEXI2DVI) $<
107 # Distribution.
108 minimal-dist = summary.awk texis.awk tsort.awk libc-texinfo.sh libc.texinfo \
109 $(filter-out summary.texi, $(nonexamples)) \
110 $(patsubst %.c.texi,examples/%.c, $(examples))
112 doc-only-dist = Makefile COPYING.LIB
113 distribute = $(minimal-dist) $(examples) stdio-fp.c \
114 libc.info* libc.?? libc.??s texinfo.tex \
115 xtract-typefun.awk dir-add.info dir
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.tmp libc.info* dir-add.info
145 -rm -f $(objpfx)stubs $(objpfx)distinfo
146 -rm -f $(foreach o,$(object-suffixes-for-libc),$(objpfx)stamp$o)
147 clean: mostlyclean
148 distclean: clean
149 indices = cp fn pg tp vr ky
150 realclean: distclean
151 -rm -f texis summary.texi stamp-summary *.c.texi
152 -rm -f $(foreach index,$(indices),libc.$(index) libc.$(index)s)
153 -rm -f libc.log libc.aux libc.toc dir-add.texinfo
154 -rm -f top-menu.texi chapters.texi
156 .PHONY: install subdir_install installdirs install-data
157 install-data subdir_install: install
158 ifneq ($(strip $(MAKEINFO)),)
159 # There are two variants of install-info out there. The GNU version
160 # knows about the INFO-DIR-SECTION tag, the Debian version doesn't.
161 ifneq ($(OLD_DEBIAN_INSTALL_INFO),yes)
162 install: $(inst_infodir)/libc.info dir-add.info
163 @if $(SHELL) -c '$(INSTALL_INFO) --version' >/dev/null 2>&1; then \
164 test -f $(inst_infodir)/dir || cp dir $(inst_infodir);\
165 $(INSTALL_INFO) --info-dir=$(inst_infodir) $(inst_infodir)/libc.info;\
166 $(INSTALL_INFO) --info-dir=$(inst_infodir) dir-add.info;\
167 else : ; fi
168 else
169 install: $(inst_infodir)/libc.info dir-add.info
170 @if $(SHELL) -c '$(INSTALL_INFO) --version' >/dev/null 2>&1; then \
171 test -f $(inst_infodir)/dir || cp dir $(inst_infodir);\
172 $(INSTALL_INFO) --info-dir=$(inst_infodir) \
173 --section '^GNU Libraries:' 'GNU Libraries:' \
174 $(inst_infodir)/libc.info;\
175 $(INSTALL_INFO) --info-dir=$(inst_infodir) \
176 --section '^GNU C Library functions:' 'GNU C Library functions:' \
177 dir-add.info;\
178 else : ; fi
179 endif
180 endif
181 # Catchall implicit rule for other installation targets from the parent.
182 install-%: ;
184 $(inst_infodir)/libc.info: libc.info installdirs
185 for file in $<*; do \
186 $(INSTALL_DATA) $$file $(@D)/$$file; \
187 done
189 installdirs:
190 $(mkinstalldirs) $(inst_infodir)
192 .PHONY: dist
193 dist: # glibc-doc-$(edition).tar.gz
195 ifneq (,$(wildcard ../Make-dist))
196 dist: ../Make-dist
197 $(MAKE) -f $< $(Make-dist-args)
198 endif
200 ifndef ETAGS
201 ETAGS = etags -T
202 endif
203 TAGS: $(minimal-dist)
204 $(ETAGS) -o $@ $^
206 # The parent makefile sometimes invokes us with targets `subdir_REAL-TARGET'.
207 subdir_%: % ;
208 # For targets we don't define, do nothing.
209 subdir_%: ;
211 # These are targets that each glibc subdirectory is expected to understand.
212 # ../Rules defines them for code subdirectories; for us, they are no-ops.
213 # None of these should be `subdir_TARGET'; those targets are transformed
214 # by the implicit rule above into `TARGET' deps.
215 glibc-targets := lib objects objs others tests lint.out \
216 echo-headers echo-distinfo
217 .PHONY: $(glibc-targets)
218 $(glibc-targets):
220 # Create stamp files if they don't exist, so the parent makefile's rules for
221 # updating the library archives are happy with us, and never think we have
222 # changed the library.
223 lib: $(foreach o,$(object-suffixes-for-libc),$(objpfx)stamp$o)
224 ifdef objpfx
225 .PHONY: stubs
226 stubs: $(objpfx)stubs
227 endif
228 $(objpfx)stubs ../po/manual.pot $(objpfx)stamp%:
229 $(make-target-directory)
230 touch $@
232 # Make the target directory if it doesn't exist, using the `mkinstalldirs'
233 # script that does `mkdir -p' even if `mkdir' doesn't support that flag.
234 define make-target-directory
235 $(addprefix $(mkinstalldirs) ,\
236 $(filter-out $(wildcard $(@D:%/=%)),$(@D:%/=%)))
237 endef
239 # The top-level glibc Makefile expects subdir_install to update the stubs file.
240 subdir_install: stubs
242 # Get rid of these variables if they came from the parent.
243 routines =
244 aux =
245 sources =
246 objects =
247 headers =