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)
59 add-chapters = $(wildcard $(foreach d, $(add-ons), ../$d/$d.texi))
60 appendices = lang.texi header.texi install.texi maint.texi contrib.texi
63 texis: texis.awk $(chapters) $(add-chapters) $(appendices) lgpl.texinfo
67 nonexamples = $(filter-out $(add-chapters) %.c.texi, $(texis))
68 examples = $(filter-out $(foreach d, $(add-ons), ../$d/%.c.texi), \
69 $(filter %.c.texi, $(texis)))
71 # Kludge: implicit rule so Make knows the one command does it all.
72 chapters.% top-menu.%: libc-texinfo.sh $(texis)
73 AWK=$(AWK) $(SHELL) $< '$(chapters)' '$(add-chapters)' '$(appendices)'
75 libc.dvi libc.pdf libc.info: chapters.texi top-menu.texi libm-err.texi
76 libc.dvi libc.pdf: texinfo.tex
78 # Generate the summary from the Texinfo source files for each chapter.
79 summary.texi: stamp-summary ;
80 stamp-summary: summary.awk $(filter-out summary.texi, $(texis))
81 $(AWK) -f $^ | sort -t'
\f' -df +0 -1 | tr '\014' '\012' > summary-tmp
82 $(move-if-change) summary-tmp summary.texi
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
88 dir-add.info: xtract-typefun.awk $(texis)
89 (echo "INFO-DIR-SECTION GNU C library functions"; \
90 echo "START-INFO-DIR-ENTRY"; \
91 $(AWK) -f $^ | sort; \
92 echo "END-INFO-DIR-ENTRY") > $@.new
95 # The table with the math errors is generated.
96 libm-err.texi: stamp-libm-err
97 stamp-libm-err: libm-err-tab.pl $(wildcard $(foreach dir,$(sysdirs),\
98 $(dir)/libm-test-ulps))
100 $(PERL) $< $$pwd/.. > libm-err-tmp
101 $(move-if-change) libm-err-tmp libm-err.texi
104 # Generate Texinfo files from the C source for the example programs.
105 %.c.texi: examples/%.c
106 sed -e 's,[{}],@&,g' \
107 -e 's,/\*\(@.*\)\*/,\1,g' \
108 -e 's,/\* *,/* @r{,g' -e 's, *\*/,} */,' \
109 -e 's/\(@[a-z][a-z]*\)@{\([^}]*\)@}/\1{\2}/g'\
114 LANGUAGE=C LC_ALL=C $(MAKEINFO) $<
123 minimal-dist = summary.awk texis.awk tsort.awk libc-texinfo.sh libc.texinfo \
124 libm-err.texi stamp-libm-err \
125 $(filter-out summary.texi, $(nonexamples)) \
126 $(patsubst %.c.texi,examples/%.c, $(examples))
128 doc-only-dist = Makefile COPYING.LIB
129 distribute = $(minimal-dist) $(examples) stdio-fp.c \
130 libc.info* libc.?? libc.??s texinfo.tex \
131 xtract-typefun.awk dir-add.info dir libm-err-tab.pl
132 export distribute := $(distribute)
134 tar-it = tar chovf $@ $^
136 manual.tar: $(doc-only-dist) $(minimal-dist) ; $(tar-it)
137 mandist.tar: $(doc-only-dist) $(distribute) ; $(tar-it)
139 edition := $(shell sed -n 's/^@set EDITION \([0-9][0-9.]*\)[^0-9.]*.*$$/\1/p' \
142 glibc-doc-$(edition).tar: $(doc-only-dist) $(distribute)
143 @rm -f glibc-doc-$(edition)
144 ln -s . glibc-doc-$(edition)
145 tar chovf $@ $(addprefix glibc-doc-$(edition)/,$^)
146 rm -f glibc-doc-$(edition)
149 compress -c $< > $@.new
152 gzip -9 -c $< > $@.new
155 uuencode $< < $< > $@.new
158 .PHONY: mostlyclean distclean realclean clean
160 -rm -f libc.dvi libc.pdf libc.tmp libc.info* dir-add.info
161 -rm -f $(objpfx)stubs $(objpfx)distinfo
162 -rm -f $(foreach o,$(object-suffixes-for-libc),$(objpfx)stamp$o)
165 indices = cp fn pg tp vr ky
167 -rm -f texis summary.texi stamp-summary *.c.texi
168 -rm -f $(foreach index,$(indices),libc.$(index) libc.$(index)s)
169 -rm -f libc.log libc.aux libc.toc dir-add.texinfo
170 -rm -f top-menu.texi chapters.texi
172 .PHONY: install subdir_install installdirs install-data
173 install-data subdir_install: install
174 ifneq ($(strip $(MAKEINFO)),)
175 # There are two variants of install-info out there. The GNU version
176 # knows about the INFO-DIR-SECTION tag, the Debian version doesn't.
177 ifneq ($(OLD_DEBIAN_INSTALL_INFO),yes)
178 install: $(inst_infodir)/libc.info dir-add.info
179 @if $(SHELL) -c '$(INSTALL_INFO) --version' >/dev/null 2>&1; then \
180 test -f $(inst_infodir)/dir || cp dir $(inst_infodir);\
181 $(INSTALL_INFO) --info-dir=$(inst_infodir) $(inst_infodir)/libc.info;\
182 $(INSTALL_INFO) --info-dir=$(inst_infodir) dir-add.info;\
185 install: $(inst_infodir)/libc.info dir-add.info
186 @if $(SHELL) -c '$(INSTALL_INFO) --version' >/dev/null 2>&1; then \
187 test -f $(inst_infodir)/dir || cp dir $(inst_infodir);\
188 $(INSTALL_INFO) --info-dir=$(inst_infodir) \
189 --section '^GNU Libraries:' 'GNU Libraries:' \
190 $(inst_infodir)/libc.info;\
191 $(INSTALL_INFO) --info-dir=$(inst_infodir) \
192 --section '^GNU C Library functions:' 'GNU C Library functions:' \
197 # Catchall implicit rule for other installation targets from the parent.
200 $(inst_infodir)/libc.info: libc.info installdirs
201 for file in $<*; do \
202 $(INSTALL_DATA) $$file $(@D)/$$file; \
206 $(mkinstalldirs) $(inst_infodir)
209 dist: # glibc-doc-$(edition).tar.gz
211 ifneq (,$(wildcard ../Make-dist))
213 $(MAKE) -f $< $(Make-dist-args)
219 TAGS: $(minimal-dist)
222 # The parent makefile sometimes invokes us with targets `subdir_REAL-TARGET'.
224 # For targets we don't define, do nothing.
227 # These are targets that each glibc subdirectory is expected to understand.
228 # ../Rules defines them for code subdirectories; for us, they are no-ops.
229 # None of these should be `subdir_TARGET'; those targets are transformed
230 # by the implicit rule above into `TARGET' deps.
231 glibc-targets := lib objects objs others tests lint.out \
232 echo-headers echo-distinfo
233 .PHONY: $(glibc-targets)
236 # Create stamp files if they don't exist, so the parent makefile's rules for
237 # updating the library archives are happy with us, and never think we have
238 # changed the library.
239 lib: $(foreach o,$(object-suffixes-for-libc),$(objpfx)stamp$o)
242 stubs: $(objpfx)stubs
244 $(objpfx)stubs ../po/manual.pot $(objpfx)stamp%:
245 $(make-target-directory)
248 # Make the target directory if it doesn't exist, using the `mkinstalldirs'
249 # script that does `mkdir -p' even if `mkdir' doesn't support that flag.
250 define make-target-directory
251 $(addprefix $(mkinstalldirs) ,\
252 $(filter-out $(wildcard $(@D:%/=%)),$(@D:%/=%)))
255 # The top-level glibc Makefile expects subdir_install to update the stubs file.
256 subdir_install: stubs
258 # Get rid of these variables if they came from the parent.