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.
24 INSTALL_INFO
= install-info
26 .PHONY
: dvi pdf
info html
28 # Get glibc's configuration info.
31 dvi: $(objpfx
)libc.
dvi
32 pdf
: $(objpfx
)libc.pdf
35 TEXI2PDF
= texi2dvi --pdf
37 ifneq ($(strip $(MAKEINFO
)),:)
38 info: $(objpfx
)libc.
info
41 chapters
= $(addsuffix .texi
, \
42 intro errno memory ctype string charset locale \
43 message search pattern io stdio llio filesys \
44 pipe socket terminal syslog math arith time \
45 resource setjmp signal startup process job nss \
46 users sysinfo conf crypt debug
)
47 add-chapters
= $(wildcard $(foreach d
, $(add-ons
), ..
/$d/$d.texi
))
48 appendices
= lang.texi header.texi
install.texi maint.texi 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
)
56 nonexamples
= $(filter-out $(add-chapters
) %.c.texi
, $(texis
))
57 examples
= $(filter-out $(foreach d
, $(add-ons
), ..
/$d/%.c.texi
), \
58 $(filter %.c.texi
, $(texis
)))
60 # Generated files directly included from libc.texinfo.
61 libc-texi-generated
= chapters.texi top-menu.texi dir-add.texi \
62 libm-err.texi version.texi
64 # Add path to build dir for generated files
65 texis-path
:= $(filter-out $(libc-texi-generated
) summary.texi
$(examples
), \
67 $(addprefix $(objpfx
),$(filter $(libc-texi-generated
) summary.texi \
68 $(examples
), $(texis
)))
70 # Kludge: implicit rule so Make knows the one command does it all.
71 chapters.
% top-menu.
%: libc-texinfo.sh
$(texis-path
) Makefile
72 AWK
=$(AWK
) $(SHELL
) $< $(objpfx
) \
75 '$(appendices) $(licenses)'
78 $(objpfx
)libc.
dvi $(objpfx
)libc.pdf
$(objpfx
)libc.
info: \
79 $(addprefix $(objpfx
),$(libc-texi-generated
))
80 $(objpfx
)libc.
dvi $(objpfx
)libc.pdf
: texinfo.
tex
82 html
: $(objpfx
)libc
/index.html
83 $(objpfx
)libc
/index.html
: $(addprefix $(objpfx
),$(libc-texi-generated
))
84 $(MAKEINFO
) -P
$(objpfx
) -o
$(objpfx
)libc
--html libc.texinfo
86 # Generate the summary from the Texinfo source files for each chapter.
87 $(objpfx
)summary.texi
: $(objpfx
)stamp-summary
;
88 $(objpfx
)stamp-summary
: summary.awk
$(filter-out $(objpfx
)summary.texi
, \
90 $(AWK
) -f
$^ |
sort -t
'\f' -df
-k
1,1 | tr
'\014' '\012' \
91 > $(objpfx
)summary-tmp
92 $(move-if-change
) $(objpfx
)summary-tmp
$(objpfx
)summary.texi
95 # Generate a file which can be added to the `dir' content to provide direct
96 # access to the documentation of the function, variables, and other
98 $(objpfx
)dir-add.texi
: xtract-typefun.awk
$(texis-path
)
99 (echo
"@dircategory GNU C library functions and macros"; \
101 $(AWK
) -f
$^ |
sort; \
102 echo
"@end direntry") > $@.new
105 # The table with the math errors is generated.
106 $(objpfx
)libm-err.texi
: $(objpfx
)stamp-libm-err
107 $(objpfx
)stamp-libm-err
: libm-err-tab.pl
$(wildcard $(foreach dir,$(sysdirs
),\
108 $(dir)/libm-test-ulps
))
110 $(PERL
) $< $$pwd/..
> $(objpfx
)libm-err-tmp
111 $(move-if-change
) $(objpfx
)libm-err-tmp
$(objpfx
)libm-err.texi
114 # Generate a file with the version number.
115 $(objpfx
)version.texi
: $(objpfx
)stamp-version
;
116 $(objpfx
)stamp-version
: $(common-objpfx
)config.make
117 echo
"@set VERSION $(version)" > $(objpfx
)version-tmp
118 $(move-if-change
) $(objpfx
)version-tmp
$(objpfx
)version.texi
121 # Generate Texinfo files from the C source for the example programs.
122 $(objpfx
)%.c.texi
: examples
/%.c
123 sed
-e
'1,/^\*\/$$/d' \
125 -e
's,/\*\(@.*\)\*/,\1,g' \
126 -e
's,/\* *,/* @r{,g' -e
's, *\*/,} */,' \
127 -e
's/\(@[a-z][a-z]*\)@{\([^}]*\)@}/\1{\2}/g'\
131 $(objpfx
)%.
info: %.texinfo
132 LANGUAGE
=C LC_ALL
=C
$(MAKEINFO
) -P
$(objpfx
) --output
=$@
$<
134 $(objpfx
)%.
dvi: %.texinfo
135 cd
$(objpfx
);$(TEXI2DVI
) -I
$(shell cd
$(<D
) && pwd
) --output
=$@ \
136 $(shell cd
$(<D
) && pwd
)/$<
138 $(objpfx
)%.pdf
: %.texinfo
139 cd
$(objpfx
);$(TEXI2PDF
) -I
$(shell cd
$(<D
) && pwd
) --output
=$@ \
140 $(shell cd
$(<D
) && pwd
)/$<
144 minimal-dist
= summary.awk texis.awk tsort.awk libc-texinfo.sh libc.texinfo \
145 libm-err.texi stamp-libm-err \
146 $(filter-out summary.texi
, $(nonexamples
)) \
147 $(patsubst %.c.texi
,examples
/%.c
, $(examples
))
149 indices
= cp fn pg tp vr ky
150 generated-dirs
:= libc
151 generated
= libc.
dvi libc.pdf libc.tmp libc.
info* \
153 texis summary.texi stamp-summary
*.c.texi \
154 $(foreach index
,$(indices
),libc.
$(index
) libc.
$(index
)s
) \
155 libc.log libc.aux libc.toc \
156 $(libc-texi-generated
) \
157 stamp-libm-err stamp-version
161 .PHONY
: install subdir_install install-data
162 install-data subdir_install
: install
163 ifneq ($(strip $(MAKEINFO
)),:)
164 install: $(inst_infodir
)/libc.
info
165 @if
$(SHELL
) -c
'$(INSTALL_INFO) --version' >/dev
/null
2>&1; then \
166 test -f
$(inst_infodir
)/dir ||
$(INSTALL_DATA
) dir $(inst_infodir
);\
167 $(INSTALL_INFO
) --info-dir
=$(inst_infodir
) $(inst_infodir
)/libc.
info;\
170 # Catchall implicit rule for other installation targets from the parent.
173 $(inst_infodir
)/libc.
info: $(objpfx
)libc.
info
174 $(make-target-directory
)
175 for file in
$<*; do \
176 $(INSTALL_DATA
) $$file $(@D
)/; \
179 TAGS
: $(minimal-dist
)