* config.h.in (USE_MULTIARCH): Define.
[glibc.git] / manual / Makefile
blobc5866eb9def3becfc6d076024f419f8298d5042f
1 # Copyright (C) 1992-1999,2000,2001,2002,2003,2004,2006
2 # Free Software Foundation, Inc.
3 # This file is part of the GNU C Library.
5 # The GNU C Library is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU Lesser General Public
7 # License as published by the Free Software Foundation; either
8 # version 2.1 of the License, or (at your option) any later version.
10 # The GNU C Library is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 # Lesser General Public License for more details.
15 # You should have received a copy of the GNU Lesser General Public
16 # License along with the GNU C Library; if not, write to the Free
17 # Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
18 # 02111-1307 USA.
20 # Makefile for the GNU C Library manual.
22 subdir := manual
23 export subdir := $(subdir)
25 # Allow override
26 INSTALL_INFO = install-info
28 .PHONY: all dvi pdf info html
29 all: dvi
30 dvi: libc.dvi
31 pdf: libc.pdf
33 # Get glibc's configuration info.
34 ifneq (,$(wildcard ../Makeconfig))
35 include ../Makeconfig
36 else
37 MAKEINFO = makeinfo
38 TEXI2DVI = texi2dvi
39 AWK = gawk
40 endif
42 TEXI2PDF = texi2dvi --pdf
44 ifneq ($(strip $(MAKEINFO)),:)
45 all: info
46 info: libc.info
47 endif
49 # scripts we use
50 ifndef move-if-change
51 move-if-change = ./move-if-change
52 endif
53 mkinstalldirs = $(..)scripts/mkinstalldirs
55 chapters = $(addsuffix .texi, \
56 intro errno memory ctype string charset locale \
57 message search pattern io stdio llio filesys \
58 pipe socket terminal syslog math arith time \
59 resource setjmp signal startup process job nss \
60 users sysinfo conf crypt debug)
61 add-chapters = $(wildcard $(foreach d, $(add-ons), ../$d/$d.texi))
62 appendices = lang.texi header.texi install.texi maint.texi contrib.texi \
63 freemanuals.texi
65 -include texis
66 texis: texis.awk $(chapters) $(add-chapters) $(appendices) lesser.texi fdl.texi
67 $(AWK) -f $^ > $@.T
68 mv -f $@.T $@
70 nonexamples = $(filter-out $(add-chapters) %.c.texi, $(texis))
71 examples = $(filter-out $(foreach d, $(add-ons), ../$d/%.c.texi), \
72 $(filter %.c.texi, $(texis)))
74 # Kludge: implicit rule so Make knows the one command does it all.
75 chapters.% top-menu.%: libc-texinfo.sh $(texis) Makefile
76 AWK=$(AWK) $(SHELL) $< '$(chapters)' '$(add-chapters)' '$(appendices)'
78 libc.dvi libc.pdf libc.info: chapters.texi top-menu.texi dir-add.texi \
79 libm-err.texi
80 libc.dvi libc.pdf: texinfo.tex
82 html: libc/index.html
83 libc/index.html: chapters.texi top-menu.texi dir-add.texi libm-err.texi
84 $(MAKEINFO) --html libc.texinfo
86 # Generate the summary from the Texinfo source files for each chapter.
87 summary.texi: stamp-summary ;
88 stamp-summary: summary.awk $(filter-out summary.texi, $(texis))
89 $(AWK) -f $^ | sort -t'\f' -df -k 1,1 | tr '\014' '\012' > summary-tmp
90 $(move-if-change) summary-tmp summary.texi
91 touch $@
93 # Generate a file which can be added to the `dir' content to provide direct
94 # access to the documentation of the function, variables, and other
95 # definitions.
96 dir-add.texi: xtract-typefun.awk $(texis)
97 (echo "@dircategory GNU C library functions and macros"; \
98 echo "@direntry"; \
99 $(AWK) -f $^ | sort; \
100 echo "@end direntry") > $@.new
101 mv -f $@.new $@
103 # The table with the math errors is generated.
104 libm-err.texi: stamp-libm-err
105 stamp-libm-err: libm-err-tab.pl $(wildcard $(foreach dir,$(sysdirs),\
106 $(dir)/libm-test-ulps))
107 pwd=`pwd`; \
108 $(PERL) $< $$pwd/.. > libm-err-tmp
109 $(move-if-change) libm-err-tmp libm-err.texi
110 touch $@
112 # Generate Texinfo files from the C source for the example programs.
113 %.c.texi: examples/%.c
114 sed -e 's,[{}],@&,g' \
115 -e 's,/\*\(@.*\)\*/,\1,g' \
116 -e 's,/\* *,/* @r{,g' -e 's, *\*/,} */,' \
117 -e 's/\(@[a-z][a-z]*\)@{\([^}]*\)@}/\1{\2}/g'\
118 $< | expand > $@.new
119 mv -f $@.new $@
121 %.info: %.texinfo
122 LANGUAGE=C LC_ALL=C $(MAKEINFO) $<
124 %.dvi: %.texinfo
125 $(TEXI2DVI) $<
127 %.pdf: %.texinfo
128 $(TEXI2PDF) $<
130 # Distribution.
131 minimal-dist = summary.awk texis.awk tsort.awk libc-texinfo.sh libc.texinfo \
132 libm-err.texi stamp-libm-err \
133 $(filter-out summary.texi, $(nonexamples)) \
134 $(patsubst %.c.texi,examples/%.c, $(examples))
136 doc-only-dist = Makefile COPYING.LIB
137 distribute = $(minimal-dist) $(examples) stdio-fp.c \
138 libc.info* libc.?? libc.??s texinfo.tex \
139 xtract-typefun.awk dir-add.texi dir libm-err-tab.pl
140 export distribute := $(distribute)
142 tar-it = tar chovf $@ $^
144 manual.tar: $(doc-only-dist) $(minimal-dist) ; $(tar-it)
145 mandist.tar: $(doc-only-dist) $(distribute) ; $(tar-it)
147 edition := $(shell sed -n 's/^@set EDITION \([0-9][0-9.]*\)[^0-9.]*.*$$/\1/p' \
148 libc.texinfo)
150 glibc-doc-$(edition).tar: $(doc-only-dist) $(distribute)
151 @rm -f glibc-doc-$(edition)
152 ln -s . glibc-doc-$(edition)
153 tar chovf $@ $(addprefix glibc-doc-$(edition)/,$^)
154 rm -f glibc-doc-$(edition)
156 %.Z: %
157 compress -c $< > $@.new
158 mv -f $@.new $@
159 %.gz: %
160 gzip -9 -c $< > $@.new
161 mv -f $@.new $@
162 %.uu: %
163 uuencode $< < $< > $@.new
164 mv -f $@.new $@
166 .PHONY: mostlyclean distclean realclean clean
167 mostlyclean:
168 -rm -f libc.dvi libc.pdf libc.tmp libc.info*
169 -rm -f $(objpfx)stubs
170 -rm -f $(foreach o,$(object-suffixes-for-libc),$(objpfx)stamp$o)
171 clean: mostlyclean
172 distclean: clean
173 indices = cp fn pg tp vr ky
174 realclean: distclean
175 -rm -f texis summary.texi stamp-summary *.c.texi dir-add.texi
176 -rm -f $(foreach index,$(indices),libc.$(index) libc.$(index)s)
177 -rm -f libc.log libc.aux libc.toc dir-add.texinfo
178 -rm -f top-menu.texi chapters.texi
180 .PHONY: install subdir_install installdirs install-data
181 install-data subdir_install: install
182 ifneq ($(strip $(MAKEINFO)),:)
183 install: $(inst_infodir)/libc.info
184 @if $(SHELL) -c '$(INSTALL_INFO) --version' >/dev/null 2>&1; then \
185 test -f $(inst_infodir)/dir || $(INSTALL_DATA) dir $(inst_infodir);\
186 $(INSTALL_INFO) --info-dir=$(inst_infodir) $(inst_infodir)/libc.info;\
187 else : ; fi
188 endif
189 # Catchall implicit rule for other installation targets from the parent.
190 install-%: ;
192 $(inst_infodir)/libc.info: libc.info installdirs
193 for file in $<*; do \
194 $(INSTALL_DATA) $$file $(@D)/$$file; \
195 done
197 installdirs:
198 $(mkinstalldirs) $(inst_infodir)
200 .PHONY: dist
201 dist: # glibc-doc-$(edition).tar.gz
203 ifneq (,$(wildcard ../Make-dist))
204 dist: ../Make-dist
205 $(MAKE) -f $< $(Make-dist-args)
206 endif
208 ifndef ETAGS
209 ETAGS = etags -T
210 endif
211 TAGS: $(minimal-dist)
212 $(ETAGS) -o $@ $^
214 # The parent makefile sometimes invokes us with targets `subdir_REAL-TARGET'.
215 subdir_%: % ;
216 # For targets we don't define, do nothing.
217 subdir_%: ;
219 # These are targets that each glibc subdirectory is expected to understand.
220 # ../Rules defines them for code subdirectories; for us, they are no-ops.
221 # None of these should be `subdir_TARGET'; those targets are transformed
222 # by the implicit rule above into `TARGET' deps.
223 glibc-targets := lib objects objs others tests xtests lint.out echo-headers
224 .PHONY: $(glibc-targets)
225 $(glibc-targets):
227 # Create stamp files if they don't exist, so the parent makefile's rules for
228 # updating the library archives are happy with us, and never think we have
229 # changed the library.
230 lib: $(foreach o,$(object-suffixes-for-libc),$(objpfx)stamp$o)
231 ifdef objpfx
232 .PHONY: stubs
233 stubs: $(objpfx)stubs
234 endif
235 $(objpfx)stubs ../po/manual.pot $(objpfx)stamp%:
236 $(make-target-directory)
237 touch $@
239 # Make the target directory if it doesn't exist, using the `mkinstalldirs'
240 # script that does `mkdir -p' even if `mkdir' doesn't support that flag.
241 define make-target-directory
242 $(addprefix $(mkinstalldirs) ,\
243 $(filter-out $(wildcard $(@D:%/=%)),$(@D:%/=%)))
244 endef
246 # The top-level glibc Makefile expects subdir_install to update the stubs file.
247 subdir_install: stubs
249 # Get rid of these variables if they came from the parent.
250 routines =
251 aux =
252 sources =
253 objects =
254 headers =