sysconf: Add _SC_MINSIGSTKSZ/_SC_SIGSTKSZ [BZ #20305]
[platform/upstream/glibc.git] / manual / Makefile
1 # Copyright (C) 1992-2021 Free Software Foundation, Inc.
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
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.
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
12 # Lesser General Public License for more details.
13
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 # <https://www.gnu.org/licenses/>.
17
18 # Makefile for the GNU C Library manual.
19
20 subdir := manual
21
22 include ../Makeconfig
23
24 .PHONY: dvi pdf info html
25
26 dvi: $(objpfx)libc.dvi
27 pdf: $(objpfx)libc.pdf
28
29 TEXI2DVI = texi2dvi
30 TEXI2PDF = texi2dvi --pdf
31
32 ifneq ($(strip $(MAKEINFO)),:)
33 info: $(objpfx)libc.info
34 endif
35
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 appendices = lang.texi header.texi install.texi maint.texi platform.texi \
44              contrib.texi
45 licenses = freemanuals.texi lgpl-2.1.texi fdl-1.3.texi
46
47 -include $(objpfx)texis
48 $(objpfx)texis: texis.awk $(chapters) $(appendices) $(licenses)
49         $(make-target-directory)
50         $(AWK) -f $^ > $@.T
51         mv -f $@.T $@
52
53 nonexamples = $(filter-out %.c.texi, $(texis))
54 examples = $(filter %.c.texi, $(texis))
55
56 # Generated files directly included from libc.texinfo.
57 libc-texi-generated = chapters.texi top-menu.texi dir-add.texi \
58                       libm-err.texi version.texi pkgvers.texi
59
60 # Add path to build dir for generated files
61 texis-path := $(filter-out $(libc-texi-generated) summary.texi $(examples), \
62                                 $(texis))                                   \
63          $(addprefix $(objpfx),$(filter $(libc-texi-generated) summary.texi \
64                                         $(examples), $(texis)))
65
66 # Kludge: implicit rule so Make knows the one command does it all.
67 chapters.% top-menu.%: libc-texinfo.sh $(texis-path) Makefile
68         AWK=$(AWK) $(SHELL) $< $(objpfx) \
69                                 '$(chapters)' \
70                                '$(appendices) $(licenses)'
71
72
73 $(objpfx)libc.dvi $(objpfx)libc.pdf $(objpfx)libc.info: \
74         $(addprefix $(objpfx),$(libc-texi-generated))
75 $(objpfx)libc.dvi $(objpfx)libc.pdf: texinfo.tex
76
77 html: $(objpfx)libc/index.html
78 $(objpfx)libc/index.html: $(addprefix $(objpfx),$(libc-texi-generated))
79         $(MAKEINFO) -P $(objpfx) -o $(objpfx)libc --html libc.texinfo
80
81 # Generate the summary from the Texinfo source files for each chapter.
82 $(objpfx)summary.texi: $(objpfx)stamp-summary ;
83 $(objpfx)stamp-summary: summary.pl $(filter-out $(objpfx)summary.texi, \
84                                         $(texis-path))
85         $(SHELL) ./check-safety.sh $(filter-out $(objpfx)%, $(texis-path))
86         LC_ALL=C $(PERL) $^ > $(objpfx)summary-tmp
87         $(move-if-change) $(objpfx)summary-tmp $(objpfx)summary.texi
88         touch $@
89
90 # Generate a file which can be added to the `dir' content to provide direct
91 # access to the documentation of the function, variables, and other
92 # definitions.
93 $(objpfx)dir-add.texi: xtract-typefun.awk $(texis-path)
94         (echo "@dircategory GNU C library functions and macros";        \
95          echo "@direntry";                                              \
96          $(AWK) -f $^ | sort;                                           \
97          echo "@end direntry") > $@.new
98         mv -f $@.new $@
99
100 # The table with the math errors is generated.
101 $(objpfx)libm-err.texi: $(objpfx)stamp-libm-err
102 $(objpfx)stamp-libm-err: $(..)math/gen-libm-test.py \
103                          $(wildcard $(foreach dir,$(sysdirs),\
104                                                   $(dir)/libm-test-ulps))
105         pwd=`pwd`; \
106         $(PYTHON) $< -s $$pwd/.. -m $(objpfx)libm-err-tmp
107         $(move-if-change) $(objpfx)libm-err-tmp $(objpfx)libm-err.texi
108         touch $@
109
110 # Package version and bug reporting URL.
111 $(objpfx)pkgvers.texi: $(objpfx)stamp-pkgvers ;
112 $(objpfx)stamp-pkgvers: $(common-objpfx)config.make
113         echo "@ifclear PKGVERS" > $(objpfx)pkgvers-tmp
114         echo "@set PKGVERS" >> $(objpfx)pkgvers-tmp
115         echo "@set PKGVERSION $(PKGVERSION_TEXI)" >> $(objpfx)pkgvers-tmp
116         if [ "$(PKGVERSION_TEXI)" = "(GNU libc) " ]; then \
117           echo "@set PKGVERSION_DEFAULT" >> $(objpfx)pkgvers-tmp; \
118         fi
119         echo "@set REPORT_BUGS_TO $(REPORT_BUGS_TEXI)" >> $(objpfx)pkgvers-tmp
120         echo "@end ifclear" >> $(objpfx)pkgvers-tmp
121         $(move-if-change) $(objpfx)pkgvers-tmp $(objpfx)pkgvers.texi
122         touch $@
123
124 # Generate a file with the version number.
125 $(objpfx)version.texi: $(objpfx)stamp-version ;
126 $(objpfx)stamp-version: $(common-objpfx)config.make
127         echo "@set VERSION $(version)" > $(objpfx)version-tmp
128         $(move-if-change) $(objpfx)version-tmp $(objpfx)version.texi
129         touch $@
130
131 # Generate Texinfo files from the C source for the example programs.
132 $(objpfx)%.c.texi: examples/%.c
133         sed -e '1,/^\*\/$$/d'                           \
134             -e 's,[{}],@&,g'                            \
135             -e 's,/\*\(@.*\)\*/,\1,g'                   \
136             -e 's,/\*  *,/* @r{,g' -e 's,  *\*/,} */,'  \
137             -e 's/\(@[a-z][a-z]*\)@{\([^}]*\)@}/\1{\2}/g'\
138             $< | expand > $@.new
139         mv -f $@.new $@
140
141 $(objpfx)%.info: %.texinfo
142         LANGUAGE=C LC_ALL=C $(MAKEINFO) -P $(objpfx) --output=$@ $<
143
144 $(objpfx)%.dvi: %.texinfo
145         cd $(objpfx);$(TEXI2DVI) -I $(shell cd $(<D) && pwd) --output=$@ \
146                                 $(shell cd $(<D) && pwd)/$<
147
148 $(objpfx)%.pdf: %.texinfo
149         cd $(objpfx);$(TEXI2PDF) -I $(shell cd $(<D) && pwd) --output=$@ \
150                                 $(shell cd $(<D) && pwd)/$<
151
152
153 # Distribution.
154 minimal-dist = summary.pl texis.awk tsort.awk libc-texinfo.sh libc.texinfo \
155                libm-err.texi stamp-libm-err check-safety.sh                 \
156                $(filter-out summary.texi, $(nonexamples))                   \
157                $(patsubst %.c.texi,examples/%.c, $(examples))
158
159 indices = cp fn pg tp vr ky
160 generated-dirs += libc
161 generated += libc.dvi libc.pdf libc.tmp libc.info*                            \
162              stubs                                                            \
163              texis summary.texi stamp-summary *.c.texi                        \
164              $(foreach index,$(indices),libc.$(index) libc.$(index)s)         \
165              libc.log libc.aux libc.toc                                       \
166              $(libc-texi-generated)                                           \
167              stamp-libm-err stamp-version
168
169 include ../Rules
170
171 .PHONY: install subdir_install install-data
172 install-data subdir_install: install
173 # Generated files requiring python: libm-err.texi
174 # Generated files requiring perl: summary.texi
175 ifneq ($(PERL),no)
176 ifneq ($(strip $(MAKEINFO)),:)
177 install: $(inst_infodir)/libc.info
178         @if $(SHELL) -c '$(INSTALL_INFO) --version' >/dev/null 2>&1; then \
179          test -f $(inst_infodir)/dir || $(INSTALL_DATA) dir $(inst_infodir);\
180          $(INSTALL_INFO) --info-dir=$(inst_infodir) $(inst_infodir)/libc.info;\
181         else : ; fi
182 endif
183 endif
184 # Catchall implicit rule for other installation targets from the parent.
185 install-%: ;
186
187 $(inst_infodir)/libc.info: $(objpfx)libc.info
188         $(make-target-directory)
189         for file in $<*; do \
190           $(INSTALL_DATA) $$file $(@D)/; \
191         done
192
193 TAGS: $(minimal-dist)
194         $(ETAGS) -o $@ $^