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