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