]> sourceware.org Git - glibc.git/blame - manual/Makefile
2013-09-23 Steve Ellcey <sellcey@mips.com>
[glibc.git] / manual / Makefile
CommitLineData
568035b7 1# Copyright (C) 1992-2013 Free Software Foundation, Inc.
28f540f4
RM
2# This file is part of the GNU C Library.
3
4# The GNU C Library is free software; you can redistribute it and/or
41bdb6e2
AJ
5# modify it under the terms of the GNU Lesser General Public
6# License as published by the Free Software Foundation; either
7# version 2.1 of the License, or (at your option) any later version.
28f540f4
RM
8
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
41bdb6e2 12# Lesser General Public License for more details.
28f540f4 13
41bdb6e2 14# You should have received a copy of the GNU Lesser General Public
59ba27a6
PE
15# License along with the GNU C Library; if not, see
16# <http://www.gnu.org/licenses/>.
0c5ecdc4
UD
17
18# Makefile for the GNU C Library manual.
28f540f4
RM
19
20subdir := manual
28f540f4 21
907a1bac
UD
22# Allow override
23INSTALL_INFO = install-info
ceb2d9aa 24
6a4888ff 25.PHONY: dvi pdf info html
04be94a8 26
28f540f4 27# Get glibc's configuration info.
28f540f4 28include ../Makeconfig
737547be 29
6a4888ff
AJ
30dvi: $(objpfx)libc.dvi
31pdf: $(objpfx)libc.pdf
32
4e681b5b 33TEXI2DVI = texi2dvi
fb0dd050 34TEXI2PDF = texi2dvi --pdf
1830a0d5 35
96888079 36ifneq ($(strip $(MAKEINFO)),:)
6a4888ff 37info: $(objpfx)libc.info
28f540f4
RM
38endif
39
7a68c94a 40chapters = $(addsuffix .texi, \
390955cb 41 intro errno memory ctype string charset locale \
07435eb4 42 message search pattern io stdio llio filesys \
d52b6462
UD
43 pipe socket terminal syslog math arith time \
44 resource setjmp signal startup process job nss \
3ea5be54 45 users sysinfo conf crypt debug threads probes)
07435eb4 46add-chapters = $(wildcard $(foreach d, $(add-ons), ../$d/$d.texi))
d9dc34cd
TMQMF
47appendices = lang.texi header.texi install.texi maint.texi platform.texi \
48 contrib.texi
66ab80bc 49licenses = freemanuals.texi lgpl-2.1.texi fdl-1.3.texi
7a68c94a 50
6a4888ff
AJ
51-include $(objpfx)texis
52$(objpfx)texis: texis.awk $(chapters) $(add-chapters) $(appendices) $(licenses)
834f9b8d 53 $(make-target-directory)
07435eb4 54 $(AWK) -f $^ > $@.T
7a68c94a
UD
55 mv -f $@.T $@
56
07435eb4 57nonexamples = $(filter-out $(add-chapters) %.c.texi, $(texis))
1b1594b3
UD
58examples = $(filter-out $(foreach d, $(add-ons), ../$d/%.c.texi), \
59 $(filter %.c.texi, $(texis)))
7a68c94a 60
6a4888ff
AJ
61# Generated files directly included from libc.texinfo.
62libc-texi-generated = chapters.texi top-menu.texi dir-add.texi \
8b748aed 63 libm-err.texi version.texi pkgvers.texi
6a4888ff
AJ
64
65# Add path to build dir for generated files
66texis-path := $(filter-out $(libc-texi-generated) summary.texi $(examples), \
67 $(texis)) \
68 $(addprefix $(objpfx),$(filter $(libc-texi-generated) summary.texi \
69 $(examples), $(texis)))
70
7a68c94a 71# Kludge: implicit rule so Make knows the one command does it all.
6a4888ff
AJ
72chapters.% top-menu.%: libc-texinfo.sh $(texis-path) Makefile
73 AWK=$(AWK) $(SHELL) $< $(objpfx) \
74 '$(chapters)' \
069e52f8
RM
75 '$(add-chapters)' \
76 '$(appendices) $(licenses)'
7a68c94a 77
bb8b6697 78
6a4888ff
AJ
79$(objpfx)libc.dvi $(objpfx)libc.pdf $(objpfx)libc.info: \
80 $(addprefix $(objpfx),$(libc-texi-generated))
81$(objpfx)libc.dvi $(objpfx)libc.pdf: texinfo.tex
28f540f4 82
6a4888ff
AJ
83html: $(objpfx)libc/index.html
84$(objpfx)libc/index.html: $(addprefix $(objpfx),$(libc-texi-generated))
85 $(MAKEINFO) -P $(objpfx) -o $(objpfx)libc --html libc.texinfo
fef0b717 86
28f540f4 87# Generate the summary from the Texinfo source files for each chapter.
6a4888ff
AJ
88$(objpfx)summary.texi: $(objpfx)stamp-summary ;
89$(objpfx)stamp-summary: summary.awk $(filter-out $(objpfx)summary.texi, \
90 $(texis-path))
91 $(AWK) -f $^ | sort -t'\f' -df -k 1,1 | tr '\014' '\012' \
92 > $(objpfx)summary-tmp
93 $(move-if-change) $(objpfx)summary-tmp $(objpfx)summary.texi
5bc2f642 94 touch $@
28f540f4 95
ceb2d9aa
UD
96# Generate a file which can be added to the `dir' content to provide direct
97# access to the documentation of the function, variables, and other
98# definitions.
6a4888ff 99$(objpfx)dir-add.texi: xtract-typefun.awk $(texis-path)
6e613d6a
RM
100 (echo "@dircategory GNU C library functions and macros"; \
101 echo "@direntry"; \
c0016081 102 $(AWK) -f $^ | sort; \
6e613d6a 103 echo "@end direntry") > $@.new
63551311 104 mv -f $@.new $@
ceb2d9aa 105
aaa1276e 106# The table with the math errors is generated.
6a4888ff
AJ
107$(objpfx)libm-err.texi: $(objpfx)stamp-libm-err
108$(objpfx)stamp-libm-err: libm-err-tab.pl $(wildcard $(foreach dir,$(sysdirs),\
aaa1276e
UD
109 $(dir)/libm-test-ulps))
110 pwd=`pwd`; \
6a4888ff
AJ
111 $(PERL) $< $$pwd/.. > $(objpfx)libm-err-tmp
112 $(move-if-change) $(objpfx)libm-err-tmp $(objpfx)libm-err.texi
aaa1276e
UD
113 touch $@
114
8b748aed
JM
115# Package version and bug reporting URL.
116$(objpfx)pkgvers.texi: $(objpfx)stamp-pkgvers ;
117$(objpfx)stamp-pkgvers: $(common-objpfx)config.make
118 echo "@ifclear PKGVERS" > $(objpfx)pkgvers-tmp
119 echo "@set PKGVERS" >> $(objpfx)pkgvers-tmp
120 echo "@set PKGVERSION $(PKGVERSION_TEXI)" >> $(objpfx)pkgvers-tmp
121 if [ "$(PKGVERSION_TEXI)" = "(GNU libc) " ]; then \
122 echo "@set PKGVERSION_DEFAULT" >> $(objpfx)pkgvers-tmp; \
123 fi
124 echo "@set REPORT_BUGS_TO $(REPORT_BUGS_TEXI)" >> $(objpfx)pkgvers-tmp
125 echo "@end ifclear" >> $(objpfx)pkgvers-tmp
126 $(move-if-change) $(objpfx)pkgvers-tmp $(objpfx)pkgvers.texi
127 touch $@
128
bb8b6697 129# Generate a file with the version number.
6a4888ff
AJ
130$(objpfx)version.texi: $(objpfx)stamp-version ;
131$(objpfx)stamp-version: $(common-objpfx)config.make
132 echo "@set VERSION $(version)" > $(objpfx)version-tmp
133 $(move-if-change) $(objpfx)version-tmp $(objpfx)version.texi
bb8b6697
JM
134 touch $@
135
28f540f4 136# Generate Texinfo files from the C source for the example programs.
6a4888ff 137$(objpfx)%.c.texi: examples/%.c
d9a17c07
RM
138 sed -e '1,/^\*\/$$/d' \
139 -e 's,[{}],@&,g' \
28f540f4
RM
140 -e 's,/\*\(@.*\)\*/,\1,g' \
141 -e 's,/\* *,/* @r{,g' -e 's, *\*/,} */,' \
b0de3e9e 142 -e 's/\(@[a-z][a-z]*\)@{\([^}]*\)@}/\1{\2}/g'\
28f540f4
RM
143 $< | expand > $@.new
144 mv -f $@.new $@
145
6a4888ff
AJ
146$(objpfx)%.info: %.texinfo
147 LANGUAGE=C LC_ALL=C $(MAKEINFO) -P $(objpfx) --output=$@ $<
7a68c94a 148
6a4888ff
AJ
149$(objpfx)%.dvi: %.texinfo
150 cd $(objpfx);$(TEXI2DVI) -I $(shell cd $(<D) && pwd) --output=$@ \
151 $(shell cd $(<D) && pwd)/$<
152
153$(objpfx)%.pdf: %.texinfo
154 cd $(objpfx);$(TEXI2PDF) -I $(shell cd $(<D) && pwd) --output=$@ \
155 $(shell cd $(<D) && pwd)/$<
7a68c94a 156
1830a0d5 157
7a68c94a 158# Distribution.
464d646f 159minimal-dist = summary.awk texis.awk tsort.awk libc-texinfo.sh libc.texinfo \
aaa1276e 160 libm-err.texi stamp-libm-err \
464d646f 161 $(filter-out summary.texi, $(nonexamples)) \
7a68c94a 162 $(patsubst %.c.texi,examples/%.c, $(examples))
28f540f4 163
28f540f4 164indices = cp fn pg tp vr ky
6a4888ff
AJ
165generated-dirs := libc
166generated = libc.dvi libc.pdf libc.tmp libc.info* \
167 stubs \
168 texis summary.texi stamp-summary *.c.texi \
169 $(foreach index,$(indices),libc.$(index) libc.$(index)s) \
170 libc.log libc.aux libc.toc \
171 $(libc-texi-generated) \
172 stamp-libm-err stamp-version
173
174include ../Rules
175
176.PHONY: install subdir_install install-data
28f540f4 177install-data subdir_install: install
96888079 178ifneq ($(strip $(MAKEINFO)),:)
6e613d6a 179install: $(inst_infodir)/libc.info
907a1bac 180 @if $(SHELL) -c '$(INSTALL_INFO) --version' >/dev/null 2>&1; then \
b28dcd8e 181 test -f $(inst_infodir)/dir || $(INSTALL_DATA) dir $(inst_infodir);\
907a1bac 182 $(INSTALL_INFO) --info-dir=$(inst_infodir) $(inst_infodir)/libc.info;\
714a562f 183 else : ; fi
6591c335 184endif
28f540f4
RM
185# Catchall implicit rule for other installation targets from the parent.
186install-%: ;
187
6a4888ff
AJ
188$(inst_infodir)/libc.info: $(objpfx)libc.info
189 $(make-target-directory)
28f540f4 190 for file in $<*; do \
6a4888ff 191 $(INSTALL_DATA) $$file $(@D)/; \
28f540f4
RM
192 done
193
28f540f4
RM
194TAGS: $(minimal-dist)
195 $(ETAGS) -o $@ $^
This page took 0.429265 seconds and 5 git commands to generate.