]> git.ipfire.org Git - thirdparty/glibc.git/blob - manual/Makefile
Remove standalone manual support
[thirdparty/glibc.git] / manual / Makefile
1 # Copyright (C) 1992-2012
2 # Free Software Foundation, Inc.
3 # This file is part of the GNU C Library.
4
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.
9
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.
14
15 # You should have received a copy of the GNU Lesser General Public
16 # License along with the GNU C Library; if not, see
17 # <http://www.gnu.org/licenses/>.
18
19 # Makefile for the GNU C Library manual.
20
21 subdir := manual
22 export subdir := $(subdir)
23
24 # Allow override
25 INSTALL_INFO = install-info
26
27 .PHONY: all dvi pdf info html
28 all: dvi
29 dvi: libc.dvi
30 pdf: libc.pdf
31
32 # Get glibc's configuration info.
33 include ../Makeconfig
34
35 TEXI2DVI = texi2dvi
36 TEXI2PDF = texi2dvi --pdf
37
38 ifneq ($(strip $(MAKEINFO)),:)
39 all: info
40 info: libc.info
41 endif
42
43 mkinstalldirs = $(..)scripts/mkinstalldirs
44
45 chapters = $(addsuffix .texi, \
46 intro errno memory ctype string charset locale \
47 message search pattern io stdio llio filesys \
48 pipe socket terminal syslog math arith time \
49 resource setjmp signal startup process job nss \
50 users sysinfo conf crypt debug)
51 add-chapters = $(wildcard $(foreach d, $(add-ons), ../$d/$d.texi))
52 appendices = lang.texi header.texi install.texi maint.texi contrib.texi
53 licenses = freemanuals.texi lgpl-2.1.texi fdl-1.3.texi
54
55 -include texis
56 texis: texis.awk $(chapters) $(add-chapters) $(appendices) $(licenses)
57 $(AWK) -f $^ > $@.T
58 mv -f $@.T $@
59
60 nonexamples = $(filter-out $(add-chapters) %.c.texi, $(texis))
61 examples = $(filter-out $(foreach d, $(add-ons), ../$d/%.c.texi), \
62 $(filter %.c.texi, $(texis)))
63
64 # Kludge: implicit rule so Make knows the one command does it all.
65 chapters.% top-menu.%: libc-texinfo.sh $(texis) Makefile
66 AWK=$(AWK) $(SHELL) $< '$(chapters)' \
67 '$(add-chapters)' \
68 '$(appendices) $(licenses)'
69
70 # Generated files directly included from libc.texinfo.
71 libc-texi-generated = chapters.texi top-menu.texi dir-add.texi \
72 libm-err.texi version.texi
73
74 libc.dvi libc.pdf libc.info: $(libc-texi-generated)
75 libc.dvi libc.pdf: texinfo.tex
76
77 html: libc/index.html
78 libc/index.html: $(libc-texi-generated)
79 $(MAKEINFO) --html libc.texinfo
80
81 # Generate the summary from the Texinfo source files for each chapter.
82 summary.texi: stamp-summary ;
83 stamp-summary: summary.awk $(filter-out summary.texi, $(texis))
84 $(AWK) -f $^ | sort -t'\f' -df -k 1,1 | tr '\014' '\012' > summary-tmp
85 $(move-if-change) summary-tmp summary.texi
86 touch $@
87
88 # Generate a file which can be added to the `dir' content to provide direct
89 # access to the documentation of the function, variables, and other
90 # definitions.
91 dir-add.texi: xtract-typefun.awk $(texis)
92 (echo "@dircategory GNU C library functions and macros"; \
93 echo "@direntry"; \
94 $(AWK) -f $^ | sort; \
95 echo "@end direntry") > $@.new
96 mv -f $@.new $@
97
98 # The table with the math errors is generated.
99 libm-err.texi: stamp-libm-err
100 stamp-libm-err: libm-err-tab.pl $(wildcard $(foreach dir,$(sysdirs),\
101 $(dir)/libm-test-ulps))
102 pwd=`pwd`; \
103 $(PERL) $< $$pwd/.. > libm-err-tmp
104 $(move-if-change) libm-err-tmp libm-err.texi
105 touch $@
106
107 # Generate a file with the version number.
108 version.texi: stamp-version ;
109 stamp-version: $(common-objpfx)config.make
110 echo "@set VERSION $(version)" > version-tmp
111 $(move-if-change) version-tmp version.texi
112 touch $@
113
114 # Generate Texinfo files from the C source for the example programs.
115 %.c.texi: examples/%.c
116 sed -e '1,/^\*\/$$/d' \
117 -e 's,[{}],@&,g' \
118 -e 's,/\*\(@.*\)\*/,\1,g' \
119 -e 's,/\* *,/* @r{,g' -e 's, *\*/,} */,' \
120 -e 's/\(@[a-z][a-z]*\)@{\([^}]*\)@}/\1{\2}/g'\
121 $< | expand > $@.new
122 mv -f $@.new $@
123
124 %.info: %.texinfo
125 LANGUAGE=C LC_ALL=C $(MAKEINFO) $<
126
127 %.dvi: %.texinfo
128 $(TEXI2DVI) $<
129
130 %.pdf: %.texinfo
131 $(TEXI2PDF) $<
132
133 # Distribution.
134 minimal-dist = summary.awk texis.awk tsort.awk libc-texinfo.sh libc.texinfo \
135 libm-err.texi stamp-libm-err \
136 $(filter-out summary.texi, $(nonexamples)) \
137 $(patsubst %.c.texi,examples/%.c, $(examples))
138
139 .PHONY: mostlyclean distclean realclean clean
140 mostlyclean:
141 -rm -f libc.dvi libc.pdf libc.tmp libc.info*
142 -rm -f $(objpfx)stubs
143 -rm -f $(foreach o,$(object-suffixes-for-libc),$(objpfx)stamp$o)
144 clean: mostlyclean
145 distclean: clean
146 indices = cp fn pg tp vr ky
147 realclean: distclean
148 -rm -f texis summary.texi stamp-summary *.c.texi
149 -rm -f $(foreach index,$(indices),libc.$(index) libc.$(index)s)
150 -rm -f libc.log libc.aux libc.toc
151 -rm -f $(libc-texi-generated)
152
153 .PHONY: install subdir_install installdirs install-data
154 install-data subdir_install: install
155 ifneq ($(strip $(MAKEINFO)),:)
156 install: $(inst_infodir)/libc.info
157 @if $(SHELL) -c '$(INSTALL_INFO) --version' >/dev/null 2>&1; then \
158 test -f $(inst_infodir)/dir || $(INSTALL_DATA) dir $(inst_infodir);\
159 $(INSTALL_INFO) --info-dir=$(inst_infodir) $(inst_infodir)/libc.info;\
160 else : ; fi
161 endif
162 # Catchall implicit rule for other installation targets from the parent.
163 install-%: ;
164
165 $(inst_infodir)/libc.info: libc.info installdirs
166 for file in $<*; do \
167 $(INSTALL_DATA) $$file $(@D)/$$file; \
168 done
169
170 installdirs:
171 $(mkinstalldirs) $(inst_infodir)
172
173 TAGS: $(minimal-dist)
174 $(ETAGS) -o $@ $^
175 \f
176 # The parent makefile sometimes invokes us with targets `subdir_REAL-TARGET'.
177 subdir_%: % ;
178 # For targets we don't define, do nothing.
179 subdir_%: ;
180
181 # These are targets that each glibc subdirectory is expected to understand.
182 # ../Rules defines them for code subdirectories; for us, they are no-ops.
183 # None of these should be `subdir_TARGET'; those targets are transformed
184 # by the implicit rule above into `TARGET' deps.
185 glibc-targets := lib objects objs others tests xtests lint.out echo-headers
186 .PHONY: $(glibc-targets)
187 $(glibc-targets):
188
189 # Create stamp files if they don't exist, so the parent makefile's rules for
190 # updating the library archives are happy with us, and never think we have
191 # changed the library.
192 lib: $(foreach o,$(object-suffixes-for-libc),$(objpfx)stamp$o)
193 ifdef objpfx
194 .PHONY: stubs
195 stubs: $(objpfx)stubs
196 endif
197 $(objpfx)stubs ../po/manual.pot:
198 $(make-target-directory)
199 touch $@
200 $(objpfx)stamp%:
201 $(make-target-directory)
202 touch $@
203
204 # Make the target directory if it doesn't exist, using the `mkinstalldirs'
205 # script that does `mkdir -p' even if `mkdir' doesn't support that flag.
206 define make-target-directory
207 $(addprefix $(mkinstalldirs) ,\
208 $(filter-out $(wildcard $(@D:%/=%)),$(@D:%/=%)))
209 endef
210
211 # The top-level glibc Makefile expects subdir_install to update the stubs file.
212 subdir_install: stubs
213 \f
214 # Get rid of these variables if they came from the parent.
215 routines =
216 aux =
217 sources =
218 objects =
219 headers =