1 # Copyright (C) 1991-2002, 2003, 2004 Free Software Foundation, Inc.
2 # This file is part of the GNU C Library.
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.
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.
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
20 # Master Makefile for the GNU C library
23 This makefile requires GNU Make.
29 # This is the default target; it makes everything except the tests.
33 ifneq ($(AUTOCONF
),no
)
35 ifeq ($(with-cvs
),yes
)
36 define autoconf-it-cvs
37 test ! -d CVS || cvs
$(CVSOPTS
) commit
-m
'Regenerated: autoconf $(ACFLAGS) $<' $@
45 $(AUTOCONF
) $(ACFLAGS
) $< > $@.new
51 configure
: configure.in aclocal.m4
; $(autoconf-it
)
52 %/configure
: %/configure.in aclocal.m4
; $(autoconf-it
)
54 endif # $(AUTOCONF) = no
57 # We don't want to run anything here in parallel.
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 \
68 $(addprefix install-
, no-libc.a bin lib data headers others
)
70 headers
:= limits.h values.h features.h gnu-versions.h bits
/libc-lock.h \
71 bits
/xopen_lim.h gnu
/libc-version.h
73 echo-headers
: subdir_echo-headers
75 # The headers are in the include directory.
77 vpath
%.h
$(subdir-dirs
)
80 install-others
= $(inst_includedir
)/gnu
/stubs.h
83 ifeq (yes
,$(build-shared
))
84 headers
+= gnu
/lib-names.h
89 ifeq ($(build-programs
),yes
)
90 others
: $(addprefix $(objpfx
),$(install-bin-script
))
93 # Install from subdirectories too.
94 install: subdir_install
96 # Explicit dependency so that `make install-headers' works
97 install-headers
: install-headers-nosubdir
99 # Make sure that the dynamic linker is installed before libc.
100 $(inst_slibdir
)/libc-
$(version
).so
: elf
/ldso_install
102 .PHONY
: elf
/ldso_install
104 $(MAKE
) -C
$(@D
) $(@F
)
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
)
117 -test ! -x
$(common-objpfx
)elf
/ldconfig || LC_ALL
=C LANGUAGE
=C \
118 $(common-objpfx
)elf
/ldconfig
$(addprefix -r
,$(install_root
)) \
121 ifeq (/usr
,$(prefix))
122 ifeq (,$(install_root
))
123 CC
="$(CC)" $(PERL
) scripts
/test-installation.pl
$(common-objpfx
)
130 # Build subdirectory lib objects.
131 lib-noranlib
: subdir_lib
133 ifeq (yes
,$(build-shared
))
134 # Build the shared object from the PIC object library.
135 lib
: $(common-objpfx
)libc.so
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
144 echo
"GCONV_PATH='$(common-objpfx)iconvdata' \\"; \
145 echo
'exec $(run-program-prefix) $${1+"$$@"}'; \
149 postclean-generated
+= testrun.sh
151 others
: $(common-objpfx
)testrun.sh
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>.
158 subdir-stubs
:= $(foreach dir,$(subdirs
),$(common-objpfx
)$(dir)/stubs
)
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
175 # This makes the Info or DVI file of the documentation from the Texinfo source.
176 .PHONY
: info dvi pdf html
178 $(MAKE
) $(PARALLELMFLAGS
) -C manual
$@
180 # This makes all the subdirectory targets.
182 # For each target, make it depend on DIR/target for each subdirectory DIR.
183 $(+subdir_targets
): %: $(addsuffix /%,$(subdirs
))
185 # Compute a list of all those targets.
186 all-subdirs-targets
:= $(foreach dir,$(subdirs
),\
187 $(addprefix $(dir)/,$(+subdir_targets
)))
189 # The action for each of those is to cd into the directory and make the
191 $(all-subdirs-targets
):
192 $(MAKE
) $(PARALLELMFLAGS
) -C
$(@D
) $(@F
)
194 .PHONY
: $(+subdir_targets
) $(all-subdirs-targets
)
196 # Targets to clean things up to various degrees.
198 .PHONY
: clean realclean distclean distclean-1 parent-clean parent-mostlyclean \
201 # Subroutines of all cleaning targets.
202 parent-mostlyclean
: common-mostlyclean
# common-mostlyclean is in Makerules.
203 -rm -f
$(foreach o
,$(object-suffixes-for-libc
),\
204 $(common-objpfx
)$(patsubst %,$(libtype
$o),c
)) \
205 $(addprefix $(objpfx
),$(install-lib
))
206 parent-clean
: parent-mostlyclean common-clean
208 postclean
= $(addprefix $(common-objpfx
),$(postclean-generated
)) \
209 $(addprefix $(objpfx
),sysd-dirs sysd-rules
) \
210 $(addprefix $(objpfx
),sysd-sorted soversions.mk soversions.i
)
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
219 mostlyclean: parent-mostlyclean
220 @
$(MAKE
) subdir_mostlyclean no_deps
=t
224 @
$(MAKE
) subdir_testclean no_deps
=t
226 tests
: $(objpfx
)c
++-types-check.out
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
) > $@
232 ifneq (,$(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
) > $@
236 $(objpfx
)c
++-types-check.out
:
237 @echo
'WARNING C++ tests not run; create a c++-types-XXX file'
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.
250 @
$(MAKE
) distclean-1 no_deps
=t distclean-1
=$@ avoid-generated
=yes \
251 sysdep-subdirs
="$(sysdep-subdirs)"
254 # Subroutine of distclean and realclean.
255 distclean-1
: subdir_
$(distclean-1
)
256 -rm -f
$(config-generated
)
257 -rm -f
$(addprefix $(objpfx
),config.status config.cache config.log
)
258 -rm -f
$(addprefix $(objpfx
),config.make config-name.h config.h
)
260 -rm -f
$(objpfx
)Makefile
262 -rm -f
$(sysdep-
$(distclean-1
))
265 echo_subdirs
:;@echo
'$(subdirs)'
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
))
274 # Make the distribution tarfile.
276 distribute
:= README README.libm INSTALL FAQ FAQ.in NOTES NEWS BUGS \
277 PROJECTS COPYING.LIB COPYING ChangeLog ChangeLog.
[0-9] \
278 ChangeLog
.1[0-9] Makefile Makeconfig Makerules Rules \
279 Make-dist MakeTAGS extra-lib.mk o-iterator.mk configure \
280 configure.in aclocal.m4 config.h.in config.make.in \
281 config-name.in Makefile.in sysdep.h set-hooks.h \
282 libc-symbols.h version.h shlib-versions rpm
/Makefile \
283 rpm
/template rpm
/rpmrc abi-tags stub-tag.h \
284 test-skeleton.c
include/des.h
include/libc-internal.h \
285 include/shlib-compat.h
include/pthread.h Versions.def \
286 cppflags-iterator.mk tls.make.c \
287 include/stubs-prologue.h
include/gnu
/stubs.h \
288 include/atomic.h bits
/atomic.h \
289 INTERFACE CONFORMANCE NAMESPACE LICENSES \
290 $(addprefix scripts
/, \
291 rellns-sh config.sub config.guess \
292 mkinstalldirs move-if-change install-sh \
293 test-installation.pl gen-FAQ.pl versions.awk\
294 gen-sorted.awk abi-versions.awk abilist.awk \
295 firstversions.awk documented.sh
cpp \
296 output-format.sed gen-as-const.awk \
297 merge-abilist.awk extract-abilist.awk \
300 $(wildcard scripts
/data
/*.data
) \
301 $(wildcard abilist
/*.abilist
)
303 distribute
:= $(strip $(distribute
))
304 generated
:= $(generated
) stubs.h
306 README
: README.template version.h
308 sed
-e
's/RELEASE/$(release)/' -e
's/VERSION/$(version)/' < $< > $@
309 # Make it unwritable so I won't change it by mistake.
311 ifeq ($(with-cvs
),yes
)
312 test ! -d CVS || cvs
$(CVSOPTS
) commit
-m
'Remade for $(release)-$(version)' $@
317 makeinfo --no-validate
--no-warn
--no-headers
$< -o
$@
320 INSTALL
: manual
/install.texi
; $(format-me
)
321 NOTES
: manual
/creature.texi
; $(format-me
)
322 manual
/dir-add.texi manual
/dir-add.
info: FORCE
323 $(MAKE
) $(PARALLELMFLAGS
) -C
$(@D
) $(@F
)
324 FAQ
: scripts
/gen-FAQ.pl FAQ.in
325 $(PERL
) $^
> $@.new
&& rm -f
$@
&& mv
$@.new
$@
&& chmod a-w
$@
326 ifeq ($(with-cvs
),yes
)
327 test ! -d CVS || cvs
$(CVSOPTS
) commit
-m
'Regenerated: $(PERL) $^' $@
331 rpm
/%: subdir_distinfo
332 $(MAKE
) $(PARALLELMFLAGS
) -C
$(@D
) $(@F
)
334 iconvdata
/% localedata
/% po
/% manual
/%:
335 $(MAKE
) $(PARALLELMFLAGS
) -C
$(@D
) $(@F
)
337 # glibc 2.0 contains some header files which aren't used with glibc 2.1
339 # These rules should remove those headers
340 ifeq (,$(install_root
))
341 ifeq ($(old-glibc-headers
),yes
)
342 install: remove-old-headers
346 headers2_0
:= __math.h bytesex.h confname.h direntry.h elfclass.h \
347 errnos.h fcntlbits.h huge_val.h ioctl-types.h \
348 ioctls.h iovec.h jmp_buf.h libc-lock.h local_lim.h \
349 mathcalls.h mpool.h nan.h ndbm.h posix1_lim.h \
350 posix2_lim.h posix_opt.h resourcebits.h schedbits.h \
351 selectbits.h semaphorebits.h sigaction.h sigcontext.h \
352 signum.h sigset.h sockaddrcom.h socketbits.h stab.def \
353 statbuf.h statfsbuf.h stdio-lock.h stdio_lim.h \
354 syscall-list.h termbits.h timebits.h ustatbits.h \
355 utmpbits.h utsnamelen.h waitflags.h waitstatus.h \
356 xopen_lim.h gnu
/types.h sys
/ipc_buf.h \
357 sys
/kernel_termios.h sys
/msq_buf.h sys
/sem_buf.h \
358 sys
/shm_buf.h sys
/socketcall.h sigstack.h
360 .PHONY
: remove-old-headers
362 rm -f
$(addprefix $(inst_includedir
)/, $(headers2_0
))