Fix typo.
[glibc/history.git] / manual / Makefile
blob2314c0c93df67b4ff8cf6be0c95d6d310f18d7fd
1 # Copyright (C) 1992, 93, 94, 95, 96, 97, 98 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 # Allow override
25 INSTALL_INFO = install-info
27 .PHONY: all dvi info
28 all: dvi
29 dvi: libc.dvi
31 # Get glibc's configuration info.
32 ifneq (,$(wildcard ../Makeconfig))
33 include ../Makeconfig
34 else
35 MAKEINFO = makeinfo
36 TEXI2DVI = texi2dvi
37 endif
39 ifneq ($(strip $(MAKEINFO)),)
40 all: info
41 info: libc.info dir-add.info
42 endif
44 # scripts we use
45 ifndef move-if-change
46 move-if-change = ./move-if-change
47 endif
48 mkinstalldirs = $(..)scripts/mkinstalldirs
50 chapters = $(addsuffix .texi, \
51 intro errno memory ctype string mbyte locale \
52 message search pattern io stdio llio filesys \
53 pipe socket terminal math arith time setjmp \
54 signal startup process job nss users sysinfo conf)
55 add-chapters = $(wildcard $(foreach d, $(add-ons), ../$d/$d.texi))
56 appendices = lang.texi header.texi install.texi maint.texi contrib.texi
58 -include texis
59 texis: texis.awk $(chapters) $(add-chapters) $(appendices) lgpl.texinfo
60 $(AWK) -f $^ > $@.T
61 mv -f $@.T $@
63 nonexamples = $(filter-out $(add-chapters) %.c.texi, $(texis))
64 examples = $(filter %.c.texi, $(texis))
66 # Kludge: implicit rule so Make knows the one command does it all.
67 chapters.% top-menu.%: libc-texinfo.sh $(texis)
68 AWK=$(AWK) $(SHELL) $< '$(chapters)' '$(add-chapters)' '$(appendices)'
70 libc.dvi libc.info: chapters.texi top-menu.texi
71 libc.dvi: texinfo.tex
73 # Generate the summary from the Texinfo source files for each chapter.
74 summary.texi: stamp-summary ;
75 stamp-summary: summary.awk $(filter-out summary.texi, $(texis))
76 $(AWK) -f $^ | sort -df +1 -2 | tr '\014' '\012' > summary-tmp
77 $(move-if-change) summary-tmp summary.texi
78 touch $@
80 # Generate a file which can be added to the `dir' content to provide direct
81 # access to the documentation of the function, variables, and other
82 # definitions.
83 dir-add.texinfo: xtract-typefun.awk $(texis)
84 (echo "@dircategory GNU C library functions"; \
85 echo "@direntry"; \
86 $(AWK) -f $^; \
87 echo "@end direntry") > $@.new
88 mv -f $@.new $@
90 # Generate Texinfo files from the C source for the example programs.
91 %.c.texi: examples/%.c
92 sed -e 's,[{}],@&,g' \
93 -e 's,/\*\(@.*\)\*/,\1,g' \
94 -e 's,/\* *,/* @r{,g' -e 's, *\*/,} */,' \
95 -e 's/\(@[a-z][a-z]*\)@{\([^}]*\)@}/\1{\2}/g'\
96 $< | expand > $@.new
97 mv -f $@.new $@
99 %.info: %.texinfo
100 $(MAKEINFO) $<
102 %.dvi: %.texinfo
103 $(TEXI2DVI) $<
105 # Distribution.
106 minimal-dist = summary.awk texis.awk libc-texinfo.sh libc.texinfo \
107 $(filter-out summary.texi, $(nonexamples)) \
108 $(patsubst %.c.texi,examples/%.c, $(examples))
110 doc-only-dist = Makefile COPYING.LIB
111 distribute = $(minimal-dist) $(examples) texis stdio-fp.c \
112 libc.info* libc.?? libc.??s texinfo.tex stamp-summary \
113 xtract-typefun.awk dir-add.texinfo dir-add.info dir \
114 chapters.texi top-menu.texi summary.texi
115 export distribute := $(distribute)
117 tar-it = tar chovf $@ $^
119 manual.tar: $(doc-only-dist) $(minimal-dist) ; $(tar-it)
120 mandist.tar: $(doc-only-dist) $(distribute) ; $(tar-it)
122 edition := $(shell sed -n 's/^@set EDITION \([0-9][0-9.]*\)[^0-9.]*.*$$/\1/p' \
123 libc.texinfo)
125 glibc-doc-$(edition).tar: $(doc-only-dist) $(distribute)
126 @rm -f glibc-doc-$(edition)
127 ln -s . glibc-doc-$(edition)
128 tar chovf $@ $(addprefix glibc-doc-$(edition)/,$^)
129 rm -f glibc-doc-$(edition)
131 %.Z: %
132 compress -c $< > $@.new
133 mv -f $@.new $@
134 %.gz: %
135 gzip -9 -c $< > $@.new
136 mv -f $@.new $@
137 %.uu: %
138 uuencode $< < $< > $@.new
139 mv -f $@.new $@
141 .PHONY: mostlyclean distclean realclean clean
142 mostlyclean:
143 -rm -f libc.dvi libc.tmp libc.info* dir-add.info
144 -rm -f $(objpfx)stubs $(objpfx)distinfo
145 -rm -f $(foreach o,$(object-suffixes-for-libc),$(objpfx)stamp$o)
146 clean: mostlyclean
147 distclean: clean
148 indices = cp fn pg tp vr ky
149 realclean: distclean
150 -rm -f texis summary.texi stamp-summary *.c.texi
151 -rm -f $(foreach index,$(indices),libc.$(index) libc.$(index)s)
152 -rm -f libc.log libc.aux libc.toc dir-add.texinfo
153 -rm -f top-menu.texi chapters.texi
155 .PHONY: install subdir_install installdirs install-data
156 install-data subdir_install: install
157 ifneq ($(strip $(MAKEINFO)),)
158 install: $(inst_infodir)/libc.info dir-add.info
159 @if $(SHELL) -c '$(INSTALL_INFO) --version' >/dev/null 2>&1; then \
160 test -f $(inst_infodir)/dir || cp dir $(inst_infodir);\
161 $(INSTALL_INFO) --info-dir=$(inst_infodir) $(inst_infodir)/libc.info;\
162 $(INSTALL_INFO) --info-dir=$(inst_infodir) dir-add.info;\
163 else : ; fi
164 endif
165 # Catchall implicit rule for other installation targets from the parent.
166 install-%: ;
168 $(inst_infodir)/libc.info: libc.info installdirs
169 for file in $<*; do \
170 $(INSTALL_DATA) $$file $(@D)/$$file; \
171 done
173 installdirs:
174 $(mkinstalldirs) $(inst_infodir)
176 .PHONY: dist
177 dist: # glibc-doc-$(edition).tar.gz
179 ifneq (,$(wildcard ../Make-dist))
180 dist: ../Make-dist
181 $(MAKE) -f $< $(Make-dist-args)
182 endif
184 ifndef ETAGS
185 ETAGS = etags -T
186 endif
187 TAGS: $(minimal-dist)
188 $(ETAGS) -o $@ $^
190 # The parent makefile sometimes invokes us with targets `subdir_REAL-TARGET'.
191 subdir_%: % ;
192 # For targets we don't define, do nothing.
193 subdir_%: ;
195 # These are targets that each glibc subdirectory is expected to understand.
196 # ../Rules defines them for code subdirectories; for us, they are no-ops.
197 # None of these should be `subdir_TARGET'; those targets are transformed
198 # by the implicit rule above into `TARGET' deps.
199 glibc-targets := lib objects objs others tests lint.out \
200 echo-headers echo-distinfo
201 .PHONY: $(glibc-targets)
202 $(glibc-targets):
204 # Create stamp files if they don't exist, so the parent makefile's rules for
205 # updating the library archives are happy with us, and never think we have
206 # changed the library.
207 lib: $(foreach o,$(object-suffixes-for-libc),$(objpfx)stamp$o)
208 ifdef objpfx
209 .PHONY: stubs
210 stubs: $(objpfx)stubs
211 endif
212 $(objpfx)stubs ../po/manual.pot $(objpfx)stamp%:
213 $(make-target-directory)
214 touch $@
216 # Make the target directory if it doesn't exist, using the `mkinstalldirs'
217 # script that does `mkdir -p' even if `mkdir' doesn't support that flag.
218 define make-target-directory
219 $(addprefix $(mkinstalldirs) ,\
220 $(filter-out $(wildcard $(@D:%/=%)),$(@D:%/=%)))
221 endef
223 # The top-level glibc Makefile expects subdir_install to update the stubs file.
224 subdir_install: stubs
226 # Get rid of these variables if they came from the parent.
227 routines =
228 aux =
229 sources =
230 objects =
231 headers =