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