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