1 | # Copyright (C) 1991-2002, 2003, 2004, 2005 Free Software Foundation, Inc.
|
---|
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 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.
|
---|
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 | # Lesser General Public License for more details.
|
---|
13 |
|
---|
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.
|
---|
18 |
|
---|
19 | #
|
---|
20 | # Master Makefile for the GNU C library
|
---|
21 | #
|
---|
22 | ifneq (,)
|
---|
23 | This makefile requires GNU Make.
|
---|
24 | endif
|
---|
25 |
|
---|
26 | include Makeconfig
|
---|
27 |
|
---|
28 |
|
---|
29 | # This is the default target; it makes everything except the tests.
|
---|
30 | .PHONY: all
|
---|
31 | all: lib others
|
---|
32 | |
---|
33 |
|
---|
34 | ifneq ($(AUTOCONF),no)
|
---|
35 |
|
---|
36 | ifeq ($(with-cvs),yes)
|
---|
37 | define autoconf-it-cvs
|
---|
38 | test ! -d CVS || cvs $(CVSOPTS) commit -m'Regenerated: autoconf $(ACFLAGS) $<' $@
|
---|
39 | endef
|
---|
40 | else
|
---|
41 | autoconf-it-cvs =
|
---|
42 | endif
|
---|
43 |
|
---|
44 | define autoconf-it
|
---|
45 | @-rm -f $@.new
|
---|
46 | $(AUTOCONF) $(ACFLAGS) $< > $@.new
|
---|
47 | chmod a-w,a+x $@.new
|
---|
48 | mv -f $@.new $@
|
---|
49 | $(autoconf-it-cvs)
|
---|
50 | endef
|
---|
51 |
|
---|
52 | configure: configure.in aclocal.m4; $(autoconf-it)
|
---|
53 | %/configure: %/configure.in aclocal.m4; $(autoconf-it)
|
---|
54 |
|
---|
55 | endif # $(AUTOCONF) = no
|
---|
56 |
|
---|
57 |
|
---|
58 | # We don't want to run anything here in parallel.
|
---|
59 | .NOTPARALLEL:
|
---|
60 |
|
---|
61 | # These are the targets that are made by making them in each subdirectory.
|
---|
62 | +subdir_targets := subdir_lib objects objs others subdir_mostlyclean \
|
---|
63 | subdir_clean subdir_distclean subdir_realclean \
|
---|
64 | tests xtests subdir_lint.out \
|
---|
65 | subdir_update-abi subdir_check-abi \
|
---|
66 | subdir_echo-headers \
|
---|
67 | subdir_install \
|
---|
68 | subdir_objs subdir_stubs subdir_testclean \
|
---|
69 | $(addprefix install-, no-libc.a bin lib data headers others)
|
---|
70 | |
---|
71 |
|
---|
72 | headers := limits.h values.h features.h gnu-versions.h bits/libc-lock.h \
|
---|
73 | bits/xopen_lim.h gnu/libc-version.h
|
---|
74 |
|
---|
75 | echo-headers: subdir_echo-headers
|
---|
76 |
|
---|
77 | # The headers are in the include directory.
|
---|
78 | subdir-dirs = include
|
---|
79 | vpath %.h $(subdir-dirs)
|
---|
80 |
|
---|
81 | # What to install.
|
---|
82 | install-others = $(inst_includedir)/gnu/stubs.h
|
---|
83 | install-bin-script =
|
---|
84 |
|
---|
85 | ifeq (yes,$(build-shared))
|
---|
86 | headers += gnu/lib-names.h
|
---|
87 | endif
|
---|
88 |
|
---|
89 | include Makerules
|
---|
90 |
|
---|
91 | ifeq ($(build-programs),yes)
|
---|
92 | others: $(addprefix $(objpfx),$(install-bin-script))
|
---|
93 | endif
|
---|
94 |
|
---|
95 | # Install from subdirectories too.
|
---|
96 | install: subdir_install
|
---|
97 |
|
---|
98 | # Explicit dependency so that `make install-headers' works
|
---|
99 | install-headers: install-headers-nosubdir
|
---|
100 |
|
---|
101 | # Make sure that the dynamic linker is installed before libc.
|
---|
102 | $(inst_slibdir)/libc-$(version).so: elf/ldso_install
|
---|
103 |
|
---|
104 | .PHONY: elf/ldso_install
|
---|
105 | elf/ldso_install:
|
---|
106 | $(MAKE) -C $(@D) $(@F)
|
---|
107 |
|
---|
108 | # Create links for shared libraries using the `ldconfig' program if possible.
|
---|
109 | # Ignore the error if we cannot update /etc/ld.so.cache.
|
---|
110 | ifeq (no,$(cross-compiling))
|
---|
111 | ifeq (yes,$(build-shared))
|
---|
112 | install: install-symbolic-link
|
---|
113 | .PHONY: install-symbolic-link
|
---|
114 | install-symbolic-link: subdir_install
|
---|
115 | $(symbolic-link-prog) $(symbolic-link-list)
|
---|
116 | rm -f $(symbolic-link-list)
|
---|
117 |
|
---|
118 | install:
|
---|
119 | -test ! -x $(common-objpfx)elf/ldconfig || LC_ALL=C LANGUAGE=C \
|
---|
120 | $(common-objpfx)elf/ldconfig $(addprefix -r ,$(install_root)) \
|
---|
121 | $(slibdir) $(libdir)
|
---|
122 | ifneq (no,$(PERL))
|
---|
123 | ifeq (/usr,$(prefix))
|
---|
124 | ifeq (,$(install_root))
|
---|
125 | CC="$(CC)" $(PERL) scripts/test-installation.pl $(common-objpfx)
|
---|
126 | endif
|
---|
127 | endif
|
---|
128 | endif
|
---|
129 | endif
|
---|
130 | endif
|
---|
131 |
|
---|
132 | # Build subdirectory lib objects.
|
---|
133 | lib-noranlib: subdir_lib
|
---|
134 |
|
---|
135 | ifeq (yes,$(build-shared))
|
---|
136 | # Build the shared object from the PIC object library.
|
---|
137 | lib: $(common-objpfx)libc.so
|
---|
138 | endif
|
---|
139 |
|
---|
140 |
|
---|
141 | # This is a handy script for running any dynamically linked program against
|
---|
142 | # the current libc build for testing.
|
---|
143 | $(common-objpfx)testrun.sh: $(common-objpfx)config.make \
|
---|
144 | $(..)Makeconfig $(..)Makefile
|
---|
145 | (echo '#!/bin/sh'; \
|
---|
146 | echo "GCONV_PATH='$(common-objpfx)iconvdata' \\"; \
|
---|
147 | echo 'exec $(run-program-prefix) $${1+"$$@"}'; \
|
---|
148 | ) > $@T
|
---|
149 | chmod a+x $@T
|
---|
150 | mv -f $@T $@
|
---|
151 | postclean-generated += testrun.sh
|
---|
152 |
|
---|
153 | others: $(common-objpfx)testrun.sh
|
---|
154 | |
---|
155 |
|
---|
156 | # Makerules creates a file `stubs' in each subdirectory, which
|
---|
157 | # contains `#define __stub_FUNCTION' for each function defined in that
|
---|
158 | # directory which is a stub.
|
---|
159 | # Here we paste all of these together into <gnu/stubs.h>.
|
---|
160 |
|
---|
161 | subdir-stubs := $(foreach dir,$(subdirs),$(common-objpfx)$(dir)/stubs)
|
---|
162 |
|
---|
163 | ifeq ($(biarch),no)
|
---|
164 | installed-stubs = $(inst_includedir)/gnu/stubs.h
|
---|
165 | else
|
---|
166 | installed-stubs = $(inst_includedir)/gnu/stubs-$(biarch).h
|
---|
167 |
|
---|
168 | $(inst_includedir)/gnu/stubs.h: include/stubs-biarch.h $(+force)
|
---|
169 | $(INSTALL_DATA) $< $@
|
---|
170 |
|
---|
171 | install-others-nosubdir: $(installed-stubs)
|
---|
172 | endif
|
---|
173 |
|
---|
174 |
|
---|
175 | # Since stubs.h is never needed when building the library, we simplify the
|
---|
176 | # hairy installation process by producing it in place only as the last part
|
---|
177 | # of the top-level `make install'. It depends on subdir_install, which
|
---|
178 | # iterates over all the subdirs; subdir_install in each subdir depends on
|
---|
179 | # the subdir's stubs file. Having more direct dependencies would result in
|
---|
180 | # extra iterations over the list for subdirs and many recursive makes.
|
---|
181 | $(installed-stubs): include/stubs-prologue.h subdir_install
|
---|
182 | $(make-target-directory)
|
---|
183 | @rm -f $(objpfx)stubs.h
|
---|
184 | (sed '/^@/d' $<; LC_ALL=C sort $(subdir-stubs)) > $(objpfx)stubs.h
|
---|
185 | if test -r $@ && cmp -s $(objpfx)stubs.h $@; \
|
---|
186 | then echo 'stubs.h unchanged'; \
|
---|
187 | else $(INSTALL_DATA) $(objpfx)stubs.h $@; fi
|
---|
188 | rm -f $(objpfx)stubs.h
|
---|
189 | |
---|
190 |
|
---|
191 | # This makes the Info or DVI file of the documentation from the Texinfo source.
|
---|
192 | .PHONY: info dvi pdf html
|
---|
193 | info dvi pdf html:
|
---|
194 | $(MAKE) $(PARALLELMFLAGS) -C manual $@
|
---|
195 | |
---|
196 |
|
---|
197 | # This makes all the subdirectory targets.
|
---|
198 |
|
---|
199 | # For each target, make it depend on DIR/target for each subdirectory DIR.
|
---|
200 | $(+subdir_targets): %: $(addsuffix /%,$(subdirs))
|
---|
201 |
|
---|
202 | # Compute a list of all those targets.
|
---|
203 | all-subdirs-targets := $(foreach dir,$(subdirs),\
|
---|
204 | $(addprefix $(dir)/,$(+subdir_targets)))
|
---|
205 |
|
---|
206 | # The action for each of those is to cd into the directory and make the
|
---|
207 | # target there.
|
---|
208 | $(all-subdirs-targets):
|
---|
209 | $(MAKE) $(PARALLELMFLAGS) -C $(@D) $(@F)
|
---|
210 |
|
---|
211 | .PHONY: $(+subdir_targets) $(all-subdirs-targets)
|
---|
212 | |
---|
213 |
|
---|
214 | # Targets to clean things up to various degrees.
|
---|
215 |
|
---|
216 | .PHONY: clean realclean distclean distclean-1 parent-clean parent-mostlyclean \
|
---|
217 | tests-clean
|
---|
218 |
|
---|
219 | # Subroutines of all cleaning targets.
|
---|
220 | parent-mostlyclean: common-mostlyclean # common-mostlyclean is in Makerules.
|
---|
221 | -rm -f $(foreach o,$(object-suffixes-for-libc),\
|
---|
222 | $(common-objpfx)$(patsubst %,$(libtype$o),c)) \
|
---|
223 | $(addprefix $(objpfx),$(install-lib))
|
---|
224 | parent-clean: parent-mostlyclean common-clean
|
---|
225 |
|
---|
226 | postclean = $(addprefix $(common-objpfx),$(postclean-generated)) \
|
---|
227 | $(addprefix $(objpfx),sysd-dirs sysd-rules) \
|
---|
228 | $(addprefix $(objpfx),sysd-sorted soversions.mk soversions.i)
|
---|
229 |
|
---|
230 | clean: parent-clean
|
---|
231 | # This is done this way rather than having `subdir_clean' be a
|
---|
232 | # dependency of this target so that libc.a will be removed before the
|
---|
233 | # subdirectories are dealt with and so they won't try to remove object
|
---|
234 | # files from it when it's going to be removed anyway.
|
---|
235 | @$(MAKE) subdir_clean no_deps=t
|
---|
236 | -rm -f $(postclean)
|
---|
237 | mostlyclean: parent-mostlyclean
|
---|
238 | @$(MAKE) subdir_mostlyclean no_deps=t
|
---|
239 | -rm -f $(postclean)
|
---|
240 |
|
---|
241 | tests-clean:
|
---|
242 | @$(MAKE) subdir_testclean no_deps=t
|
---|
243 |
|
---|
244 | tests: $(objpfx)c++-types-check.out
|
---|
245 | ifneq ($(CXX),no)
|
---|
246 | check-data := $(firstword $(wildcard \
|
---|
247 | $(foreach M,$(config-machine) $(base-machine),\
|
---|
248 | scripts/data/c++-types-$M-$(config-os).data)))
|
---|
249 | ifneq (,$(check-data))
|
---|
250 | $(objpfx)c++-types-check.out: $(check-data)
|
---|
251 | scripts/check-c++-types.sh $^ $(CXX) $(filter-out -std=gnu99 -Wstrict-prototypes,$(CFLAGS)) $(CPPFLAGS) > $@
|
---|
252 | else
|
---|
253 | $(objpfx)c++-types-check.out:
|
---|
254 | @echo 'WARNING C++ tests not run; create a c++-types-XXX file'
|
---|
255 | @echo "not run" > $@
|
---|
256 | endif
|
---|
257 | endif
|
---|
258 |
|
---|
259 | # The realclean target is just like distclean for the parent, but we want
|
---|
260 | # the subdirs to know the difference in case they care.
|
---|
261 | realclean distclean: parent-clean
|
---|
262 | # This is done this way rather than having `subdir_distclean' be a
|
---|
263 | # dependency of this target so that libc.a will be removed before the
|
---|
264 | # subdirectories are dealt with and so they won't try to remove object
|
---|
265 | # files from it when it's going to be removed anyway.
|
---|
266 | @$(MAKE) distclean-1 no_deps=t distclean-1=$@ avoid-generated=yes \
|
---|
267 | sysdep-subdirs="$(sysdep-subdirs)"
|
---|
268 | -rm -f $(postclean)
|
---|
269 |
|
---|
270 | # Subroutine of distclean and realclean.
|
---|
271 | distclean-1: subdir_$(distclean-1)
|
---|
272 | -rm -f $(config-generated)
|
---|
273 | -rm -f $(addprefix $(objpfx),config.status config.cache config.log)
|
---|
274 | -rm -f $(addprefix $(objpfx),config.make config-name.h config.h)
|
---|
275 | ifdef objdir
|
---|
276 | -rm -f $(objpfx)Makefile
|
---|
277 | endif
|
---|
278 | -rm -f $(sysdep-$(distclean-1))
|
---|
279 | |
---|
280 |
|
---|
281 | # Make the distribution tarfile.
|
---|
282 | .PHONY: dist tag-for-dist
|
---|
283 |
|
---|
284 | generated := $(generated) stubs.h
|
---|
285 |
|
---|
286 | README: README.template version.h
|
---|
287 | -rm -f $@
|
---|
288 | sed -e 's/RELEASE/$(release)/' -e 's/VERSION/$(version)/' < $< > $@
|
---|
289 | # Make it unwritable so I won't change it by mistake.
|
---|
290 | chmod 444 $@
|
---|
291 | ifeq ($(with-cvs),yes)
|
---|
292 | test ! -d CVS || cvs $(CVSOPTS) commit -m'Remade for $(release)-$(version)' $@
|
---|
293 | endif
|
---|
294 |
|
---|
295 | files-for-dist := README FAQ INSTALL NOTES configure
|
---|
296 |
|
---|
297 | tag-of-stem = glibc-$(subst .,_,$*)
|
---|
298 |
|
---|
299 | # Add-ons in the main repository but distributed in their own tar files.
|
---|
300 | dist-separate = libidn linuxthreads
|
---|
301 |
|
---|
302 | # Directories in each add-on.
|
---|
303 | dist-separate-libidn = libidn
|
---|
304 | dist-separate-linuxthreads = linuxthreads linuxthreads_db
|
---|
305 |
|
---|
306 | glibc-%.tar $(dist-separate:%=glibc-%-%.tar): $(files-for-dist) \
|
---|
307 | $(foreach D,$(dist-separate),\
|
---|
308 | $D/configure)
|
---|
309 | @rm -fr glibc-$*
|
---|
310 | $(MAKE) -q `find sysdeps $(addsuffix /sysdeps,$(add-ons)) \
|
---|
311 | -name configure`
|
---|
312 | cvs $(CVSOPTS) -Q export -d glibc-$* -r $(tag-of-stem) libc
|
---|
313 | # Touch all the configure scripts going into the tarball since cvs export
|
---|
314 | # might have delivered configure.in newer than configure.
|
---|
315 | find glibc-$* -name configure -print | xargs touch
|
---|
316 | $(dist-do-separate-dirs)
|
---|
317 | tar cf glibc-$*.tar glibc-$*
|
---|
318 | rm -fr glibc-$*
|
---|
319 | define dist-do-separate-dirs
|
---|
320 | $(foreach dir,$(dist-separate),
|
---|
321 | tar cf glibc-$(dir)-$*.tar -C glibc-$* $(dist-separate-$(dir))
|
---|
322 | rm -rf $(addprefix glibc-$*/,$(dist-separate-$(dir)))
|
---|
323 | )
|
---|
324 | endef
|
---|
325 |
|
---|
326 | # Do `make dist dist-version=X.Y.Z' to make tar files of an older version.
|
---|
327 | dist-version = $(version)
|
---|
328 |
|
---|
329 | dist: $(foreach Z,.bz2 .gz,glibc-$(dist-version).tar$Z \
|
---|
330 | $(foreach D,$(dist-separate),\
|
---|
331 | glibc-$D-$(dist-version).tar$Z))
|
---|
332 | md5sum $^
|
---|
333 |
|
---|
334 | tag-for-dist: tag-$(dist-version)
|
---|
335 | tag-%: $(files-for-dist)
|
---|
336 | cvs $(CVSOPTS) -Q tag -c $(tag-of-stem)
|
---|
337 |
|
---|
338 | define format-me
|
---|
339 | @rm -f $@
|
---|
340 | makeinfo --no-validate --no-warn --no-headers $< -o $@
|
---|
341 | -chmod a-w $@
|
---|
342 | endef
|
---|
343 | INSTALL: manual/install.texi; $(format-me)
|
---|
344 | NOTES: manual/creature.texi; $(format-me)
|
---|
345 | manual/dir-add.texi manual/dir-add.info: FORCE
|
---|
346 | $(MAKE) $(PARALLELMFLAGS) -C $(@D) $(@F)
|
---|
347 | FAQ: scripts/gen-FAQ.pl FAQ.in
|
---|
348 | $(PERL) $^ > $@.new && rm -f $@ && mv $@.new $@ && chmod a-w $@
|
---|
349 | ifeq ($(with-cvs),yes)
|
---|
350 | test ! -d CVS || cvs $(CVSOPTS) commit -m'Regenerated: $(PERL) $^' $@
|
---|
351 | endif
|
---|
352 | FORCE:
|
---|
353 |
|
---|
354 | iconvdata/% localedata/% po/% manual/%:
|
---|
355 | $(MAKE) $(PARALLELMFLAGS) -C $(@D) $(@F)
|
---|
356 |
|
---|
357 | # glibc 2.0 contains some header files which aren't used with glibc 2.1
|
---|
358 | # anymore.
|
---|
359 | # These rules should remove those headers
|
---|
360 | ifeq (,$(install_root))
|
---|
361 | ifeq ($(old-glibc-headers),yes)
|
---|
362 | install: remove-old-headers
|
---|
363 | endif
|
---|
364 | endif
|
---|
365 |
|
---|
366 | headers2_0 := __math.h bytesex.h confname.h direntry.h elfclass.h \
|
---|
367 | errnos.h fcntlbits.h huge_val.h ioctl-types.h \
|
---|
368 | ioctls.h iovec.h jmp_buf.h libc-lock.h local_lim.h \
|
---|
369 | mathcalls.h mpool.h nan.h ndbm.h posix1_lim.h \
|
---|
370 | posix2_lim.h posix_opt.h resourcebits.h schedbits.h \
|
---|
371 | selectbits.h semaphorebits.h sigaction.h sigcontext.h \
|
---|
372 | signum.h sigset.h sockaddrcom.h socketbits.h stab.def \
|
---|
373 | statbuf.h statfsbuf.h stdio-lock.h stdio_lim.h \
|
---|
374 | syscall-list.h termbits.h timebits.h ustatbits.h \
|
---|
375 | utmpbits.h utsnamelen.h waitflags.h waitstatus.h \
|
---|
376 | xopen_lim.h gnu/types.h sys/ipc_buf.h \
|
---|
377 | sys/kernel_termios.h sys/msq_buf.h sys/sem_buf.h \
|
---|
378 | sys/shm_buf.h sys/socketcall.h sigstack.h
|
---|
379 |
|
---|
380 | .PHONY: remove-old-headers
|
---|
381 | remove-old-headers:
|
---|
382 | rm -f $(addprefix $(inst_includedir)/, $(headers2_0))
|
---|