]> git.ipfire.org Git - thirdparty/glibc.git/blame - Makefile
Update.
[thirdparty/glibc.git] / Makefile
CommitLineData
dabb1db4 1# Copyright (C) 1991-1999, 2000, 2001 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
41bdb6e2
AJ
5# modify it under the terms of the GNU Lesser General Public
6# License as published by the Free Software Foundation; either
7# version 2.1 of the License, or (at your option) any later version.
28f540f4
RM
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
41bdb6e2 12# Lesser General Public License for more details.
28f540f4 13
41bdb6e2
AJ
14# You should have received a copy of the GNU Lesser General Public
15# License along with the GNU C Library; if not, write to the Free
16# Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
17# 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
c8d32817
UD
50# We don't want to run anything here in parallel.
51.NOTPARALLEL:
52
dbdb6189
RM
53configure: configure.in aclocal.m4; $(autoconf-it)
54%/configure: %/configure.in aclocal.m4; $(autoconf-it)
28f540f4 55
28f540f4 56# These are the targets that are made by making them in each subdirectory.
edf5b2d7
UD
57+subdir_targets := subdir_lib objects objs others subdir_mostlyclean \
58 subdir_clean subdir_distclean subdir_realclean \
59 tests subdir_lint.out \
6a441471 60 subdir_distinfo \
28f540f4 61 subdir_echo-headers subdir_echo-distinfo \
57ba7bb4 62 subdir_install \
3c5edd4d 63 subdir_testclean \
57ba7bb4 64 $(addprefix install-, no-libc.a bin lib data headers others)
28f540f4 65\f
5107cf1d 66headers := errno.h sys/errno.h bits/errno.h limits.h values.h \
dc30f461
UD
67 features.h gnu-versions.h bits/libc-lock.h bits/xopen_lim.h \
68 gnu/libc-version.h
28f540f4
RM
69
70echo-headers: subdir_echo-headers
71
762a2918
UD
72# The headers are in the include directory.
73subdir-dirs = include
74vpath %.h $(subdir-dirs)
75
28f540f4 76# What to install.
8d57beea 77install-others = $(inst_includedir)/gnu/stubs.h
56552e42
UD
78install-bin = glibcbug
79
a18f587d 80ifeq (yes,$(build-shared))
c0e45674 81install-others += $(inst_includedir)/gnu/lib-names.h
a18f587d 82endif
28f540f4 83
28f540f4
RM
84include Makerules
85
737547be
UD
86ifeq ($(build-programs),yes)
87others: $(addprefix $(objpfx),$(install-bin))
88endif
89
28f540f4
RM
90# Install from subdirectories too.
91install: subdir_install
8d57beea 92
5148d49f
UD
93# Make sure that the dynamic linker is installed before libc.
94$(inst_slibdir)/libc-$(version).so: elf/ldso_install
95
96.PHONY: elf/ldso_install
97elf/ldso_install:
98 $(MAKE) -C $(@D) $(@F)
99
b43b13ac 100# Create links for shared libraries using the `ldconfig' program if possible.
7cc27f44 101# Ignore the error if we cannot update /etc/ld.so.cache.
1ef32c3d
UD
102ifeq (no,$(cross-compiling))
103ifeq (yes,$(build-shared))
409dfcea
UD
104install: install-symbolic-link
105.PHONY: install-symbolic-link
106install-symbolic-link: subdir_install
9d141cae 107 $(symbolic-link-prog) $(symbolic-link-list)
7ef90c15 108 rm -f $(symbolic-link-list)
9d141cae 109
8d57beea 110install:
b4a555d6 111 -test ! -x $(common-objpfx)elf/ldconfig || LC_ALL=C LANGUAGE=C \
03c0d6ef 112 $(common-objpfx)elf/ldconfig $(addprefix -r ,$(install_root)) \
5732c4df 113 $(slibdir) $(libdir)
cc3fa755
UD
114ifneq (no,$(PERL))
115ifeq (/usr,$(prefix))
116ifeq (,$(install_root))
5bc2f642 117 CC="$(CC)" $(PERL) scripts/test-installation.pl $(common-objpfx)
cc3fa755
UD
118endif
119endif
120endif
1ef32c3d
UD
121endif
122endif
28f540f4 123
01a36ad3
RM
124# Build subdirectory lib objects.
125lib-noranlib: subdir_lib
28f540f4 126
01a36ad3
RM
127ifeq (yes,$(build-shared))
128# Build the shared object from the PIC object library.
129lib: $(common-objpfx)libc.so
130endif
28f540f4 131\f
97a47867
UD
132# Makerules creates a file `stubs' in each subdirectory, which
133# contains `#define __stub_FUNCTION' for each function defined in that
134# directory which is a stub.
6bc31da0 135# Here we paste all of these together into <gnu/stubs.h>.
28f540f4 136
97a47867 137subdir-stubs := $(foreach dir,$(subdirs),$(common-objpfx)$(dir)/stubs)
28f540f4
RM
138
139# Since stubs.h is never needed when building the library, we simplify the
140# hairy installation process by producing it in place only as the last part
b9b49b44
UD
141# of the top-level `make install'. It depends on subdir_install, which
142# iterates over all the subdirs; subdir_install in each subdir depends on
143# the subdir's stubs file. Having more direct dependencies would result in
144# extra iterations over the list for subdirs and many recursive makes.
145$(inst_includedir)/gnu/stubs.h: subdir_install
5107cf1d 146 $(make-target-directory)
28f540f4
RM
147 @rm -f $(objpfx)stubs.h
148 (echo '/* This file is automatically generated.';\
149 echo ' It defines a symbol `__stub_FUNCTION'\'' for each function';\
150 echo ' in the C library which is a stub, meaning it will fail';\
151 echo ' every time called, usually setting errno to ENOSYS. */';\
be76803a 152 LC_ALL=C sort $(subdir-stubs)) > $(objpfx)stubs.h
13a0be88 153 if test -r $@ && cmp -s $(objpfx)stubs.h $@; \
ba1ffaa1 154 then echo 'stubs.h unchanged'; \
d36e7692 155 else $(INSTALL_DATA) $(objpfx)stubs.h $@; fi
28f540f4
RM
156 rm -f $(objpfx)stubs.h
157\f
8a523922 158ifeq (yes,$(build-shared))
afd4eb37 159
73237de3 160$(inst_includedir)/gnu/lib-names.h: $(common-objpfx)gnu/lib-names.h $(+force)
390a4882 161 $(do-install)
afd4eb37 162endif
ba1ffaa1 163\f
df4ef2ab
UD
164# The `glibcbug' script contains the version number and it shall be rebuild
165# whenever this changes or the `glibcbug.in' file.
5290baf0 166$(objpfx)glibcbug: $(common-objpfx)config.status glibcbug.in
af3878df 167 cd $(<D) && CONFIG_FILES=$(@F) CONFIG_HEADERS= $(SHELL) $(<F)
df4ef2ab 168\f
28f540f4 169# This makes the Info or DVI file of the documentation from the Texinfo source.
1830a0d5
UD
170.PHONY: info dvi pdf
171info dvi pdf:
c0e45674 172 $(MAKE) $(PARALLELMFLAGS) -C manual $@
28f540f4
RM
173\f
174# This makes all the subdirectory targets.
175
176# For each target, make it depend on DIR/target for each subdirectory DIR.
177$(+subdir_targets): %: $(addsuffix /%,$(subdirs))
178
179# Compute a list of all those targets.
180all-subdirs-targets := $(foreach dir,$(subdirs),\
181 $(addprefix $(dir)/,$(+subdir_targets)))
182
183# The action for each of those is to cd into the directory and make the
184# target there.
185$(all-subdirs-targets):
c0e45674 186 $(MAKE) $(PARALLELMFLAGS) -C $(@D) $(@F)
28f540f4
RM
187
188.PHONY: $(+subdir_targets) $(all-subdirs-targets)
189\f
190# Targets to clean things up to various degrees.
191
3c5edd4d
UD
192.PHONY: clean realclean distclean distclean-1 parent-clean parent-mostlyclean \
193 tests-clean
28f540f4
RM
194
195# Subroutines of all cleaning targets.
196parent-mostlyclean: common-mostlyclean # common-mostlyclean is in Makerules.
4ddde9ee 197 -rm -f $(foreach o,$(object-suffixes-for-libc),\
60092701
RM
198 $(common-objpfx)$(patsubst %,$(libtype$o),c)) \
199 $(addprefix $(objpfx),$(install-lib))
28f540f4 200parent-clean: parent-mostlyclean common-clean
da2d1bc5
UD
201
202postclean = $(addprefix $(common-objpfx),$(postclean-generated)) \
eaeeb1eb 203 $(addprefix $(objpfx),sysd-dirs sysd-rules) \
4fcddf8e 204 $(addprefix $(objpfx),sysd-sorted soversions.mk soversions.i)
28f540f4
RM
205
206clean: parent-clean
207# This is done this way rather than having `subdir_clean' be a
208# dependency of this target so that libc.a will be removed before the
209# subdirectories are dealt with and so they won't try to remove object
210# files from it when it's going to be removed anyway.
211 @$(MAKE) subdir_clean no_deps=t
b5c69d99 212 -rm -f $(postclean)
28f540f4
RM
213mostlyclean: parent-mostlyclean
214 @$(MAKE) subdir_mostlyclean no_deps=t
da2d1bc5 215 -rm -f $(postclean)
28f540f4 216
3c5edd4d
UD
217tests-clean:
218 @$(MAKE) subdir_testclean no_deps=t
219
28f540f4
RM
220# The realclean target is just like distclean for the parent, but we want
221# the subdirs to know the difference in case they care.
222realclean distclean: parent-clean
223# This is done this way rather than having `subdir_distclean' be a
224# dependency of this target so that libc.a will be removed before the
225# subdirectories are dealt with and so they won't try to remove object
226# files from it when it's going to be removed anyway.
da2d1bc5
UD
227 @$(MAKE) distclean-1 no_deps=t distclean-1=$@ avoid-generated=yes \
228 sysdep-subdirs="$(sysdep-subdirs)"
229 -rm -f $(postclean)
28f540f4
RM
230
231# Subroutine of distclean and realclean.
232distclean-1: subdir_$(distclean-1)
233 -rm -f $(config-generated)
60092701
RM
234 -rm -f $(addprefix $(objpfx),config.status config.cache config.log)
235 -rm -f $(addprefix $(objpfx),config.make config-name.h config.h)
9a0a462c 236 -rm -f $(addprefix $(objpfx),glibcbug)
28f540f4
RM
237ifdef objdir
238 -rm -f $(objpfx)Makefile
239endif
240 -rm -f $(sysdep-$(distclean-1))
241\f
242.PHONY: echo_subdirs
243echo_subdirs:;@echo '$(subdirs)'
244
245.PHONY: echo-distinfo parent_echo-distinfo
246echo-distinfo: parent_echo-distinfo subdir_echo-distinfo
247parent_echo-distinfo:
248 @echo $(addprefix +header+,$(headers)) \
249 $(addprefix +nodist+,$(generated))
6a441471 250
2f6d1f1b 251\f
28f540f4
RM
252# Make the distribution tarfile.
253
a709dd43
UD
254distribute := README README.libm INSTALL FAQ FAQ.in NOTES NEWS BUGS \
255 PROJECTS COPYING.LIB COPYING ChangeLog ChangeLog.[0-9] \
afa0569f
UD
256 ChangeLog.1[0-9] Makefile Makeconfig Makerules Rules \
257 Make-dist MakeTAGS extra-lib.mk o-iterator.mk configure \
258 configure.in aclocal.m4 config.h.in config.make.in \
259 config-name.in Makefile.in sysdep.h set-hooks.h \
260 libc-symbols.h version.h shlib-versions rpm/Makefile \
261 rpm/template rpm/rpmrc glibcbug.in abi-tags stub-tag.h \
dabb1db4 262 test-skeleton.c include/des.h include/libc-internal.h \
e8ef6f28 263 include/shlib-compat.h include/pthread.h Versions.def \
52cea457 264 INTERFACE CONFORMANCE NAMESPACE \
5bc2f642 265 $(addprefix scripts/, \
a709dd43
UD
266 rellns-sh config.sub config.guess \
267 mkinstalldirs move-if-change install-sh \
5edb9387 268 test-installation.pl gen-FAQ.pl versions.awk\
2a0ff6ff 269 gen-sorted.awk abi-versions.awk \
4c78249d 270 firstversions.awk documented.sh)
28f540f4
RM
271
272distribute := $(strip $(distribute))
c7562c74 273generated := $(generated) stubs.h
28f540f4 274
aaf688e8
UD
275README: README.template version.h
276 -rm -f $@
277 sed -e 's/RELEASE/$(release)/' -e 's/VERSION/$(version)/' < $< > $@
278# Make it unwritable so I won't change it by mistake.
279 chmod 444 $@
280ifeq ($(with-cvs),yes)
281 test ! -d CVS || cvs $(CVSOPTS) commit -m'Remade for $(release)-$(version)' $@
282endif
28f540f4
RM
283
284define format-me
285@rm -f $@
286makeinfo --no-validate --no-warn --no-headers $< -o $@
287-chmod a-w $@
288endef
a35cb74d 289INSTALL: manual/install.texi; $(format-me)
28f540f4 290NOTES: manual/creature.texi; $(format-me)
714a562f 291manual/dir-add.texi manual/dir-add.info: FORCE
fe7bdd63 292 $(MAKE) $(PARALLELMFLAGS) -C $(@D) $(@F)
5bc2f642 293FAQ: scripts/gen-FAQ.pl FAQ.in
61952351 294 $(PERL) $^ > $@.new && rm -f $@ && mv $@.new $@ && chmod a-w $@
a35cb74d
UD
295ifeq ($(with-cvs),yes)
296 test ! -d CVS || cvs $(CVSOPTS) commit -m'Regenerated: $(PERL) $^' $@
297endif
f671aeab 298FORCE:
6a441471
RM
299
300rpm/%: subdir_distinfo
a709dd43 301 $(MAKE) $(PARALLELMFLAGS) -C $(@D) $(@F)
33a934a3 302
c3c62655 303iconvdata/% localedata/% po/%:
f4017d20
UD
304 $(MAKE) $(PARALLELMFLAGS) -C $(@D) $(@F)
305
33a934a3
UD
306# This is a special goal for people making binary distributions. Normally
307# everybody uses the DES based crypt library but for the distribution we
308# need the only-MD5 based one as well.
309md5-crypt/libmd5crypt:
c0e45674 310 $(MAKE) $(PARALLELMFLAGS) -C $(@D) $(@F)
a53bad16
UD
311
312# glibc 2.0 contains some header files which aren't used with glibc 2.1
313# anymore.
314# These rules should remove those headers
315ifeq (,$(install_root))
316ifeq ($(old-glibc-headers),yes)
317install: remove-old-headers
318endif
319endif
320
321headers2_0 := __math.h bytesex.h confname.h direntry.h elfclass.h \
322 errnos.h fcntlbits.h huge_val.h ioctl-types.h \
323 ioctls.h iovec.h jmp_buf.h libc-lock.h local_lim.h \
324 mathcalls.h mpool.h nan.h ndbm.h posix1_lim.h \
325 posix2_lim.h posix_opt.h resourcebits.h schedbits.h \
326 selectbits.h semaphorebits.h sigaction.h sigcontext.h \
327 signum.h sigset.h sockaddrcom.h socketbits.h stab.def \
328 statbuf.h statfsbuf.h stdio-lock.h stdio_lim.h \
329 syscall-list.h termbits.h timebits.h ustatbits.h \
330 utmpbits.h utsnamelen.h waitflags.h waitstatus.h \
331 xopen_lim.h gnu/types.h sys/ipc_buf.h \
332 sys/kernel_termios.h sys/msq_buf.h sys/sem_buf.h \
a7ab2023 333 sys/shm_buf.h sys/socketcall.h sigstack.h
a53bad16 334
b195f6bc 335.PHONY: remove-old-headers
a53bad16
UD
336remove-old-headers:
337 rm -f $(addprefix $(inst_includedir)/, $(headers2_0))