ia64: fix build failure after async tls updates
[glibc.git] / manual / Makefile
blob3037303a7151c8051440d58621d63991ea6351b8
1 # Copyright (C) 1992-2014 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 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.
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 # Lesser General Public License for more details.
14 # You should have received a copy of the GNU Lesser General Public
15 # License along with the GNU C Library; if not, see
16 # <http://www.gnu.org/licenses/>.
18 # Makefile for the GNU C Library manual.
20 subdir := manual
22 # Allow override
23 INSTALL_INFO = install-info
25 .PHONY: dvi pdf info html
27 # Get glibc's configuration info.
28 include ../Makeconfig
30 dvi: $(objpfx)libc.dvi
31 pdf: $(objpfx)libc.pdf
33 TEXI2DVI = texi2dvi
34 TEXI2PDF = texi2dvi --pdf
36 ifneq ($(strip $(MAKEINFO)),:)
37 info: $(objpfx)libc.info
38 endif
40 chapters = $(addsuffix .texi, \
41 intro errno memory ctype string charset locale \
42 message search pattern io stdio llio filesys \
43 pipe socket terminal syslog math arith time \
44 resource setjmp signal startup process job nss \
45 users sysinfo conf crypt debug threads probes)
46 add-chapters = $(wildcard $(foreach d, $(add-ons), ../$d/$d.texi))
47 appendices = lang.texi header.texi install.texi maint.texi platform.texi \
48 contrib.texi
49 licenses = freemanuals.texi lgpl-2.1.texi fdl-1.3.texi
51 -include $(objpfx)texis
52 $(objpfx)texis: texis.awk $(chapters) $(add-chapters) $(appendices) $(licenses)
53 $(make-target-directory)
54 $(AWK) -f $^ > $@.T
55 mv -f $@.T $@
57 nonexamples = $(filter-out $(add-chapters) %.c.texi, $(texis))
58 examples = $(filter-out $(foreach d, $(add-ons), ../$d/%.c.texi), \
59 $(filter %.c.texi, $(texis)))
61 # Generated files directly included from libc.texinfo.
62 libc-texi-generated = chapters.texi top-menu.texi dir-add.texi \
63 libm-err.texi version.texi pkgvers.texi
65 # Add path to build dir for generated files
66 texis-path := $(filter-out $(libc-texi-generated) summary.texi $(examples), \
67 $(texis)) \
68 $(addprefix $(objpfx),$(filter $(libc-texi-generated) summary.texi \
69 $(examples), $(texis)))
71 # Kludge: implicit rule so Make knows the one command does it all.
72 chapters.% top-menu.%: libc-texinfo.sh $(texis-path) Makefile
73 AWK=$(AWK) $(SHELL) $< $(objpfx) \
74 '$(chapters)' \
75 '$(add-chapters)' \
76 '$(appendices) $(licenses)'
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
83 html: $(objpfx)libc/index.html
84 $(objpfx)libc/index.html: $(addprefix $(objpfx),$(libc-texi-generated))
85 $(MAKEINFO) -P $(objpfx) -o $(objpfx)libc --html libc.texinfo
87 # Generate the summary from the Texinfo source files for each chapter.
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
94 touch $@
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.
99 $(objpfx)dir-add.texi: xtract-typefun.awk $(texis-path)
100 (echo "@dircategory GNU C library functions and macros"; \
101 echo "@direntry"; \
102 $(AWK) -f $^ | sort; \
103 echo "@end direntry") > $@.new
104 mv -f $@.new $@
106 # The table with the math errors is generated.
107 $(objpfx)libm-err.texi: $(objpfx)stamp-libm-err
108 $(objpfx)stamp-libm-err: libm-err-tab.pl $(wildcard $(foreach dir,$(sysdirs),\
109 $(dir)/libm-test-ulps))
110 pwd=`pwd`; \
111 $(PERL) $< $$pwd/.. > $(objpfx)libm-err-tmp
112 $(move-if-change) $(objpfx)libm-err-tmp $(objpfx)libm-err.texi
113 touch $@
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; \
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 $@
129 # Generate a file with the version number.
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
134 touch $@
136 # Generate Texinfo files from the C source for the example programs.
137 $(objpfx)%.c.texi: examples/%.c
138 sed -e '1,/^\*\/$$/d' \
139 -e 's,[{}],@&,g' \
140 -e 's,/\*\(@.*\)\*/,\1,g' \
141 -e 's,/\* *,/* @r{,g' -e 's, *\*/,} */,' \
142 -e 's/\(@[a-z][a-z]*\)@{\([^}]*\)@}/\1{\2}/g'\
143 $< | expand > $@.new
144 mv -f $@.new $@
146 $(objpfx)%.info: %.texinfo
147 LANGUAGE=C LC_ALL=C $(MAKEINFO) -P $(objpfx) --output=$@ $<
149 $(objpfx)%.dvi: %.texinfo
150 cd $(objpfx);$(TEXI2DVI) -I $(shell cd $(<D) && pwd) --output=$@ \
151 $(shell cd $(<D) && pwd)/$<
153 $(objpfx)%.pdf: %.texinfo
154 cd $(objpfx);$(TEXI2PDF) -I $(shell cd $(<D) && pwd) --output=$@ \
155 $(shell cd $(<D) && pwd)/$<
158 # Distribution.
159 minimal-dist = summary.awk texis.awk tsort.awk libc-texinfo.sh libc.texinfo \
160 libm-err.texi stamp-libm-err \
161 $(filter-out summary.texi, $(nonexamples)) \
162 $(patsubst %.c.texi,examples/%.c, $(examples))
164 indices = cp fn pg tp vr ky
165 generated-dirs := libc
166 generated = 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
174 include ../Rules
176 .PHONY: install subdir_install install-data
177 install-data subdir_install: install
178 ifneq ($(strip $(MAKEINFO)),:)
179 install: $(inst_infodir)/libc.info
180 @if $(SHELL) -c '$(INSTALL_INFO) --version' >/dev/null 2>&1; then \
181 test -f $(inst_infodir)/dir || $(INSTALL_DATA) dir $(inst_infodir);\
182 $(INSTALL_INFO) --info-dir=$(inst_infodir) $(inst_infodir)/libc.info;\
183 else : ; fi
184 endif
185 # Catchall implicit rule for other installation targets from the parent.
186 install-%: ;
188 $(inst_infodir)/libc.info: $(objpfx)libc.info
189 $(make-target-directory)
190 for file in $<*; do \
191 $(INSTALL_DATA) $$file $(@D)/; \
192 done
194 TAGS: $(minimal-dist)
195 $(ETAGS) -o $@ $^