]> git.ipfire.org Git - thirdparty/glibc.git/blob - Makefile
Update.
[thirdparty/glibc.git] / Makefile
1 # Copyright (C) 1991-2002, 2003 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 \f
33 ifneq ($(AUTOCONF),no)
34
35 ifeq ($(with-cvs),yes)
36 define autoconf-it-cvs
37 test ! -d CVS || cvs $(CVSOPTS) commit -m'Regenerated: autoconf $(ACFLAGS) $<' $@
38 endef
39 else
40 autoconf-it-cvs =
41 endif
42
43 define autoconf-it
44 @-rm -f $@.new
45 $(AUTOCONF) $(ACFLAGS) $< > $@.new
46 chmod a-w,a+x $@.new
47 mv -f $@.new $@
48 $(autoconf-it-cvs)
49 endef
50
51 configure: configure.in aclocal.m4; $(autoconf-it)
52 %/configure: %/configure.in aclocal.m4; $(autoconf-it)
53
54 endif # $(AUTOCONF) = no
55
56
57 # We don't want to run anything here in parallel.
58 .NOTPARALLEL:
59
60 # These are the targets that are made by making them in each subdirectory.
61 +subdir_targets := subdir_lib objects objs others subdir_mostlyclean \
62 subdir_clean subdir_distclean subdir_realclean \
63 tests xtests subdir_lint.out \
64 subdir_update-abi subdir_check-abi subdir_distinfo \
65 subdir_echo-headers subdir_echo-distinfo \
66 subdir_install \
67 subdir_testclean \
68 $(addprefix install-, no-libc.a bin lib data headers others)
69 \f
70 headers := limits.h values.h features.h gnu-versions.h bits/libc-lock.h \
71 bits/xopen_lim.h gnu/libc-version.h
72
73 echo-headers: subdir_echo-headers
74
75 # The headers are in the include directory.
76 subdir-dirs = include
77 vpath %.h $(subdir-dirs)
78
79 # What to install.
80 install-others = $(inst_includedir)/gnu/stubs.h
81 install-bin-script = glibcbug
82
83 ifeq (yes,$(build-shared))
84 headers += gnu/lib-names.h
85 endif
86
87 include Makerules
88
89 ifeq ($(build-programs),yes)
90 others: $(addprefix $(objpfx),$(install-bin-script))
91 endif
92
93 # Install from subdirectories too.
94 install: subdir_install
95
96 # Explicit dependency so that `make install-headers' works
97 install-headers: install-headers-nosubdir
98
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
106 # Create links for shared libraries using the `ldconfig' program if possible.
107 # Ignore the error if we cannot update /etc/ld.so.cache.
108 ifeq (no,$(cross-compiling))
109 ifeq (yes,$(build-shared))
110 install: install-symbolic-link
111 .PHONY: install-symbolic-link
112 install-symbolic-link: subdir_install
113 $(symbolic-link-prog) $(symbolic-link-list)
114 rm -f $(symbolic-link-list)
115
116 install:
117 -test ! -x $(common-objpfx)elf/ldconfig || LC_ALL=C LANGUAGE=C \
118 $(common-objpfx)elf/ldconfig $(addprefix -r ,$(install_root)) \
119 $(slibdir) $(libdir)
120 ifneq (no,$(PERL))
121 ifeq (/usr,$(prefix))
122 ifeq (,$(install_root))
123 CC="$(CC)" $(PERL) scripts/test-installation.pl $(common-objpfx)
124 endif
125 endif
126 endif
127 endif
128 endif
129
130 # Build subdirectory lib objects.
131 lib-noranlib: subdir_lib
132
133 ifeq (yes,$(build-shared))
134 # Build the shared object from the PIC object library.
135 lib: $(common-objpfx)libc.so
136 endif
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
152 \f
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.
156 # Here we paste all of these together into <gnu/stubs.h>.
157
158 subdir-stubs := $(foreach dir,$(subdirs),$(common-objpfx)$(dir)/stubs)
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
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.
166 $(inst_includedir)/gnu/stubs.h: include/stubs-prologue.h subdir_install
167 $(make-target-directory)
168 @rm -f $(objpfx)stubs.h
169 (sed '/^@/d' $<; LC_ALL=C sort $(subdir-stubs)) > $(objpfx)stubs.h
170 if test -r $@ && cmp -s $(objpfx)stubs.h $@; \
171 then echo 'stubs.h unchanged'; \
172 else $(INSTALL_DATA) $(objpfx)stubs.h $@; fi
173 rm -f $(objpfx)stubs.h
174 \f
175 # The `glibcbug' script contains the version number and it shall be rebuild
176 # whenever this changes or the `glibcbug.in' file.
177 $(objpfx)glibcbug: $(common-objpfx)config.status glibcbug.in
178 cd $(<D) && CONFIG_FILES=$(@F) CONFIG_HEADERS= $(SHELL) $(<F)
179 \f
180 # This makes the Info or DVI file of the documentation from the Texinfo source.
181 .PHONY: info dvi pdf html
182 info dvi pdf html:
183 $(MAKE) $(PARALLELMFLAGS) -C manual $@
184 \f
185 # This makes all the subdirectory targets.
186
187 # For each target, make it depend on DIR/target for each subdirectory DIR.
188 $(+subdir_targets): %: $(addsuffix /%,$(subdirs))
189
190 # Compute a list of all those targets.
191 all-subdirs-targets := $(foreach dir,$(subdirs),\
192 $(addprefix $(dir)/,$(+subdir_targets)))
193
194 # The action for each of those is to cd into the directory and make the
195 # target there.
196 $(all-subdirs-targets):
197 $(MAKE) $(PARALLELMFLAGS) -C $(@D) $(@F)
198
199 .PHONY: $(+subdir_targets) $(all-subdirs-targets)
200 \f
201 # Targets to clean things up to various degrees.
202
203 .PHONY: clean realclean distclean distclean-1 parent-clean parent-mostlyclean \
204 tests-clean
205
206 # Subroutines of all cleaning targets.
207 parent-mostlyclean: common-mostlyclean # common-mostlyclean is in Makerules.
208 -rm -f $(foreach o,$(object-suffixes-for-libc),\
209 $(common-objpfx)$(patsubst %,$(libtype$o),c)) \
210 $(addprefix $(objpfx),$(install-lib))
211 parent-clean: parent-mostlyclean common-clean
212
213 postclean = $(addprefix $(common-objpfx),$(postclean-generated)) \
214 $(addprefix $(objpfx),sysd-dirs sysd-rules) \
215 $(addprefix $(objpfx),sysd-sorted soversions.mk soversions.i)
216
217 clean: parent-clean
218 # This is done this way rather than having `subdir_clean' 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.
222 @$(MAKE) subdir_clean no_deps=t
223 -rm -f $(postclean)
224 mostlyclean: parent-mostlyclean
225 @$(MAKE) subdir_mostlyclean no_deps=t
226 -rm -f $(postclean)
227
228 tests-clean:
229 @$(MAKE) subdir_testclean no_deps=t
230
231 tests: $(objpfx)c++-types-check.out
232 ifneq (no,$(CXX)$(wildcard scripts/data/c++-types-$(base-machine)-$(config-os).data))
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
240
241 # The realclean target is just like distclean for the parent, but we want
242 # the subdirs to know the difference in case they care.
243 realclean distclean: parent-clean
244 # This is done this way rather than having `subdir_distclean' be a
245 # dependency of this target so that libc.a will be removed before the
246 # subdirectories are dealt with and so they won't try to remove object
247 # files from it when it's going to be removed anyway.
248 @$(MAKE) distclean-1 no_deps=t distclean-1=$@ avoid-generated=yes \
249 sysdep-subdirs="$(sysdep-subdirs)"
250 -rm -f $(postclean)
251
252 # Subroutine of distclean and realclean.
253 distclean-1: subdir_$(distclean-1)
254 -rm -f $(config-generated)
255 -rm -f $(addprefix $(objpfx),config.status config.cache config.log)
256 -rm -f $(addprefix $(objpfx),config.make config-name.h config.h)
257 -rm -f $(addprefix $(objpfx),glibcbug)
258 ifdef objdir
259 -rm -f $(objpfx)Makefile
260 endif
261 -rm -f $(sysdep-$(distclean-1))
262 \f
263 .PHONY: echo_subdirs
264 echo_subdirs:;@echo '$(subdirs)'
265
266 .PHONY: echo-distinfo parent_echo-distinfo
267 echo-distinfo: parent_echo-distinfo subdir_echo-distinfo
268 parent_echo-distinfo:
269 @echo $(addprefix +header+,$(headers)) \
270 $(addprefix +nodist+,$(generated))
271
272 \f
273 # Make the distribution tarfile.
274
275 distribute := README README.libm INSTALL FAQ FAQ.in NOTES NEWS BUGS \
276 PROJECTS COPYING.LIB COPYING ChangeLog ChangeLog.[0-9] \
277 ChangeLog.1[0-9] Makefile Makeconfig Makerules Rules \
278 Make-dist MakeTAGS extra-lib.mk o-iterator.mk configure \
279 configure.in aclocal.m4 config.h.in config.make.in \
280 config-name.in Makefile.in sysdep.h set-hooks.h \
281 libc-symbols.h version.h shlib-versions rpm/Makefile \
282 rpm/template rpm/rpmrc glibcbug.in abi-tags stub-tag.h \
283 test-skeleton.c include/des.h include/libc-internal.h \
284 include/shlib-compat.h include/pthread.h Versions.def \
285 cppflags-iterator.mk tls.make.c \
286 include/stubs-prologue.h include/gnu/stubs.h \
287 include/atomic.h bits/atomic.h \
288 INTERFACE CONFORMANCE NAMESPACE LICENSES \
289 $(addprefix scripts/, \
290 rellns-sh config.sub config.guess \
291 mkinstalldirs move-if-change install-sh \
292 test-installation.pl gen-FAQ.pl versions.awk\
293 gen-sorted.awk abi-versions.awk abilist.awk \
294 firstversions.awk documented.sh cpp \
295 output-format.sed gen-as-const.awk \
296 merge-abilist.awk extract-abilist.awk \
297 rpm2dynsym.sh \
298 ) \
299 $(wildcard scripts/data/*.data) \
300 $(wildcard abilist/*.abilist)
301
302 distribute := $(strip $(distribute))
303 generated := $(generated) stubs.h
304
305 README: README.template version.h
306 -rm -f $@
307 sed -e 's/RELEASE/$(release)/' -e 's/VERSION/$(version)/' < $< > $@
308 # Make it unwritable so I won't change it by mistake.
309 chmod 444 $@
310 ifeq ($(with-cvs),yes)
311 test ! -d CVS || cvs $(CVSOPTS) commit -m'Remade for $(release)-$(version)' $@
312 endif
313
314 define format-me
315 @rm -f $@
316 makeinfo --no-validate --no-warn --no-headers $< -o $@
317 -chmod a-w $@
318 endef
319 INSTALL: manual/install.texi; $(format-me)
320 NOTES: manual/creature.texi; $(format-me)
321 manual/dir-add.texi manual/dir-add.info: FORCE
322 $(MAKE) $(PARALLELMFLAGS) -C $(@D) $(@F)
323 FAQ: scripts/gen-FAQ.pl FAQ.in
324 $(PERL) $^ > $@.new && rm -f $@ && mv $@.new $@ && chmod a-w $@
325 ifeq ($(with-cvs),yes)
326 test ! -d CVS || cvs $(CVSOPTS) commit -m'Regenerated: $(PERL) $^' $@
327 endif
328 FORCE:
329
330 rpm/%: subdir_distinfo
331 $(MAKE) $(PARALLELMFLAGS) -C $(@D) $(@F)
332
333 iconvdata/% localedata/% po/% manual/%:
334 $(MAKE) $(PARALLELMFLAGS) -C $(@D) $(@F)
335
336 # glibc 2.0 contains some header files which aren't used with glibc 2.1
337 # anymore.
338 # These rules should remove those headers
339 ifeq (,$(install_root))
340 ifeq ($(old-glibc-headers),yes)
341 install: remove-old-headers
342 endif
343 endif
344
345 headers2_0 := __math.h bytesex.h confname.h direntry.h elfclass.h \
346 errnos.h fcntlbits.h huge_val.h ioctl-types.h \
347 ioctls.h iovec.h jmp_buf.h libc-lock.h local_lim.h \
348 mathcalls.h mpool.h nan.h ndbm.h posix1_lim.h \
349 posix2_lim.h posix_opt.h resourcebits.h schedbits.h \
350 selectbits.h semaphorebits.h sigaction.h sigcontext.h \
351 signum.h sigset.h sockaddrcom.h socketbits.h stab.def \
352 statbuf.h statfsbuf.h stdio-lock.h stdio_lim.h \
353 syscall-list.h termbits.h timebits.h ustatbits.h \
354 utmpbits.h utsnamelen.h waitflags.h waitstatus.h \
355 xopen_lim.h gnu/types.h sys/ipc_buf.h \
356 sys/kernel_termios.h sys/msq_buf.h sys/sem_buf.h \
357 sys/shm_buf.h sys/socketcall.h sigstack.h
358
359 .PHONY: remove-old-headers
360 remove-old-headers:
361 rm -f $(addprefix $(inst_includedir)/, $(headers2_0))