]> git.ipfire.org Git - thirdparty/glibc.git/blame - Makefile
Update.
[thirdparty/glibc.git] / Makefile
CommitLineData
379bb425 1# Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 98 Free Software Foundation, Inc.
28f540f4
RM
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 as
6# published by the Free Software Foundation; either version 2 of the
7# 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
2c6fe0bd
UD
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.
28f540f4
RM
18
19#
20# Master Makefile for the GNU C library
21#
22ifneq (,)
23This makefile requires GNU Make.
24endif
25
aa802e96
UD
26include Makeconfig
27
28f540f4
RM
28
29# This is the default target; it makes everything except the tests.
30.PHONY: all
edf5b2d7 31all: lib others
28f540f4 32\f
4d06461a 33ifeq ($(with-cvs),yes)
28f540f4 34define autoconf-it
587dbc6f 35@-rm -f $@.new
28f540f4 36autoconf $(ACFLAGS) $< > $@.new
587dbc6f 37chmod a-w,a+x $@.new
28f540f4 38mv -f $@.new $@
379bb425 39test ! -d CVS || cvs $(CVSOPTS) commit -m'Regenerated: autoconf $(ACFLAGS) $<' $@
28f540f4 40endef
4d06461a
UD
41else
42define autoconf-it
43@-rm -f $@.new
44autoconf $(ACFLAGS) $< > $@.new
45chmod a-w,a+x $@.new
46mv -f $@.new $@
47endef
48endif
28f540f4 49
dbdb6189
RM
50configure: configure.in aclocal.m4; $(autoconf-it)
51%/configure: %/configure.in aclocal.m4; $(autoconf-it)
28f540f4 52
28f540f4 53# These are the targets that are made by making them in each subdirectory.
edf5b2d7
UD
54+subdir_targets := subdir_lib objects objs others subdir_mostlyclean \
55 subdir_clean subdir_distclean subdir_realclean \
56 tests subdir_lint.out \
6a441471 57 subdir_distinfo \
28f540f4 58 subdir_echo-headers subdir_echo-distinfo \
57ba7bb4
UD
59 subdir_install \
60 $(addprefix install-, no-libc.a bin lib data headers others)
28f540f4 61\f
5107cf1d 62headers := errno.h sys/errno.h bits/errno.h limits.h values.h \
dc30f461
UD
63 features.h gnu-versions.h bits/libc-lock.h bits/xopen_lim.h \
64 gnu/libc-version.h
28f540f4
RM
65
66echo-headers: subdir_echo-headers
67
762a2918
UD
68# The headers are in the include directory.
69subdir-dirs = include
70vpath %.h $(subdir-dirs)
71
28f540f4 72# What to install.
8d57beea 73install-others = $(inst_includedir)/gnu/stubs.h
56552e42
UD
74install-bin = glibcbug
75
a18f587d 76ifeq (yes,$(build-shared))
c0e45674 77install-others += $(inst_includedir)/gnu/lib-names.h
a18f587d 78endif
28f540f4 79
28f540f4
RM
80include Makerules
81
737547be
UD
82ifeq ($(build-programs),yes)
83others: $(addprefix $(objpfx),$(install-bin))
84endif
85
28f540f4
RM
86# Install from subdirectories too.
87install: subdir_install
8d57beea 88
9756dfe1 89# Make sure that the dynamic linker is installed before libc.
da2d1bc5
UD
90$(inst_slibdir)/libc-$(version).so: elf/ldso_install
91
92.PHONY: elf/ldso_install
93elf/ldso_install:
94 $(MAKE) -C $(@D) $(@F)
9756dfe1 95
6973fc01 96# Create links for shared libraries using the `ldconfig' program is possible.
7cc27f44 97# Ignore the error if we cannot update /etc/ld.so.cache.
1ef32c3d
UD
98ifeq (no,$(cross-compiling))
99ifeq (yes,$(build-shared))
8d57beea 100install:
7cc27f44 101 -test ! -x $(common-objpfx)elf/ldconfig || \
1228ed5c 102 $(common-objpfx)elf/ldconfig -d $(inst_slibdir) $(inst_libdir)
cc3fa755
UD
103ifneq (no,$(PERL))
104ifeq (/usr,$(prefix))
105ifeq (,$(install_root))
5bc2f642 106 CC="$(CC)" $(PERL) scripts/test-installation.pl $(common-objpfx)
cc3fa755
UD
107endif
108endif
109endif
1ef32c3d
UD
110endif
111endif
28f540f4 112
01a36ad3
RM
113# Build subdirectory lib objects.
114lib-noranlib: subdir_lib
28f540f4 115
01a36ad3
RM
116ifeq (yes,$(build-shared))
117# Build the shared object from the PIC object library.
118lib: $(common-objpfx)libc.so
119endif
28f540f4 120\f
97a47867
UD
121# Makerules creates a file `stubs' in each subdirectory, which
122# contains `#define __stub_FUNCTION' for each function defined in that
123# directory which is a stub.
6bc31da0 124# Here we paste all of these together into <gnu/stubs.h>.
28f540f4 125
97a47867 126subdir-stubs := $(foreach dir,$(subdirs),$(common-objpfx)$(dir)/stubs)
28f540f4
RM
127
128# Since stubs.h is never needed when building the library, we simplify the
129# hairy installation process by producing it in place only as the last part
b9b49b44
UD
130# of the top-level `make install'. It depends on subdir_install, which
131# iterates over all the subdirs; subdir_install in each subdir depends on
132# the subdir's stubs file. Having more direct dependencies would result in
133# extra iterations over the list for subdirs and many recursive makes.
134$(inst_includedir)/gnu/stubs.h: subdir_install
5107cf1d 135 $(make-target-directory)
28f540f4
RM
136 @rm -f $(objpfx)stubs.h
137 (echo '/* This file is automatically generated.';\
138 echo ' It defines a symbol `__stub_FUNCTION'\'' for each function';\
139 echo ' in the C library which is a stub, meaning it will fail';\
140 echo ' every time called, usually setting errno to ENOSYS. */';\
b9b49b44 141 sort $(subdir-stubs)) > $(objpfx)stubs.h
13a0be88 142 if test -r $@ && cmp -s $(objpfx)stubs.h $@; \
ba1ffaa1 143 then echo 'stubs.h unchanged'; \
d36e7692 144 else $(INSTALL_DATA) $(objpfx)stubs.h $@; fi
28f540f4
RM
145 rm -f $(objpfx)stubs.h
146\f
8a523922 147ifeq (yes,$(build-shared))
afd4eb37 148
73237de3 149$(inst_includedir)/gnu/lib-names.h: $(common-objpfx)gnu/lib-names.h $(+force)
5107cf1d 150 $(make-target-directory)
56552e42
UD
151 if test -r $@ && cmp -s $< $@; \
152 then echo 'gnu/lib-names.h unchanged'; \
153 else $(INSTALL_DATA) $< $@; fi
afd4eb37 154endif
ba1ffaa1 155\f
df4ef2ab
UD
156# The `glibcbug' script contains the version number and it shall be rebuild
157# whenever this changes or the `glibcbug.in' file.
5290baf0 158$(objpfx)glibcbug: $(common-objpfx)config.status glibcbug.in
af3878df 159 cd $(<D) && CONFIG_FILES=$(@F) CONFIG_HEADERS= $(SHELL) $(<F)
df4ef2ab 160\f
28f540f4
RM
161# This makes the Info or DVI file of the documentation from the Texinfo source.
162.PHONY: info dvi
163info dvi:
c0e45674 164 $(MAKE) $(PARALLELMFLAGS) -C manual $@
28f540f4
RM
165\f
166# This makes all the subdirectory targets.
167
168# For each target, make it depend on DIR/target for each subdirectory DIR.
169$(+subdir_targets): %: $(addsuffix /%,$(subdirs))
170
171# Compute a list of all those targets.
172all-subdirs-targets := $(foreach dir,$(subdirs),\
173 $(addprefix $(dir)/,$(+subdir_targets)))
174
175# The action for each of those is to cd into the directory and make the
176# target there.
177$(all-subdirs-targets):
c0e45674 178 $(MAKE) $(PARALLELMFLAGS) -C $(@D) $(@F)
28f540f4
RM
179
180.PHONY: $(+subdir_targets) $(all-subdirs-targets)
181\f
182# Targets to clean things up to various degrees.
183
184.PHONY: clean realclean distclean distclean-1 parent-clean parent-mostlyclean
185
186# Subroutines of all cleaning targets.
187parent-mostlyclean: common-mostlyclean # common-mostlyclean is in Makerules.
4ddde9ee 188 -rm -f $(foreach o,$(object-suffixes-for-libc),\
60092701
RM
189 $(common-objpfx)$(patsubst %,$(libtype$o),c)) \
190 $(addprefix $(objpfx),$(install-lib))
28f540f4 191parent-clean: parent-mostlyclean common-clean
da2d1bc5
UD
192
193postclean = $(addprefix $(common-objpfx),$(postclean-generated)) \
4ddde9ee
UD
194 $(addprefix $(objpfx),sysd-Makefile sysd-dirs sysd-rules) \
195 $(objpfx)soversions.mk
28f540f4
RM
196
197clean: parent-clean
198# This is done this way rather than having `subdir_clean' be a
199# dependency of this target so that libc.a will be removed before the
200# subdirectories are dealt with and so they won't try to remove object
201# files from it when it's going to be removed anyway.
202 @$(MAKE) subdir_clean no_deps=t
203mostlyclean: parent-mostlyclean
204 @$(MAKE) subdir_mostlyclean no_deps=t
da2d1bc5 205 -rm -f $(postclean)
28f540f4
RM
206
207# The realclean target is just like distclean for the parent, but we want
208# the subdirs to know the difference in case they care.
209realclean distclean: parent-clean
210# This is done this way rather than having `subdir_distclean' be a
211# dependency of this target so that libc.a will be removed before the
212# subdirectories are dealt with and so they won't try to remove object
213# files from it when it's going to be removed anyway.
da2d1bc5
UD
214 @$(MAKE) distclean-1 no_deps=t distclean-1=$@ avoid-generated=yes \
215 sysdep-subdirs="$(sysdep-subdirs)"
216 -rm -f $(postclean)
28f540f4
RM
217
218# Subroutine of distclean and realclean.
219distclean-1: subdir_$(distclean-1)
220 -rm -f $(config-generated)
60092701
RM
221 -rm -f $(addprefix $(objpfx),config.status config.cache config.log)
222 -rm -f $(addprefix $(objpfx),config.make config-name.h config.h)
9a0a462c 223 -rm -f $(addprefix $(objpfx),glibcbug)
28f540f4
RM
224ifdef objdir
225 -rm -f $(objpfx)Makefile
226endif
227 -rm -f $(sysdep-$(distclean-1))
228\f
229.PHONY: echo_subdirs
230echo_subdirs:;@echo '$(subdirs)'
231
232.PHONY: echo-distinfo parent_echo-distinfo
233echo-distinfo: parent_echo-distinfo subdir_echo-distinfo
234parent_echo-distinfo:
235 @echo $(addprefix +header+,$(headers)) \
236 $(addprefix +nodist+,$(generated))
6a441471 237
2f6d1f1b 238\f
28f540f4
RM
239# Make the distribution tarfile.
240
a709dd43
UD
241distribute := README README.libm INSTALL FAQ FAQ.in NOTES NEWS BUGS \
242 PROJECTS COPYING.LIB COPYING ChangeLog ChangeLog.[0-9] \
5bc2f642
UD
243 Makefile Makeconfig Makerules Rules Make-dist MakeTAGS \
244 extra-lib.mk o-iterator.mk libc.map configure \
245 configure.in aclocal.m4 config.h.in config.make.in \
246 config-name.in Makefile.in sysdep.h set-hooks.h \
247 libc-symbols.h version.h shlib-versions rpm/Makefile \
248 rpm/template rpm/rpmrc glibcbug.in abi-tags stub-tag.h \
249 test-skeleton.c include/des.h \
250 $(addprefix scripts/, \
a709dd43
UD
251 rellns-sh config.sub config.guess \
252 mkinstalldirs move-if-change install-sh \
253 test-installation.pl gen-FAQ.pl)
28f540f4
RM
254
255distribute := $(strip $(distribute))
c7562c74 256generated := $(generated) stubs.h
28f540f4 257
8d57beea 258README: README.template version.h ; # Make-dist should update README.
28f540f4
RM
259
260define format-me
261@rm -f $@
262makeinfo --no-validate --no-warn --no-headers $< -o $@
263-chmod a-w $@
264endef
a35cb74d 265INSTALL: manual/install.texi; $(format-me)
28f540f4 266NOTES: manual/creature.texi; $(format-me)
714a562f 267manual/dir-add.texi manual/dir-add.info: FORCE
fe7bdd63 268 $(MAKE) $(PARALLELMFLAGS) -C $(@D) $(@F)
5bc2f642 269FAQ: scripts/gen-FAQ.pl FAQ.in
61952351 270 $(PERL) $^ > $@.new && rm -f $@ && mv $@.new $@ && chmod a-w $@
a35cb74d
UD
271ifeq ($(with-cvs),yes)
272 test ! -d CVS || cvs $(CVSOPTS) commit -m'Regenerated: $(PERL) $^' $@
273endif
f671aeab 274FORCE:
6a441471
RM
275
276rpm/%: subdir_distinfo
a709dd43 277 $(MAKE) $(PARALLELMFLAGS) -C $(@D) $(@F)
33a934a3 278
f4017d20
UD
279iconvdata/%:
280 $(MAKE) $(PARALLELMFLAGS) -C $(@D) $(@F)
281
33a934a3
UD
282# This is a special goal for people making binary distributions. Normally
283# everybody uses the DES based crypt library but for the distribution we
284# need the only-MD5 based one as well.
285md5-crypt/libmd5crypt:
c0e45674 286 $(MAKE) $(PARALLELMFLAGS) -C $(@D) $(@F)