]> sourceware.org Git - glibc.git/blame - Makefile
2006-01-07 Roland McGrath <roland@redhat.com>
[glibc.git] / Makefile
CommitLineData
5d9e8991 1# Copyright (C) 1991-2002, 2003, 2004, 2005 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
1400de2e
RM
33ifneq ($(AUTOCONF),no)
34
4d06461a 35ifeq ($(with-cvs),yes)
1400de2e 36define autoconf-it-cvs
379bb425 37test ! -d CVS || cvs $(CVSOPTS) commit -m'Regenerated: autoconf $(ACFLAGS) $<' $@
28f540f4 38endef
4d06461a 39else
1400de2e
RM
40autoconf-it-cvs =
41endif
42
4d06461a
UD
43define autoconf-it
44@-rm -f $@.new
1400de2e 45$(AUTOCONF) $(ACFLAGS) $< > $@.new
4d06461a
UD
46chmod a-w,a+x $@.new
47mv -f $@.new $@
1400de2e 48$(autoconf-it-cvs)
4d06461a 49endef
c8d32817 50
dbdb6189
RM
51configure: configure.in aclocal.m4; $(autoconf-it)
52%/configure: %/configure.in aclocal.m4; $(autoconf-it)
28f540f4 53
1400de2e
RM
54endif # $(AUTOCONF) = no
55
56
57# We don't want to run anything here in parallel.
58.NOTPARALLEL:
59
28f540f4 60# These are the targets that are made by making them in each subdirectory.
edf5b2d7
UD
61+subdir_targets := subdir_lib objects objs others subdir_mostlyclean \
62 subdir_clean subdir_distclean subdir_realclean \
c238ecf7 63 tests xtests subdir_lint.out \
62780824
RM
64 subdir_update-abi subdir_check-abi \
65 subdir_echo-headers \
57ba7bb4 66 subdir_install \
5d9e8991 67 subdir_objs subdir_stubs subdir_testclean \
57ba7bb4 68 $(addprefix install-, no-libc.a bin lib data headers others)
28f540f4 69\f
739d440d
UD
70headers := limits.h values.h features.h gnu-versions.h bits/libc-lock.h \
71 bits/xopen_lim.h gnu/libc-version.h
28f540f4
RM
72
73echo-headers: subdir_echo-headers
74
762a2918
UD
75# The headers are in the include directory.
76subdir-dirs = include
77vpath %.h $(subdir-dirs)
78
28f540f4 79# What to install.
8d57beea 80install-others = $(inst_includedir)/gnu/stubs.h
fe54a69c 81install-bin-script =
56552e42 82
a18f587d 83ifeq (yes,$(build-shared))
6736e93b 84headers += gnu/lib-names.h
a18f587d 85endif
28f540f4 86
28f540f4
RM
87include Makerules
88
737547be 89ifeq ($(build-programs),yes)
6c3ebebd 90others: $(addprefix $(objpfx),$(install-bin-script))
737547be
UD
91endif
92
28f540f4
RM
93# Install from subdirectories too.
94install: subdir_install
8d57beea 95
6736e93b
UD
96# Explicit dependency so that `make install-headers' works
97install-headers: install-headers-nosubdir
98
5148d49f
UD
99# Make sure that the dynamic linker is installed before libc.
100$(inst_slibdir)/libc-$(version).so: elf/ldso_install
101
102.PHONY: elf/ldso_install
103elf/ldso_install:
104 $(MAKE) -C $(@D) $(@F)
105
b43b13ac 106# Create links for shared libraries using the `ldconfig' program if possible.
7cc27f44 107# Ignore the error if we cannot update /etc/ld.so.cache.
1ef32c3d
UD
108ifeq (no,$(cross-compiling))
109ifeq (yes,$(build-shared))
409dfcea
UD
110install: install-symbolic-link
111.PHONY: install-symbolic-link
112install-symbolic-link: subdir_install
9d141cae 113 $(symbolic-link-prog) $(symbolic-link-list)
7ef90c15 114 rm -f $(symbolic-link-list)
9d141cae 115
8d57beea 116install:
b4a555d6 117 -test ! -x $(common-objpfx)elf/ldconfig || LC_ALL=C LANGUAGE=C \
03c0d6ef 118 $(common-objpfx)elf/ldconfig $(addprefix -r ,$(install_root)) \
5732c4df 119 $(slibdir) $(libdir)
cc3fa755
UD
120ifneq (no,$(PERL))
121ifeq (/usr,$(prefix))
122ifeq (,$(install_root))
5bc2f642 123 CC="$(CC)" $(PERL) scripts/test-installation.pl $(common-objpfx)
cc3fa755
UD
124endif
125endif
126endif
1ef32c3d
UD
127endif
128endif
28f540f4 129
01a36ad3
RM
130# Build subdirectory lib objects.
131lib-noranlib: subdir_lib
28f540f4 132
01a36ad3
RM
133ifeq (yes,$(build-shared))
134# Build the shared object from the PIC object library.
135lib: $(common-objpfx)libc.so
136endif
9bfce4bf
RM
137
138
139# This is a handy script for running any dynamically linked program against
140# the current libc build for testing.
141$(common-objpfx)testrun.sh: $(common-objpfx)config.make \
142 $(..)Makeconfig $(..)Makefile
143 (echo '#!/bin/sh'; \
144 echo "GCONV_PATH='$(common-objpfx)iconvdata' \\"; \
145 echo 'exec $(run-program-prefix) $${1+"$$@"}'; \
146 ) > $@T
147 chmod a+x $@T
148 mv -f $@T $@
149postclean-generated += testrun.sh
150
151others: $(common-objpfx)testrun.sh
28f540f4 152\f
97a47867
UD
153# Makerules creates a file `stubs' in each subdirectory, which
154# contains `#define __stub_FUNCTION' for each function defined in that
155# directory which is a stub.
6bc31da0 156# Here we paste all of these together into <gnu/stubs.h>.
28f540f4 157
97a47867 158subdir-stubs := $(foreach dir,$(subdirs),$(common-objpfx)$(dir)/stubs)
28f540f4 159
3e1e123d
RM
160ifeq ($(biarch),no)
161installed-stubs = $(inst_includedir)/gnu/stubs.h
162else
163installed-stubs = $(inst_includedir)/gnu/stubs-$(biarch).h
164
165$(inst_includedir)/gnu/stubs.h: include/stubs-biarch.h $(+force)
166 $(INSTALL_DATA) $< $@
167
168install-others-nosubdir: $(installed-stubs)
169endif
170
171
28f540f4
RM
172# Since stubs.h is never needed when building the library, we simplify the
173# hairy installation process by producing it in place only as the last part
b9b49b44
UD
174# of the top-level `make install'. It depends on subdir_install, which
175# iterates over all the subdirs; subdir_install in each subdir depends on
176# the subdir's stubs file. Having more direct dependencies would result in
177# extra iterations over the list for subdirs and many recursive makes.
3e1e123d 178$(installed-stubs): include/stubs-prologue.h subdir_install
5107cf1d 179 $(make-target-directory)
28f540f4 180 @rm -f $(objpfx)stubs.h
d62507dd 181 (sed '/^@/d' $<; LC_ALL=C sort $(subdir-stubs)) > $(objpfx)stubs.h
13a0be88 182 if test -r $@ && cmp -s $(objpfx)stubs.h $@; \
ba1ffaa1 183 then echo 'stubs.h unchanged'; \
d36e7692 184 else $(INSTALL_DATA) $(objpfx)stubs.h $@; fi
28f540f4
RM
185 rm -f $(objpfx)stubs.h
186\f
187# This makes the Info or DVI file of the documentation from the Texinfo source.
fef0b717
UD
188.PHONY: info dvi pdf html
189info dvi pdf html:
c0e45674 190 $(MAKE) $(PARALLELMFLAGS) -C manual $@
28f540f4
RM
191\f
192# This makes all the subdirectory targets.
193
194# For each target, make it depend on DIR/target for each subdirectory DIR.
195$(+subdir_targets): %: $(addsuffix /%,$(subdirs))
196
197# Compute a list of all those targets.
198all-subdirs-targets := $(foreach dir,$(subdirs),\
199 $(addprefix $(dir)/,$(+subdir_targets)))
200
201# The action for each of those is to cd into the directory and make the
202# target there.
203$(all-subdirs-targets):
a334319f 204 $(MAKE) $(PARALLELMFLAGS) -C $(@D) $(@F)
28f540f4
RM
205
206.PHONY: $(+subdir_targets) $(all-subdirs-targets)
207\f
208# Targets to clean things up to various degrees.
209
3c5edd4d
UD
210.PHONY: clean realclean distclean distclean-1 parent-clean parent-mostlyclean \
211 tests-clean
28f540f4
RM
212
213# Subroutines of all cleaning targets.
214parent-mostlyclean: common-mostlyclean # common-mostlyclean is in Makerules.
4ddde9ee 215 -rm -f $(foreach o,$(object-suffixes-for-libc),\
60092701
RM
216 $(common-objpfx)$(patsubst %,$(libtype$o),c)) \
217 $(addprefix $(objpfx),$(install-lib))
28f540f4 218parent-clean: parent-mostlyclean common-clean
da2d1bc5
UD
219
220postclean = $(addprefix $(common-objpfx),$(postclean-generated)) \
eaeeb1eb 221 $(addprefix $(objpfx),sysd-dirs sysd-rules) \
4fcddf8e 222 $(addprefix $(objpfx),sysd-sorted soversions.mk soversions.i)
28f540f4
RM
223
224clean: parent-clean
225# This is done this way rather than having `subdir_clean' be a
226# dependency of this target so that libc.a will be removed before the
227# subdirectories are dealt with and so they won't try to remove object
228# files from it when it's going to be removed anyway.
229 @$(MAKE) subdir_clean no_deps=t
b5c69d99 230 -rm -f $(postclean)
28f540f4
RM
231mostlyclean: parent-mostlyclean
232 @$(MAKE) subdir_mostlyclean no_deps=t
da2d1bc5 233 -rm -f $(postclean)
28f540f4 234
3c5edd4d
UD
235tests-clean:
236 @$(MAKE) subdir_testclean no_deps=t
237
16feadf2 238tests: $(objpfx)c++-types-check.out $(objpfx)check-local-headers.out
2750c39c 239ifneq ($(CXX),no)
ad243052
RM
240check-data := $(firstword $(wildcard \
241 $(foreach M,$(config-machine) $(base-machine),\
242 scripts/data/c++-types-$M-$(config-os).data)))
243ifneq (,$(check-data))
5ef5cbb6 244$(objpfx)c++-types-check.out: $(check-data) scripts/check-c++-types.sh
f7ffeb91 245 scripts/check-c++-types.sh $< $(CXX) $(filter-out -std=gnu99 -Wstrict-prototypes,$(CFLAGS)) $(CPPFLAGS) > $@
806e4a4a
UD
246else
247$(objpfx)c++-types-check.out:
248 @echo 'WARNING C++ tests not run; create a c++-types-XXX file'
249 @echo "not run" > $@
250endif
2750c39c 251endif
806e4a4a 252
16feadf2
UD
253$(objpfx)check-local-headers.out: scripts/check-local-headers.sh
254 scripts/check-local-headers.sh "$(includedir)" "$(objpfx)" > $@
255
5ef5cbb6
UD
256ifneq ($(PERL),no)
257installed-headers = argp/argp.h assert/assert.h catgets/nl_types.h \
258 crypt/crypt.h ctype/ctype.h debug/execinfo.h \
259 dirent/dirent.h dlfcn/dlfcn.h elf/elf.h elf/link.h \
260 gmon/sys/gmon.h gmon/sys/gmon_out.h gmon/sys/profil.h \
261 grp/grp.h iconv/iconv.h iconv/gconv.h \
262 $(wildcard inet/netinet/*.h) \
263 $(wildcard inet/arpa/*.h inet/protocols/*.h) \
264 inet/aliases.h inet/ifaddrs.h inet/netinet/ip6.h \
265 inet/netinet/icmp6.h intl/libintl.h io/sys/stat.h \
266 io/sys/statfs.h io/sys/vfs.h io/sys/statvfs.h \
267 io/fcntl.h io/sys/fcntl.h io/poll.h io/sys/poll.h \
268 io/utime.h io/ftw.h io/fts.h io/sys/sendfile.h \
269 libio/stdio.h libio/libio.h locale/locale.h \
270 locale/langinfo.h locale/xlocale.h login/utmp.h \
271 login/lastlog.h login/pty.h malloc/malloc.h \
272 malloc/obstack.h malloc/mcheck.h math/math.h \
273 math/complex.h math/fenv.h math/tgmath.h misc/sys/uio.h \
274 $(wildcard nis/rpcsvc/*.h) nptl_db/thread_db.h \
275 nptl/sysdeps/pthread/pthread.h nptl/semaphore.h \
276 nss/nss.h posix/sys/utsname.h posix/sys/times.h \
277 posix/sys/wait.h posix/sys/types.h posix/unistd.h \
278 posix/glob.h posix/regex.h posix/wordexp.h posix/fnmatch.h\
279 posix/getopt.h posix/tar.h posix/sys/unistd.h \
280 posix/sched.h posix/re_comp.h posix/wait.h \
281 posix/cpio.h posix/spawn.h pwd/pwd.h resolv/resolv.h \
282 resolv/netdb.h $(wildcard resolv/arpa/*.h) \
283 resource/sys/resource.h resource/sys/vlimit.h \
284 resource/sys/vtimes.h resource/ulimit.h rt/aio.h \
285 rt/mqueue.h setjmp/setjmp.h shadow/shadow.h \
286 signal/signal.h signal/sys/signal.h socket/sys/socket.h \
287 socket/sys/un.h stdio-common/printf.h \
288 stdio-common/stdio_ext.h stdlib/stdlib.h stdlib/alloca.h \
289 stdlib/monetary.h stdlib/fmtmsg.h stdlib/ucontext.h \
290 sysdeps/generic/inttypes.h sysdeps/generic/stdint.h \
291 stdlib/errno.h stdlib/sys/errno.h string/string.h \
292 string/strings.h string/memory.h string/endian.h \
293 string/argz.h string/envz.h string/byteswap.h \
294 $(wildcard sunrpc/rpc/*.h sunrpc/rpcsvc/*.h) \
295 sysvipc/sys/ipc.h sysvipc/sys/msg.h sysvipc/sys/sem.h \
296 sysvipc/sys/shm.h termios/termios.h \
297 termios/sys/termios.h termios/sys/ttychars.h time/time.h \
298 time/sys/time.h time/sys/timeb.h wcsmbs/wchar.h \
299 wctype/wctype.h
300
301tests: $(objpfx)begin-end-check.out
302$(objpfx)begin-end-check.out: scripts/begin-end-check.pl
303 $(PERL) scripts/begin-end-check.pl $(installed-headers) > $@
304endif
305
28f540f4
RM
306# The realclean target is just like distclean for the parent, but we want
307# the subdirs to know the difference in case they care.
308realclean distclean: parent-clean
309# This is done this way rather than having `subdir_distclean' be a
310# dependency of this target so that libc.a will be removed before the
311# subdirectories are dealt with and so they won't try to remove object
312# files from it when it's going to be removed anyway.
da2d1bc5
UD
313 @$(MAKE) distclean-1 no_deps=t distclean-1=$@ avoid-generated=yes \
314 sysdep-subdirs="$(sysdep-subdirs)"
315 -rm -f $(postclean)
28f540f4
RM
316
317# Subroutine of distclean and realclean.
318distclean-1: subdir_$(distclean-1)
319 -rm -f $(config-generated)
60092701
RM
320 -rm -f $(addprefix $(objpfx),config.status config.cache config.log)
321 -rm -f $(addprefix $(objpfx),config.make config-name.h config.h)
28f540f4
RM
322ifdef objdir
323 -rm -f $(objpfx)Makefile
324endif
325 -rm -f $(sysdep-$(distclean-1))
326\f
28f540f4 327# Make the distribution tarfile.
62780824 328.PHONY: dist tag-for-dist
28f540f4 329
c7562c74 330generated := $(generated) stubs.h
28f540f4 331
aaf688e8
UD
332README: README.template version.h
333 -rm -f $@
334 sed -e 's/RELEASE/$(release)/' -e 's/VERSION/$(version)/' < $< > $@
335# Make it unwritable so I won't change it by mistake.
336 chmod 444 $@
337ifeq ($(with-cvs),yes)
338 test ! -d CVS || cvs $(CVSOPTS) commit -m'Remade for $(release)-$(version)' $@
339endif
28f540f4 340
62780824
RM
341files-for-dist := README FAQ INSTALL NOTES configure
342
343tag-of-stem = glibc-$(subst .,_,$*)
344
7c0cf356 345# Add-ons in the main repository but distributed in their own tar files.
a334319f
UD
346dist-separate = libidn linuxthreads
347
348# Directories in each add-on.
349dist-separate-libidn = libidn
350dist-separate-linuxthreads = linuxthreads linuxthreads_db
7c0cf356
RM
351
352glibc-%.tar $(dist-separate:%=glibc-%-%.tar): $(files-for-dist) \
353 $(foreach D,$(dist-separate),\
354 $D/configure)
62780824 355 @rm -fr glibc-$*
5cc59727
RM
356 $(MAKE) -q `find sysdeps $(addsuffix /sysdeps,$(add-ons)) \
357 -name configure`
a334319f 358 cvs $(CVSOPTS) -Q export -d glibc-$* -r $(tag-of-stem) libc
5cc59727
RM
359# Touch all the configure scripts going into the tarball since cvs export
360# might have delivered configure.in newer than configure.
361 find glibc-$* -name configure -print | xargs touch
7c0cf356 362 $(dist-do-separate-dirs)
62780824
RM
363 tar cf glibc-$*.tar glibc-$*
364 rm -fr glibc-$*
7c0cf356
RM
365define dist-do-separate-dirs
366$(foreach dir,$(dist-separate),
a334319f
UD
367 tar cf glibc-$(dir)-$*.tar -C glibc-$* $(dist-separate-$(dir))
368 rm -rf $(addprefix glibc-$*/,$(dist-separate-$(dir)))
7c0cf356
RM
369)
370endef
62780824 371
7c0cf356
RM
372# Do `make dist dist-version=X.Y.Z' to make tar files of an older version.
373dist-version = $(version)
374
375dist: $(foreach Z,.bz2 .gz,glibc-$(dist-version).tar$Z \
376 $(foreach D,$(dist-separate),\
377 glibc-$D-$(dist-version).tar$Z))
62780824
RM
378 md5sum $^
379
7c0cf356 380tag-for-dist: tag-$(dist-version)
62780824
RM
381tag-%: $(files-for-dist)
382 cvs $(CVSOPTS) -Q tag -c $(tag-of-stem)
383
28f540f4
RM
384define format-me
385@rm -f $@
a334319f 386makeinfo --no-validate --no-warn --no-headers $< -o $@
28f540f4
RM
387-chmod a-w $@
388endef
a35cb74d 389INSTALL: manual/install.texi; $(format-me)
28f540f4 390NOTES: manual/creature.texi; $(format-me)
714a562f 391manual/dir-add.texi manual/dir-add.info: FORCE
fe7bdd63 392 $(MAKE) $(PARALLELMFLAGS) -C $(@D) $(@F)
5bc2f642 393FAQ: scripts/gen-FAQ.pl FAQ.in
61952351 394 $(PERL) $^ > $@.new && rm -f $@ && mv $@.new $@ && chmod a-w $@
a35cb74d
UD
395ifeq ($(with-cvs),yes)
396 test ! -d CVS || cvs $(CVSOPTS) commit -m'Regenerated: $(PERL) $^' $@
397endif
f671aeab 398FORCE:
6a441471 399
a334319f 400iconvdata/% localedata/% po/% manual/%:
f4017d20
UD
401 $(MAKE) $(PARALLELMFLAGS) -C $(@D) $(@F)
402
a53bad16
UD
403# glibc 2.0 contains some header files which aren't used with glibc 2.1
404# anymore.
405# These rules should remove those headers
406ifeq (,$(install_root))
407ifeq ($(old-glibc-headers),yes)
408install: remove-old-headers
409endif
410endif
411
412headers2_0 := __math.h bytesex.h confname.h direntry.h elfclass.h \
413 errnos.h fcntlbits.h huge_val.h ioctl-types.h \
414 ioctls.h iovec.h jmp_buf.h libc-lock.h local_lim.h \
415 mathcalls.h mpool.h nan.h ndbm.h posix1_lim.h \
416 posix2_lim.h posix_opt.h resourcebits.h schedbits.h \
417 selectbits.h semaphorebits.h sigaction.h sigcontext.h \
418 signum.h sigset.h sockaddrcom.h socketbits.h stab.def \
419 statbuf.h statfsbuf.h stdio-lock.h stdio_lim.h \
420 syscall-list.h termbits.h timebits.h ustatbits.h \
421 utmpbits.h utsnamelen.h waitflags.h waitstatus.h \
422 xopen_lim.h gnu/types.h sys/ipc_buf.h \
423 sys/kernel_termios.h sys/msq_buf.h sys/sem_buf.h \
a7ab2023 424 sys/shm_buf.h sys/socketcall.h sigstack.h
a53bad16 425
b195f6bc 426.PHONY: remove-old-headers
a53bad16
UD
427remove-old-headers:
428 rm -f $(addprefix $(inst_includedir)/, $(headers2_0))
This page took 0.250751 seconds and 5 git commands to generate.