1 # Copyright (C) 1992-2012
2 # Free Software Foundation, Inc.
3 # This file is part of the GNU C Library.
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.
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.
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/>.
19 # Makefile for the GNU C Library manual.
22 export subdir
:= $(subdir
)
25 INSTALL_INFO
= install-info
27 .PHONY
: all dvi pdf
info html
32 # Get glibc's configuration info.
36 TEXI2PDF
= texi2dvi --pdf
38 ifneq ($(strip $(MAKEINFO
)),:)
43 mkinstalldirs
= $(..
)scripts
/mkinstalldirs
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
56 texis
: texis.awk
$(chapters
) $(add-chapters
) $(appendices
) $(licenses
)
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
)))
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)' \
68 '$(appendices) $(licenses)'
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
74 libc.
dvi libc.pdf libc.
info: $(libc-texi-generated
)
75 libc.
dvi libc.pdf
: texinfo.
tex
78 libc
/index.html
: $(libc-texi-generated
)
79 $(MAKEINFO
) --html libc.texinfo
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
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
91 dir-add.texi
: xtract-typefun.awk
$(texis
)
92 (echo
"@dircategory GNU C library functions and macros"; \
94 $(AWK
) -f
$^ |
sort; \
95 echo
"@end direntry") > $@.new
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
))
103 $(PERL
) $< $$pwd/..
> libm-err-tmp
104 $(move-if-change
) libm-err-tmp libm-err.texi
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
114 # Generate Texinfo files from the C source for the example programs.
115 %.c.texi
: examples
/%.c
116 sed
-e
'1,/^\*\/$$/d' \
118 -e
's,/\*\(@.*\)\*/,\1,g' \
119 -e
's,/\* *,/* @r{,g' -e
's, *\*/,} */,' \
120 -e
's/\(@[a-z][a-z]*\)@{\([^}]*\)@}/\1{\2}/g'\
125 LANGUAGE
=C LC_ALL
=C
$(MAKEINFO
) $<
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
))
139 .PHONY
: mostlyclean distclean realclean clean
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)
146 indices
= cp fn pg tp vr ky
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
)
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;\
162 # Catchall implicit rule for other installation targets from the parent.
165 $(inst_infodir
)/libc.
info: libc.
info installdirs
166 for file in
$<*; do \
167 $(INSTALL_DATA
) $$file $(@D
)/$$file; \
171 $(mkinstalldirs
) $(inst_infodir
)
173 TAGS
: $(minimal-dist
)
176 # The parent makefile sometimes invokes us with targets `subdir_REAL-TARGET'.
178 # For targets we don't define, do nothing.
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
)
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)
195 stubs
: $(objpfx
)stubs
197 $(objpfx
)stubs ..
/po
/manual.pot
:
198 $(make-target-directory
)
201 $(make-target-directory
)
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
:%/=%)))
211 # The top-level glibc Makefile expects subdir_install to update the stubs file.
212 subdir_install
: stubs
214 # Get rid of these variables if they came from the parent.