conformtest: Allow time.h inclusion from semaphore.h for XOPEN2K.
[glibc.git] / manual / Makefile
blob510f160d3ba8c297da6adc231de9c2d800cf9754
1 # Copyright (C) 1992-2017 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 include ../Makeconfig
24 .PHONY: dvi pdf info html
26 dvi: $(objpfx)libc.dvi
27 pdf: $(objpfx)libc.pdf
29 TEXI2DVI = texi2dvi
30 TEXI2PDF = texi2dvi --pdf
32 ifneq ($(strip $(MAKEINFO)),:)
33 info: $(objpfx)libc.info
34 endif
36 chapters = $(addsuffix .texi, \
37 intro errno memory ctype string charset locale \
38 message search pattern io stdio llio filesys \
39 pipe socket terminal syslog math arith time \
40 resource setjmp signal startup process ipc job \
41 nss users sysinfo conf crypt debug threads \
42 probes tunables)
43 add-chapters = $(wildcard $(foreach d, $(add-ons), ../$d/$d.texi))
44 appendices = lang.texi header.texi install.texi maint.texi platform.texi \
45 contrib.texi
46 licenses = freemanuals.texi lgpl-2.1.texi fdl-1.3.texi
48 -include $(objpfx)texis
49 $(objpfx)texis: texis.awk $(chapters) $(add-chapters) $(appendices) $(licenses)
50 $(make-target-directory)
51 $(AWK) -f $^ > $@.T
52 mv -f $@.T $@
54 nonexamples = $(filter-out $(add-chapters) %.c.texi, $(texis))
55 examples = $(filter-out $(foreach d, $(add-ons), ../$d/%.c.texi), \
56 $(filter %.c.texi, $(texis)))
58 # Generated files directly included from libc.texinfo.
59 libc-texi-generated = chapters.texi top-menu.texi dir-add.texi \
60 libm-err.texi version.texi pkgvers.texi
62 # Add path to build dir for generated files
63 texis-path := $(filter-out $(libc-texi-generated) summary.texi $(examples), \
64 $(texis)) \
65 $(addprefix $(objpfx),$(filter $(libc-texi-generated) summary.texi \
66 $(examples), $(texis)))
68 # Kludge: implicit rule so Make knows the one command does it all.
69 chapters.% top-menu.%: libc-texinfo.sh $(texis-path) Makefile
70 AWK=$(AWK) $(SHELL) $< $(objpfx) \
71 '$(chapters)' \
72 '$(add-chapters)' \
73 '$(appendices) $(licenses)'
76 $(objpfx)libc.dvi $(objpfx)libc.pdf $(objpfx)libc.info: \
77 $(addprefix $(objpfx),$(libc-texi-generated))
78 $(objpfx)libc.dvi $(objpfx)libc.pdf: texinfo.tex
80 html: $(objpfx)libc/index.html
81 $(objpfx)libc/index.html: $(addprefix $(objpfx),$(libc-texi-generated))
82 $(MAKEINFO) -P $(objpfx) -o $(objpfx)libc --html libc.texinfo
84 # Generate the summary from the Texinfo source files for each chapter.
85 $(objpfx)summary.texi: $(objpfx)stamp-summary ;
86 $(objpfx)stamp-summary: summary.awk $(filter-out $(objpfx)summary.texi, \
87 $(texis-path))
88 $(SHELL) ./check-safety.sh $(filter-out $(objpfx)%, $(texis-path))
89 $(AWK) -f $^ | sort -t'\f' -df -k 1,1 | tr '\014' '\012' \
90 > $(objpfx)summary-tmp
91 $(move-if-change) $(objpfx)summary-tmp $(objpfx)summary.texi
92 touch $@
94 # Generate a file which can be added to the `dir' content to provide direct
95 # access to the documentation of the function, variables, and other
96 # definitions.
97 $(objpfx)dir-add.texi: xtract-typefun.awk $(texis-path)
98 (echo "@dircategory GNU C library functions and macros"; \
99 echo "@direntry"; \
100 $(AWK) -f $^ | sort; \
101 echo "@end direntry") > $@.new
102 mv -f $@.new $@
104 # The table with the math errors is generated.
105 $(objpfx)libm-err.texi: $(objpfx)stamp-libm-err
106 $(objpfx)stamp-libm-err: libm-err-tab.pl $(wildcard $(foreach dir,$(sysdirs),\
107 $(dir)/libm-test-ulps))
108 pwd=`pwd`; \
109 $(PERL) $< $$pwd/.. > $(objpfx)libm-err-tmp
110 $(move-if-change) $(objpfx)libm-err-tmp $(objpfx)libm-err.texi
111 touch $@
113 # Package version and bug reporting URL.
114 $(objpfx)pkgvers.texi: $(objpfx)stamp-pkgvers ;
115 $(objpfx)stamp-pkgvers: $(common-objpfx)config.make
116 echo "@ifclear PKGVERS" > $(objpfx)pkgvers-tmp
117 echo "@set PKGVERS" >> $(objpfx)pkgvers-tmp
118 echo "@set PKGVERSION $(PKGVERSION_TEXI)" >> $(objpfx)pkgvers-tmp
119 if [ "$(PKGVERSION_TEXI)" = "(GNU libc) " ]; then \
120 echo "@set PKGVERSION_DEFAULT" >> $(objpfx)pkgvers-tmp; \
122 echo "@set REPORT_BUGS_TO $(REPORT_BUGS_TEXI)" >> $(objpfx)pkgvers-tmp
123 echo "@end ifclear" >> $(objpfx)pkgvers-tmp
124 $(move-if-change) $(objpfx)pkgvers-tmp $(objpfx)pkgvers.texi
125 touch $@
127 # Generate a file with the version number.
128 $(objpfx)version.texi: $(objpfx)stamp-version ;
129 $(objpfx)stamp-version: $(common-objpfx)config.make
130 echo "@set VERSION $(version)" > $(objpfx)version-tmp
131 $(move-if-change) $(objpfx)version-tmp $(objpfx)version.texi
132 touch $@
134 # Generate Texinfo files from the C source for the example programs.
135 $(objpfx)%.c.texi: examples/%.c
136 sed -e '1,/^\*\/$$/d' \
137 -e 's,[{}],@&,g' \
138 -e 's,/\*\(@.*\)\*/,\1,g' \
139 -e 's,/\* *,/* @r{,g' -e 's, *\*/,} */,' \
140 -e 's/\(@[a-z][a-z]*\)@{\([^}]*\)@}/\1{\2}/g'\
141 $< | expand > $@.new
142 mv -f $@.new $@
144 $(objpfx)%.info: %.texinfo
145 LANGUAGE=C LC_ALL=C $(MAKEINFO) -P $(objpfx) --output=$@ $<
147 $(objpfx)%.dvi: %.texinfo
148 cd $(objpfx);$(TEXI2DVI) -I $(shell cd $(<D) && pwd) --output=$@ \
149 $(shell cd $(<D) && pwd)/$<
151 $(objpfx)%.pdf: %.texinfo
152 cd $(objpfx);$(TEXI2PDF) -I $(shell cd $(<D) && pwd) --output=$@ \
153 $(shell cd $(<D) && pwd)/$<
156 # Distribution.
157 minimal-dist = summary.awk texis.awk tsort.awk libc-texinfo.sh libc.texinfo \
158 libm-err.texi stamp-libm-err check-safety.sh \
159 $(filter-out summary.texi, $(nonexamples)) \
160 $(patsubst %.c.texi,examples/%.c, $(examples))
162 indices = cp fn pg tp vr ky
163 generated-dirs += libc
164 generated += libc.dvi libc.pdf libc.tmp libc.info* \
165 stubs \
166 texis summary.texi stamp-summary *.c.texi \
167 $(foreach index,$(indices),libc.$(index) libc.$(index)s) \
168 libc.log libc.aux libc.toc \
169 $(libc-texi-generated) \
170 stamp-libm-err stamp-version
172 include ../Rules
174 .PHONY: install subdir_install install-data
175 install-data subdir_install: install
176 # libm-err.texi generation requires perl.
177 ifneq ($(PERL),no)
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 endif
186 # Catchall implicit rule for other installation targets from the parent.
187 install-%: ;
189 $(inst_infodir)/libc.info: $(objpfx)libc.info
190 $(make-target-directory)
191 for file in $<*; do \
192 $(INSTALL_DATA) $$file $(@D)/; \
193 done
195 TAGS: $(minimal-dist)
196 $(ETAGS) -o $@ $^