]> git.ipfire.org Git - thirdparty/glibc.git/blame - manual/Makefile
update from main archive 960906
[thirdparty/glibc.git] / manual / Makefile
CommitLineData
28f540f4
RM
1# Makefile for the GNU C Library manual.
2
be10a868 3# Copyright (C) 1992, 1993, 1994, 1995, 1996 Free Software Foundation, Inc.
28f540f4
RM
4# This file is part of the GNU C Library.
5
6# The GNU C Library is free software; you can redistribute it and/or
7# modify it under the terms of the GNU Library General Public License
8# as published by the Free Software Foundation; either version 2 of
9# the License, or (at your option) any later version.
10
11# The GNU C Library is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY; without even the implied warranty of
13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14# Library General Public License for more details.
15
16# You should have received a copy of the GNU Library General Public
17# License along with the GNU C Library; see the file COPYING.LIB. If
18# not, write to the Free Software Foundation, Inc., 675 Mass Ave,
19# Cambridge, MA 02139, USA.
20
21subdir := manual
22export subdir := $(subdir)
23
24.PHONY: all dvi info
25all: dvi info
26dvi: libc.dvi
27info: libc.info
28
29# Get glibc's configuration info.
30ifneq (,$(wildcard ../Makeconfig))
31include ../Makeconfig
32endif
33
34# Set chapters and chapters-incl.
e75154a6 35-include chapters
28f540f4
RM
36chapters: libc.texinfo
37 $(find-includes)
28f540f4 38ifdef chapters
08e5142a 39-include chapters-incl
28f540f4
RM
40chapters-incl: $(chapters)
41 $(find-includes)
53afa8d9 42chapters-incl := $(filter-out summary.texi,$(chapters-incl))
28f540f4
RM
43endif
44
45define find-includes
46(echo '$(@F) :=' \\ ;\
47 awk '$$1 == "@include" { print $$2 " \\" }' $^) > $@.new
48mv -f $@.new $@
49endef
50
51libc.dvi libc.info: $(chapters) summary.texi $(chapters-incl)
52libc.dvi: texinfo.tex
53
54# Generate the summary from the Texinfo source files for each chapter.
55summary.texi: stamp-summary ;
56stamp-summary: summary.awk $(chapters) $(chapters-incl)
57 awk -f $^ \
58 | sort -df +1 -2 | tr '\014' '\012' > summary-tmp
59 ./move-if-change summary-tmp summary.texi
60# touch is broken on our machines. Sigh.
61 date > $@
62
63# Generate Texinfo files from the C source for the example programs.
64%.c.texi: examples/%.c
65 sed -e 's,[{}],@&,g' \
66 -e 's,/\*\(@.*\)\*/,\1,g' \
67 -e 's,/\* *,/* @r{,g' -e 's, *\*/,} */,' \
68 -e 's/\(@[a-z][a-z]*\)@{\([^}]*\)@}/\1{\2}/'\
69 $< | expand > $@.new
70 mv -f $@.new $@
71
72
73minimal-dist = summary.awk move-if-change libc.texinfo $(chapters) \
74 $(patsubst %.c.texi,examples/%.c, \
75 $(filter-out summary.texi,$(chapters-incl)))
76doc-only-dist = Makefile COPYING.LIB mkinstalldirs
77distribute = $(minimal-dist) \
78 $(patsubst examples/%.c,%.c.texi,$(filter examples/%.c, \
79 $(minimal-dist))) \
80 libc.?? libc.??s texinfo.tex summary.texi \
81 stamp-summary chapters chapters-incl
82export distribute := $(distribute)
83
84tar-it = tar chovf $@ $^
85
86manual.tar: $(doc-only-dist) $(minimal-dist) ; $(tar-it)
87mandist.tar: $(doc-only-dist) $(distribute) ; $(tar-it)
88
89edition := $(shell sed -n 's/^@set EDITION \([0-9][0-9.]*\)[^0-9.]*.*$$/\1/p' \
90 libc.texinfo)
91
92glibc-doc-$(edition).tar: $(doc-only-dist) $(distribute)
93 @rm -f glibc-doc-$(edition)
94 ln -s . glibc-doc-$(edition)
95 tar chovf $@ $(addprefix glibc-doc-$(edition)/,$^)
96 rm -f glibc-doc-$(edition)
97
98%.Z: %
99 compress -c $< > $@.new
100 mv -f $@.new $@
101%.gz: %
102 gzip -9 -c $< > $@.new
103 mv -f $@.new $@
104%.uu: %
105 uuencode $< < $< > $@.new
106 mv -f $@.new $@
107
28f540f4
RM
108.PHONY: mostlyclean distclean realclean clean
109mostlyclean:
110 -rm -f libc.dvi libc.info*
111clean: mostlyclean
112distclean: clean
113indices = cp fn pg tp vr ky
114realclean: distclean
115 -rm -f chapters chapters-incl summary.texi stamp-summary *.c.texi
116 -rm -f $(foreach index,$(indices),libc.$(index) libc.$(index)s)
117 -rm -f libc.log libc.aux libc.toc
118
119.PHONY: install subdir_install installdirs install-data
120install-data subdir_install: install
121install: $(infodir)/libc.info
122# Catchall implicit rule for other installation targets from the parent.
123install-%: ;
124
28f540f4
RM
125$(infodir)/libc.info: libc.info installdirs
126 for file in $<*; do \
127 name=`basename $$file`; \
128 $(INSTALL_DATA) $$file \
129 `echo $@ | sed "s,$<\$$,$$name,"`; \
130 done
131
132installdirs: $(firstword $(wildcard mkinstalldirs ../mkinstalldirs))
133 $(dir $<)$(notdir $<) $(infodir)
134
135.PHONY: dist
136dist: # glibc-doc-$(edition).tar.gz
137
138ifneq (,$(wildcard ../Make-dist))
139dist: ../Make-dist
140 $(MAKE) -f $< $(Make-dist-args)
141endif
142
143ifndef ETAGS
144ETAGS = etags -T
145endif
146TAGS: $(minimal-dist)
147 $(ETAGS) -o $@ $^
be10a868 148\f
2064087b
RM
149# The parent makefile sometimes invokes us with targets `subdir_REAL-TARGET'.
150subdir_%: % ;
151# For targets we don't define, do nothing.
152subdir_%: ;
28f540f4 153
c928de79
RM
154# These are targets that each glibc subdirectory is expected to understand.
155# ../Rules defines them for code subdirectories; for us, they are no-ops.
391763e7
RM
156# None of these should be `subdir_TARGET'; those targets are transformed
157# by the implicit rule above into `TARGET' deps.
edf5b2d7 158glibc-targets := lib objects objs others tests lint.out \
391763e7 159 echo-headers echo-distinfo stubs
c928de79
RM
160.PHONY: $(glibc-targets)
161$(glibc-targets):
162
2064087b
RM
163# Create stamp files if they don't exist, so the parent makefile's rules for
164# updating the library archives are happy with us, and never think we have
165# changed the library.
2064087b 166lib: $(foreach o,$(object-suffixes),$(objpfx)stamp$o-$(subdir))
28f540f4 167stubs: $(common-objpfx)stub-manual
6e953631
UD
168$(common-objpfx)stub-manual ../po/manual.pot $(objpfx)stamp%-$(subdir):
169 $(make-target-directory)
170 cp /dev/null $@
171
172
173# Make the target directory if it doesn't exist, using the `mkinstalldirs'
174# script that does `mkdir -p' even if `mkdir' doesn't support that flag.
175define make-target-directory
176$(addprefix $(..)./mkinstalldirs ,\
177 $(filter-out $(wildcard $(@D:%/=%)),$(@D:%/=%)))
178endef
28f540f4
RM
179
180# The top-level glibc Makefile expects subdir_install to update the stubs file.
181subdir_install: stubs
be10a868 182\f
28f540f4
RM
183# Get rid of these variables if they came from the parent.
184routines =
185aux =
186sources =
187objects =
188headers =