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.
22 export subdir := $(subdir)
25 INSTALL_INFO = install-info
27 .PHONY: all dvi pdf info
32 # Get glibc's configuration info.
33 ifneq (,$(wildcard ../Makeconfig))
43 ifneq ($(strip $(MAKEINFO)),)
45 info: libc.info dir-add.info
50 move-if-change = ./move-if-change
52 mkinstalldirs = $(..)scripts/mkinstalldirs
54 chapters = $(addsuffix .texi, \
55 intro errno memory ctype string charset locale \
56 message search pattern io stdio llio filesys \
57 pipe socket terminal math arith time setjmp \
58 signal startup process job nss users sysinfo conf\
60 add-chapters = $(wildcard $(foreach d, $(add-ons), ../$d/$d.texi))
61 appendices = lang.texi header.texi install.texi maint.texi contrib.texi
64 texis: texis.awk $(chapters) $(add-chapters) $(appendices) lgpl.texinfo
68 nonexamples = $(filter-out $(add-chapters) %.c.texi, $(texis))
69 examples = $(filter-out $(foreach d, $(add-ons), ../$d/%.c.texi), \
70 $(filter %.c.texi, $(texis)))
72 # Kludge: implicit rule so Make knows the one command does it all.
73 chapters.% top-menu.%: libc-texinfo.sh $(texis) Makefile
74 AWK=$(AWK) $(SHELL) $< '$(chapters)' '$(add-chapters)' '$(appendices)'
76 libc.dvi libc.pdf libc.info: chapters.texi top-menu.texi libm-err.texi
77 libc.dvi libc.pdf: texinfo.tex
79 # Generate the summary from the Texinfo source files for each chapter.
80 summary.texi: stamp-summary ;
81 stamp-summary: summary.awk $(filter-out summary.texi, $(texis))
82 $(AWK) -f $^ | sort -t'
\f' -df +0 -1 | tr '\014' '\012' > summary-tmp
83 $(move-if-change) summary-tmp summary.texi
86 # Generate a file which can be added to the `dir' content to provide direct
87 # access to the documentation of the function, variables, and other
89 dir-add.info: xtract-typefun.awk $(texis)
90 (echo "INFO-DIR-SECTION GNU C library functions"; \
91 echo "START-INFO-DIR-ENTRY"; \
92 $(AWK) -f $^ | sort; \
93 echo "END-INFO-DIR-ENTRY") > $@.new
96 # The table with the math errors is generated.
97 libm-err.texi: stamp-libm-err
98 stamp-libm-err: libm-err-tab.pl $(wildcard $(foreach dir,$(sysdirs),\
99 $(dir)/libm-test-ulps))
101 $(PERL) $< $$pwd/.. > libm-err-tmp
102 $(move-if-change) libm-err-tmp libm-err.texi
105 # Generate Texinfo files from the C source for the example programs.
106 %.c.texi: examples/%.c
107 sed -e 's,[{}],@&,g' \
108 -e 's,/\*\(@.*\)\*/,\1,g' \
109 -e 's,/\* *,/* @r{,g' -e 's, *\*/,} */,' \
110 -e 's/\(@[a-z][a-z]*\)@{\([^}]*\)@}/\1{\2}/g'\
115 LANGUAGE=C LC_ALL=C $(MAKEINFO) $<
124 minimal-dist = summary.awk texis.awk tsort.awk libc-texinfo.sh libc.texinfo \
125 libm-err.texi stamp-libm-err \
126 $(filter-out summary.texi, $(nonexamples)) \
127 $(patsubst %.c.texi,examples/%.c, $(examples))
129 doc-only-dist = Makefile COPYING.LIB
130 distribute = $(minimal-dist) $(examples) stdio-fp.c \
131 libc.info* libc.?? libc.??s texinfo.tex \
132 xtract-typefun.awk dir-add.info dir libm-err-tab.pl
133 export distribute := $(distribute)
135 tar-it = tar chovf $@ $^
137 manual.tar: $(doc-only-dist) $(minimal-dist) ; $(tar-it)
138 mandist.tar: $(doc-only-dist) $(distribute) ; $(tar-it)
140 edition := $(shell sed -n 's/^@set EDITION \([0-9][0-9.]*\)[^0-9.]*.*$$/\1/p' \
143 glibc-doc-$(edition).tar: $(doc-only-dist) $(distribute)
144 @rm -f glibc-doc-$(edition)
145 ln -s . glibc-doc-$(edition)
146 tar chovf $@ $(addprefix glibc-doc-$(edition)/,$^)
147 rm -f glibc-doc-$(edition)
150 compress -c $< > $@.new
153 gzip -9 -c $< > $@.new
156 uuencode $< < $< > $@.new
159 .PHONY: mostlyclean distclean realclean clean
161 -rm -f libc.dvi libc.pdf libc.tmp libc.info* dir-add.info
162 -rm -f $(objpfx)stubs $(objpfx)distinfo
163 -rm -f $(foreach o,$(object-suffixes-for-libc),$(objpfx)stamp$o)
166 indices = cp fn pg tp vr ky
168 -rm -f texis summary.texi stamp-summary *.c.texi
169 -rm -f $(foreach index,$(indices),libc.$(index) libc.$(index)s)
170 -rm -f libc.log libc.aux libc.toc dir-add.texinfo
171 -rm -f top-menu.texi chapters.texi
173 .PHONY: install subdir_install installdirs install-data
174 install-data subdir_install: install
175 ifneq ($(strip $(MAKEINFO)),)
176 # There are two variants of install-info out there. The GNU version
177 # knows about the INFO-DIR-SECTION tag, the Debian version doesn't.
178 ifneq ($(OLD_DEBIAN_INSTALL_INFO),yes)
179 install: $(inst_infodir)/libc.info dir-add.info
180 @if $(SHELL) -c '$(INSTALL_INFO) --version' >/dev/null 2>&1; then \
181 test -f $(inst_infodir)/dir || cp dir $(inst_infodir);\
182 $(INSTALL_INFO) --info-dir=$(inst_infodir) $(inst_infodir)/libc.info;\
183 $(INSTALL_INFO) --info-dir=$(inst_infodir) dir-add.info;\
186 install: $(inst_infodir)/libc.info dir-add.info
187 @if $(SHELL) -c '$(INSTALL_INFO) --version' >/dev/null 2>&1; then \
188 test -f $(inst_infodir)/dir || cp dir $(inst_infodir);\
189 $(INSTALL_INFO) --info-dir=$(inst_infodir) \
190 --section '^GNU Libraries:' 'GNU Libraries:' \
191 $(inst_infodir)/libc.info;\
192 $(INSTALL_INFO) --info-dir=$(inst_infodir) \
193 --section '^GNU C Library functions:' 'GNU C Library functions:' \
198 # Catchall implicit rule for other installation targets from the parent.
201 $(inst_infodir)/libc.info: libc.info installdirs
202 for file in $<*; do \
203 $(INSTALL_DATA) $$file $(@D)/$$file; \
207 $(mkinstalldirs) $(inst_infodir)
210 dist: # glibc-doc-$(edition).tar.gz
212 ifneq (,$(wildcard ../Make-dist))
214 $(MAKE) -f $< $(Make-dist-args)
220 TAGS: $(minimal-dist)
223 # The parent makefile sometimes invokes us with targets `subdir_REAL-TARGET'.
225 # For targets we don't define, do nothing.
228 # These are targets that each glibc subdirectory is expected to understand.
229 # ../Rules defines them for code subdirectories; for us, they are no-ops.
230 # None of these should be `subdir_TARGET'; those targets are transformed
231 # by the implicit rule above into `TARGET' deps.
232 glibc-targets := lib objects objs others tests lint.out \
233 echo-headers echo-distinfo
234 .PHONY: $(glibc-targets)
237 # Create stamp files if they don't exist, so the parent makefile's rules for
238 # updating the library archives are happy with us, and never think we have
239 # changed the library.
240 lib: $(foreach o,$(object-suffixes-for-libc),$(objpfx)stamp$o)
243 stubs: $(objpfx)stubs
245 $(objpfx)stubs ../po/manual.pot $(objpfx)stamp%:
246 $(make-target-directory)
249 # Make the target directory if it doesn't exist, using the `mkinstalldirs'
250 # script that does `mkdir -p' even if `mkdir' doesn't support that flag.
251 define make-target-directory
252 $(addprefix $(mkinstalldirs) ,\
253 $(filter-out $(wildcard $(@D:%/=%)),$(@D:%/=%)))
256 # The top-level glibc Makefile expects subdir_install to update the stubs file.
257 subdir_install: stubs
259 # Get rid of these variables if they came from the parent.