]> git.ipfire.org Git - thirdparty/glibc.git/blob - manual/Makefile
Update.
[thirdparty/glibc.git] / manual / Makefile
1 # Copyright (C) 1992, 93, 94, 95, 96, 97, 98 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 Library General Public License
6 # as published by the Free Software Foundation; either version 2 of
7 # 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 # Library General Public License for more details.
13
14 # You should have received a copy of the GNU Library General Public
15 # License along with the GNU C Library; see the file COPYING.LIB. If not,
16 # write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 # Boston, MA 02111-1307, USA.
18
19 # Makefile for the GNU C Library manual.
20
21 subdir := manual
22 export subdir := $(subdir)
23
24 # We need GNU awk for the xtract-typefun script.
25 GAWK = gawk
26 # Allow override
27 INSTALL_INFO = install-info
28
29 .PHONY: all dvi info
30 all: dvi
31 dvi: libc.dvi
32
33 ifneq ($(strip $(MAKEINFO)),)
34 all: info
35 info: libc.info dir-add.info
36 endif
37
38 # Get glibc's configuration info.
39 ifneq (,$(wildcard ../Makeconfig))
40 include ../Makeconfig
41 endif
42
43 # Set chapters and chapters-incl[12].
44 -include chapters
45 chapters: libc.texinfo
46 $(find-includes)
47 ifdef chapters
48 # @includes in chapter files
49 -include chapters-incl1
50 chapters-incl1: $(chapters)
51 $(find-includes)
52 chapters-incl1 := $(filter-out summary.texi,$(chapters-incl1))
53 endif
54 ifdef chapters-incl1
55 # @includes in files included by chapter files, if any
56 -include chapters-incl2
57 chapters-incl2: $(chapters-incl1)
58 $(find-includes)
59 endif
60
61 chapters-incl := $(chapters-incl1) $(chapters-incl2)
62
63 define find-includes
64 (echo '$(@F) :=' \\ ;\
65 awk '$$1 == "@include" { print $$2 " \\" }' $^) > $@.new
66 mv -f $@.new $@
67 endef
68
69 libc.dvi libc.info: $(chapters) summary.texi $(chapters-incl)
70 libc.dvi: texinfo.tex
71
72 # Generate the summary from the Texinfo source files for each chapter.
73 summary.texi: stamp-summary ;
74 stamp-summary: summary.awk $(chapters) $(chapters-incl)
75 awk -f $^ \
76 | sort -df +1 -2 | tr '\014' '\012' > summary-tmp
77 ./move-if-change summary-tmp summary.texi
78 # touch is broken on our machines. Sigh.
79 date > $@
80
81 # Generate a file which can be added to the `dir' content to provide direct
82 # access to the documentation of the function, variables, and other
83 # definitions.
84 dir-add.texi: xtract-typefun.awk $(chapters) $(chapters-incl)
85 (echo "@dircategory GNU C library functions"; \
86 echo "@direntry"; \
87 $(GAWK) -f $^ | sort; \
88 echo "@end direntry";) > $@.new
89 mv -f $@.new $@
90
91 # Generate Texinfo files from the C source for the example programs.
92 %.c.texi: examples/%.c
93 sed -e 's,[{}],@&,g' \
94 -e 's,/\*\(@.*\)\*/,\1,g' \
95 -e 's,/\* *,/* @r{,g' -e 's, *\*/,} */,' \
96 -e 's/\(@[a-z][a-z]*\)@{\([^}]*\)@}/\1{\2}/g'\
97 $< | expand > $@.new
98 mv -f $@.new $@
99
100
101 minimal-dist = summary.awk move-if-change libc.texinfo $(chapters) \
102 $(patsubst %.c.texi,examples/%.c, \
103 $(filter-out summary.texi,$(chapters-incl)))
104 doc-only-dist = Makefile COPYING.LIB mkinstalldirs
105 distribute = $(minimal-dist) \
106 $(patsubst examples/%.c,%.c.texi,$(filter examples/%.c, \
107 $(minimal-dist))) \
108 libc.info* libc.?? libc.??s texinfo.tex summary.texi \
109 stamp-summary chapters chapters-incl1 chapters-incl2 \
110 xtract-typefun.awk dir-add.texi dir-add.info dir \
111 stdio-fp.c
112 export distribute := $(distribute)
113
114 tar-it = tar chovf $@ $^
115
116 manual.tar: $(doc-only-dist) $(minimal-dist) ; $(tar-it)
117 mandist.tar: $(doc-only-dist) $(distribute) ; $(tar-it)
118
119 edition := $(shell sed -n 's/^@set EDITION \([0-9][0-9.]*\)[^0-9.]*.*$$/\1/p' \
120 libc.texinfo)
121
122 glibc-doc-$(edition).tar: $(doc-only-dist) $(distribute)
123 @rm -f glibc-doc-$(edition)
124 ln -s . glibc-doc-$(edition)
125 tar chovf $@ $(addprefix glibc-doc-$(edition)/,$^)
126 rm -f glibc-doc-$(edition)
127
128 %.Z: %
129 compress -c $< > $@.new
130 mv -f $@.new $@
131 %.gz: %
132 gzip -9 -c $< > $@.new
133 mv -f $@.new $@
134 %.uu: %
135 uuencode $< < $< > $@.new
136 mv -f $@.new $@
137
138 .PHONY: mostlyclean distclean realclean clean
139 mostlyclean:
140 -rm -f libc.dvi libc.info* dir-add.info $(common-objpfx)stub-manual
141 -rm -f $(foreach o,$(object-suffixes),$(objpfx)stamp$o)
142 clean: mostlyclean
143 distclean: clean
144 indices = cp fn pg tp vr ky
145 realclean: distclean
146 -rm -f chapters chapters-incl* summary.texi stamp-summary *.c.texi
147 -rm -f $(foreach index,$(indices),libc.$(index) libc.$(index)s)
148 -rm -f libc.log libc.aux libc.toc dir-add.texi
149
150 .PHONY: install subdir_install installdirs install-data
151 install-data subdir_install: install
152 ifneq ($(strip $(MAKEINFO)),)
153 install: $(inst_infodir)/libc.info dir-add.info
154 @if $(SHELL) -c '$(INSTALL_INFO) --version' >/dev/null 2>&1; then \
155 test -f $(inst_infodir)/dir || cp dir $(inst_infodir);\
156 $(INSTALL_INFO) --info-dir=$(inst_infodir) $(inst_infodir)/libc.info;\
157 $(INSTALL_INFO) --info-dir=$(inst_infodir) dir-add.info;\
158 else : ; fi
159 endif
160 # Catchall implicit rule for other installation targets from the parent.
161 install-%: ;
162
163 $(inst_infodir)/libc.info: libc.info installdirs
164 for file in $<*; do \
165 name=`basename $$file`; \
166 $(INSTALL_DATA) $$file \
167 `echo $@ | sed "s,$<\$$,$$name,"`; \
168 done
169
170 installdirs: $(firstword $(wildcard mkinstalldirs ../mkinstalldirs))
171 $(dir $<)$(notdir $<) $(inst_infodir)
172
173 .PHONY: dist
174 dist: # glibc-doc-$(edition).tar.gz
175
176 ifneq (,$(wildcard ../Make-dist))
177 dist: ../Make-dist
178 $(MAKE) -f $< $(Make-dist-args)
179 endif
180
181 ifndef ETAGS
182 ETAGS = etags -T
183 endif
184 TAGS: $(minimal-dist)
185 $(ETAGS) -o $@ $^
186 \f
187 # The parent makefile sometimes invokes us with targets `subdir_REAL-TARGET'.
188 subdir_%: % ;
189 # For targets we don't define, do nothing.
190 subdir_%: ;
191
192 # These are targets that each glibc subdirectory is expected to understand.
193 # ../Rules defines them for code subdirectories; for us, they are no-ops.
194 # None of these should be `subdir_TARGET'; those targets are transformed
195 # by the implicit rule above into `TARGET' deps.
196 glibc-targets := lib objects objs others tests lint.out \
197 echo-headers echo-distinfo stubs
198 .PHONY: $(glibc-targets)
199 $(glibc-targets):
200
201 # Create stamp files if they don't exist, so the parent makefile's rules for
202 # updating the library archives are happy with us, and never think we have
203 # changed the library.
204 lib: $(foreach o,$(object-suffixes),$(objpfx)stamp$o)
205 stubs: $(common-objpfx)stub-manual
206 $(common-objpfx)stub-manual ../po/manual.pot $(objpfx)stamp%:
207 $(make-target-directory)
208 cp /dev/null $@
209
210
211 # Make the target directory if it doesn't exist, using the `mkinstalldirs'
212 # script that does `mkdir -p' even if `mkdir' doesn't support that flag.
213 define make-target-directory
214 $(addprefix $(..)./mkinstalldirs ,\
215 $(filter-out $(wildcard $(@D:%/=%)),$(@D:%/=%)))
216 endef
217
218 # The top-level glibc Makefile expects subdir_install to update the stubs file.
219 subdir_install: stubs
220 \f
221 # Get rid of these variables if they came from the parent.
222 routines =
223 aux =
224 sources =
225 objects =
226 headers =