]>
Commit | Line | Data |
---|---|---|
fe54a69c | 1 | # Copyright (C) 1991-2002, 2003, 2004 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 | # | |
22 | ifneq (,) | |
23 | This makefile requires GNU Make. | |
24 | endif | |
25 | ||
aa802e96 UD |
26 | include Makeconfig |
27 | ||
28f540f4 RM |
28 | |
29 | # This is the default target; it makes everything except the tests. | |
30 | .PHONY: all | |
edf5b2d7 | 31 | all: lib others |
28f540f4 | 32 | \f |
1400de2e RM |
33 | ifneq ($(AUTOCONF),no) |
34 | ||
4d06461a | 35 | ifeq ($(with-cvs),yes) |
1400de2e | 36 | define autoconf-it-cvs |
379bb425 | 37 | test ! -d CVS || cvs $(CVSOPTS) commit -m'Regenerated: autoconf $(ACFLAGS) $<' $@ |
28f540f4 | 38 | endef |
4d06461a | 39 | else |
1400de2e RM |
40 | autoconf-it-cvs = |
41 | endif | |
42 | ||
4d06461a UD |
43 | define autoconf-it |
44 | @-rm -f $@.new | |
1400de2e | 45 | $(AUTOCONF) $(ACFLAGS) $< > $@.new |
4d06461a UD |
46 | chmod a-w,a+x $@.new |
47 | mv -f $@.new $@ | |
1400de2e | 48 | $(autoconf-it-cvs) |
4d06461a | 49 | endef |
c8d32817 | 50 | |
dbdb6189 RM |
51 | configure: configure.in aclocal.m4; $(autoconf-it) |
52 | %/configure: %/configure.in aclocal.m4; $(autoconf-it) | |
28f540f4 | 53 | |
1400de2e RM |
54 | endif # $(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 \ |
c823a4d2 | 64 | subdir_update-abi subdir_check-abi subdir_distinfo \ |
28f540f4 | 65 | subdir_echo-headers subdir_echo-distinfo \ |
57ba7bb4 | 66 | subdir_install \ |
3c5edd4d | 67 | subdir_testclean \ |
57ba7bb4 | 68 | $(addprefix install-, no-libc.a bin lib data headers others) |
28f540f4 | 69 | \f |
739d440d UD |
70 | headers := 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 | |
73 | echo-headers: subdir_echo-headers | |
74 | ||
762a2918 UD |
75 | # The headers are in the include directory. |
76 | subdir-dirs = include | |
77 | vpath %.h $(subdir-dirs) | |
78 | ||
28f540f4 | 79 | # What to install. |
8d57beea | 80 | install-others = $(inst_includedir)/gnu/stubs.h |
fe54a69c | 81 | install-bin-script = |
56552e42 | 82 | |
a18f587d | 83 | ifeq (yes,$(build-shared)) |
6736e93b | 84 | headers += gnu/lib-names.h |
a18f587d | 85 | endif |
28f540f4 | 86 | |
28f540f4 RM |
87 | include Makerules |
88 | ||
737547be | 89 | ifeq ($(build-programs),yes) |
6c3ebebd | 90 | others: $(addprefix $(objpfx),$(install-bin-script)) |
737547be UD |
91 | endif |
92 | ||
28f540f4 RM |
93 | # Install from subdirectories too. |
94 | install: subdir_install | |
8d57beea | 95 | |
6736e93b UD |
96 | # Explicit dependency so that `make install-headers' works |
97 | install-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 | |
103 | elf/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 |
108 | ifeq (no,$(cross-compiling)) |
109 | ifeq (yes,$(build-shared)) | |
409dfcea UD |
110 | install: install-symbolic-link |
111 | .PHONY: install-symbolic-link | |
112 | install-symbolic-link: subdir_install | |
9d141cae | 113 | $(symbolic-link-prog) $(symbolic-link-list) |
7ef90c15 | 114 | rm -f $(symbolic-link-list) |
9d141cae | 115 | |
8d57beea | 116 | install: |
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 |
120 | ifneq (no,$(PERL)) |
121 | ifeq (/usr,$(prefix)) | |
122 | ifeq (,$(install_root)) | |
5bc2f642 | 123 | CC="$(CC)" $(PERL) scripts/test-installation.pl $(common-objpfx) |
cc3fa755 UD |
124 | endif |
125 | endif | |
126 | endif | |
1ef32c3d UD |
127 | endif |
128 | endif | |
28f540f4 | 129 | |
01a36ad3 RM |
130 | # Build subdirectory lib objects. |
131 | lib-noranlib: subdir_lib | |
28f540f4 | 132 | |
01a36ad3 RM |
133 | ifeq (yes,$(build-shared)) |
134 | # Build the shared object from the PIC object library. | |
135 | lib: $(common-objpfx)libc.so | |
136 | endif | |
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 $@ | |
149 | postclean-generated += testrun.sh | |
150 | ||
151 | others: $(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 | 158 | subdir-stubs := $(foreach dir,$(subdirs),$(common-objpfx)$(dir)/stubs) |
28f540f4 RM |
159 | |
160 | # Since stubs.h is never needed when building the library, we simplify the | |
161 | # hairy installation process by producing it in place only as the last part | |
b9b49b44 UD |
162 | # of the top-level `make install'. It depends on subdir_install, which |
163 | # iterates over all the subdirs; subdir_install in each subdir depends on | |
164 | # the subdir's stubs file. Having more direct dependencies would result in | |
165 | # extra iterations over the list for subdirs and many recursive makes. | |
d62507dd | 166 | $(inst_includedir)/gnu/stubs.h: include/stubs-prologue.h subdir_install |
5107cf1d | 167 | $(make-target-directory) |
28f540f4 | 168 | @rm -f $(objpfx)stubs.h |
d62507dd | 169 | (sed '/^@/d' $<; LC_ALL=C sort $(subdir-stubs)) > $(objpfx)stubs.h |
13a0be88 | 170 | if test -r $@ && cmp -s $(objpfx)stubs.h $@; \ |
ba1ffaa1 | 171 | then echo 'stubs.h unchanged'; \ |
d36e7692 | 172 | else $(INSTALL_DATA) $(objpfx)stubs.h $@; fi |
28f540f4 RM |
173 | rm -f $(objpfx)stubs.h |
174 | \f | |
175 | # This makes the Info or DVI file of the documentation from the Texinfo source. | |
fef0b717 UD |
176 | .PHONY: info dvi pdf html |
177 | info dvi pdf html: | |
c0e45674 | 178 | $(MAKE) $(PARALLELMFLAGS) -C manual $@ |
28f540f4 RM |
179 | \f |
180 | # This makes all the subdirectory targets. | |
181 | ||
182 | # For each target, make it depend on DIR/target for each subdirectory DIR. | |
183 | $(+subdir_targets): %: $(addsuffix /%,$(subdirs)) | |
184 | ||
185 | # Compute a list of all those targets. | |
186 | all-subdirs-targets := $(foreach dir,$(subdirs),\ | |
187 | $(addprefix $(dir)/,$(+subdir_targets))) | |
188 | ||
189 | # The action for each of those is to cd into the directory and make the | |
190 | # target there. | |
191 | $(all-subdirs-targets): | |
c0e45674 | 192 | $(MAKE) $(PARALLELMFLAGS) -C $(@D) $(@F) |
28f540f4 RM |
193 | |
194 | .PHONY: $(+subdir_targets) $(all-subdirs-targets) | |
195 | \f | |
196 | # Targets to clean things up to various degrees. | |
197 | ||
3c5edd4d UD |
198 | .PHONY: clean realclean distclean distclean-1 parent-clean parent-mostlyclean \ |
199 | tests-clean | |
28f540f4 RM |
200 | |
201 | # Subroutines of all cleaning targets. | |
202 | parent-mostlyclean: common-mostlyclean # common-mostlyclean is in Makerules. | |
4ddde9ee | 203 | -rm -f $(foreach o,$(object-suffixes-for-libc),\ |
60092701 RM |
204 | $(common-objpfx)$(patsubst %,$(libtype$o),c)) \ |
205 | $(addprefix $(objpfx),$(install-lib)) | |
28f540f4 | 206 | parent-clean: parent-mostlyclean common-clean |
da2d1bc5 UD |
207 | |
208 | postclean = $(addprefix $(common-objpfx),$(postclean-generated)) \ | |
eaeeb1eb | 209 | $(addprefix $(objpfx),sysd-dirs sysd-rules) \ |
4fcddf8e | 210 | $(addprefix $(objpfx),sysd-sorted soversions.mk soversions.i) |
28f540f4 RM |
211 | |
212 | clean: parent-clean | |
213 | # This is done this way rather than having `subdir_clean' be a | |
214 | # dependency of this target so that libc.a will be removed before the | |
215 | # subdirectories are dealt with and so they won't try to remove object | |
216 | # files from it when it's going to be removed anyway. | |
217 | @$(MAKE) subdir_clean no_deps=t | |
b5c69d99 | 218 | -rm -f $(postclean) |
28f540f4 RM |
219 | mostlyclean: parent-mostlyclean |
220 | @$(MAKE) subdir_mostlyclean no_deps=t | |
da2d1bc5 | 221 | -rm -f $(postclean) |
28f540f4 | 222 | |
3c5edd4d UD |
223 | tests-clean: |
224 | @$(MAKE) subdir_testclean no_deps=t | |
225 | ||
806e4a4a | 226 | tests: $(objpfx)c++-types-check.out |
2750c39c | 227 | ifneq ($(CXX),no) |
0a76d15e UD |
228 | ifneq (,$(wildcard scripts/data/c++-types-$(config-machine)-$(config-os).data)) |
229 | $(objpfx)c++-types-check.out: scripts/data/c++-types-$(config-machine)-$(config-os).data | |
230 | scripts/check-c++-types.sh $^ $(CXX) $(filter-out -std=gnu99,$(CFLAGS)) $(CPPFLAGS) > $@ | |
231 | else | |
2750c39c | 232 | ifneq (,$(wildcard scripts/data/c++-types-$(base-machine)-$(config-os).data)) |
806e4a4a UD |
233 | $(objpfx)c++-types-check.out: scripts/data/c++-types-$(base-machine)-$(config-os).data |
234 | scripts/check-c++-types.sh $^ $(CXX) $(filter-out -std=gnu99,$(CFLAGS)) $(CPPFLAGS) > $@ | |
235 | else | |
236 | $(objpfx)c++-types-check.out: | |
237 | @echo 'WARNING C++ tests not run; create a c++-types-XXX file' | |
238 | @echo "not run" > $@ | |
239 | endif | |
2750c39c | 240 | endif |
0a76d15e | 241 | endif |
806e4a4a | 242 | |
28f540f4 RM |
243 | # The realclean target is just like distclean for the parent, but we want |
244 | # the subdirs to know the difference in case they care. | |
245 | realclean distclean: parent-clean | |
246 | # This is done this way rather than having `subdir_distclean' be a | |
247 | # dependency of this target so that libc.a will be removed before the | |
248 | # subdirectories are dealt with and so they won't try to remove object | |
249 | # files from it when it's going to be removed anyway. | |
da2d1bc5 UD |
250 | @$(MAKE) distclean-1 no_deps=t distclean-1=$@ avoid-generated=yes \ |
251 | sysdep-subdirs="$(sysdep-subdirs)" | |
252 | -rm -f $(postclean) | |
28f540f4 RM |
253 | |
254 | # Subroutine of distclean and realclean. | |
255 | distclean-1: subdir_$(distclean-1) | |
256 | -rm -f $(config-generated) | |
60092701 RM |
257 | -rm -f $(addprefix $(objpfx),config.status config.cache config.log) |
258 | -rm -f $(addprefix $(objpfx),config.make config-name.h config.h) | |
28f540f4 RM |
259 | ifdef objdir |
260 | -rm -f $(objpfx)Makefile | |
261 | endif | |
262 | -rm -f $(sysdep-$(distclean-1)) | |
263 | \f | |
264 | .PHONY: echo_subdirs | |
265 | echo_subdirs:;@echo '$(subdirs)' | |
266 | ||
267 | .PHONY: echo-distinfo parent_echo-distinfo | |
268 | echo-distinfo: parent_echo-distinfo subdir_echo-distinfo | |
269 | parent_echo-distinfo: | |
270 | @echo $(addprefix +header+,$(headers)) \ | |
271 | $(addprefix +nodist+,$(generated)) | |
6a441471 | 272 | |
2f6d1f1b | 273 | \f |
28f540f4 RM |
274 | # Make the distribution tarfile. |
275 | ||
a709dd43 UD |
276 | distribute := README README.libm INSTALL FAQ FAQ.in NOTES NEWS BUGS \ |
277 | PROJECTS COPYING.LIB COPYING ChangeLog ChangeLog.[0-9] \ | |
afa0569f UD |
278 | ChangeLog.1[0-9] Makefile Makeconfig Makerules Rules \ |
279 | Make-dist MakeTAGS extra-lib.mk o-iterator.mk configure \ | |
518adf8c | 280 | extra-modules.mk \ |
afa0569f UD |
281 | configure.in aclocal.m4 config.h.in config.make.in \ |
282 | config-name.in Makefile.in sysdep.h set-hooks.h \ | |
283 | libc-symbols.h version.h shlib-versions rpm/Makefile \ | |
fe54a69c | 284 | rpm/template rpm/rpmrc abi-tags stub-tag.h \ |
dabb1db4 | 285 | test-skeleton.c include/des.h include/libc-internal.h \ |
e8ef6f28 | 286 | include/shlib-compat.h include/pthread.h Versions.def \ |
53da80ab | 287 | cppflags-iterator.mk tls.make.c \ |
ec503662 | 288 | include/stubs-prologue.h include/gnu/stubs.h \ |
b30542fb | 289 | include/atomic.h bits/atomic.h symbol-hacks.h \ |
53da80ab | 290 | INTERFACE CONFORMANCE NAMESPACE LICENSES \ |
5bc2f642 | 291 | $(addprefix scripts/, \ |
a709dd43 UD |
292 | rellns-sh config.sub config.guess \ |
293 | mkinstalldirs move-if-change install-sh \ | |
5edb9387 | 294 | test-installation.pl gen-FAQ.pl versions.awk\ |
6e3d59bc | 295 | gen-sorted.awk abi-versions.awk abilist.awk \ |
cc1b8268 | 296 | firstversions.awk documented.sh cpp \ |
ec503662 | 297 | output-format.sed gen-as-const.awk \ |
abbedc3f RM |
298 | merge-abilist.awk extract-abilist.awk \ |
299 | rpm2dynsym.sh \ | |
572d7b38 | 300 | ) \ |
806e4a4a | 301 | $(wildcard scripts/data/*.data) \ |
94659495 | 302 | $(wildcard abilist/*.abilist) |
28f540f4 RM |
303 | |
304 | distribute := $(strip $(distribute)) | |
c7562c74 | 305 | generated := $(generated) stubs.h |
28f540f4 | 306 | |
aaf688e8 UD |
307 | README: README.template version.h |
308 | -rm -f $@ | |
309 | sed -e 's/RELEASE/$(release)/' -e 's/VERSION/$(version)/' < $< > $@ | |
310 | # Make it unwritable so I won't change it by mistake. | |
311 | chmod 444 $@ | |
312 | ifeq ($(with-cvs),yes) | |
313 | test ! -d CVS || cvs $(CVSOPTS) commit -m'Remade for $(release)-$(version)' $@ | |
314 | endif | |
28f540f4 RM |
315 | |
316 | define format-me | |
317 | @rm -f $@ | |
318 | makeinfo --no-validate --no-warn --no-headers $< -o $@ | |
319 | -chmod a-w $@ | |
320 | endef | |
a35cb74d | 321 | INSTALL: manual/install.texi; $(format-me) |
28f540f4 | 322 | NOTES: manual/creature.texi; $(format-me) |
714a562f | 323 | manual/dir-add.texi manual/dir-add.info: FORCE |
fe7bdd63 | 324 | $(MAKE) $(PARALLELMFLAGS) -C $(@D) $(@F) |
5bc2f642 | 325 | FAQ: scripts/gen-FAQ.pl FAQ.in |
61952351 | 326 | $(PERL) $^ > $@.new && rm -f $@ && mv $@.new $@ && chmod a-w $@ |
a35cb74d UD |
327 | ifeq ($(with-cvs),yes) |
328 | test ! -d CVS || cvs $(CVSOPTS) commit -m'Regenerated: $(PERL) $^' $@ | |
329 | endif | |
f671aeab | 330 | FORCE: |
6a441471 RM |
331 | |
332 | rpm/%: subdir_distinfo | |
a709dd43 | 333 | $(MAKE) $(PARALLELMFLAGS) -C $(@D) $(@F) |
33a934a3 | 334 | |
b6342936 | 335 | iconvdata/% localedata/% po/% manual/%: |
f4017d20 UD |
336 | $(MAKE) $(PARALLELMFLAGS) -C $(@D) $(@F) |
337 | ||
a53bad16 UD |
338 | # glibc 2.0 contains some header files which aren't used with glibc 2.1 |
339 | # anymore. | |
340 | # These rules should remove those headers | |
341 | ifeq (,$(install_root)) | |
342 | ifeq ($(old-glibc-headers),yes) | |
343 | install: remove-old-headers | |
344 | endif | |
345 | endif | |
346 | ||
347 | headers2_0 := __math.h bytesex.h confname.h direntry.h elfclass.h \ | |
348 | errnos.h fcntlbits.h huge_val.h ioctl-types.h \ | |
349 | ioctls.h iovec.h jmp_buf.h libc-lock.h local_lim.h \ | |
350 | mathcalls.h mpool.h nan.h ndbm.h posix1_lim.h \ | |
351 | posix2_lim.h posix_opt.h resourcebits.h schedbits.h \ | |
352 | selectbits.h semaphorebits.h sigaction.h sigcontext.h \ | |
353 | signum.h sigset.h sockaddrcom.h socketbits.h stab.def \ | |
354 | statbuf.h statfsbuf.h stdio-lock.h stdio_lim.h \ | |
355 | syscall-list.h termbits.h timebits.h ustatbits.h \ | |
356 | utmpbits.h utsnamelen.h waitflags.h waitstatus.h \ | |
357 | xopen_lim.h gnu/types.h sys/ipc_buf.h \ | |
358 | sys/kernel_termios.h sys/msq_buf.h sys/sem_buf.h \ | |
a7ab2023 | 359 | sys/shm_buf.h sys/socketcall.h sigstack.h |
a53bad16 | 360 | |
b195f6bc | 361 | .PHONY: remove-old-headers |
a53bad16 UD |
362 | remove-old-headers: |
363 | rm -f $(addprefix $(inst_includedir)/, $(headers2_0)) |