1 # Copyright (C) 1991-2002,2003,2004,2005,2006 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 \
67 subdir_objs subdir_stubs subdir_testclean \
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
)
161 installed-stubs
= $(inst_includedir
)/gnu
/stubs.h
163 installed-stubs
= $(inst_includedir
)/gnu
/stubs-
$(biarch
).h
165 $(inst_includedir
)/gnu
/stubs.h
: include/stubs-biarch.h
$(+force)
166 $(make-target-directory
)
167 $(INSTALL_DATA
) $< $@
169 install-others-nosubdir
: $(installed-stubs
)
173 # Since stubs.h is never needed when building the library, we simplify the
174 # hairy installation process by producing it in place only as the last part
175 # of the top-level `make install'. It depends on subdir_install, which
176 # iterates over all the subdirs; subdir_install in each subdir depends on
177 # the subdir's stubs file. Having more direct dependencies would result in
178 # extra iterations over the list for subdirs and many recursive makes.
179 $(installed-stubs
): include/stubs-prologue.h subdir_install
180 $(make-target-directory
)
181 @
rm -f
$(objpfx
)stubs.h
182 (sed
'/^@/d' $<; LC_ALL
=C
sort $(subdir-stubs
)) > $(objpfx
)stubs.h
183 if
test -r
$@
&& cmp
-s
$(objpfx
)stubs.h
$@
; \
184 then echo
'stubs.h unchanged'; \
185 else $(INSTALL_DATA
) $(objpfx
)stubs.h
$@
; fi
186 rm -f
$(objpfx
)stubs.h
188 # This makes the Info or DVI file of the documentation from the Texinfo source.
189 .PHONY
: info dvi pdf html
191 $(MAKE
) $(PARALLELMFLAGS
) -C manual
$@
193 # This makes all the subdirectory targets.
195 # For each target, make it depend on DIR/target for each subdirectory DIR.
196 $(+subdir_targets
): %: $(addsuffix /%,$(subdirs
))
198 # Compute a list of all those targets.
199 all-subdirs-targets
:= $(foreach dir,$(subdirs
),\
200 $(addprefix $(dir)/,$(+subdir_targets
)))
202 # The action for each of those is to cd into the directory and make the
204 $(all-subdirs-targets
):
205 $(MAKE
) $(PARALLELMFLAGS
) -C
$(@D
) $(@F
)
207 .PHONY
: $(+subdir_targets
) $(all-subdirs-targets
)
209 # Targets to clean things up to various degrees.
211 .PHONY
: clean realclean distclean distclean-1 parent-clean parent-mostlyclean \
214 # Subroutines of all cleaning targets.
215 parent-mostlyclean
: common-mostlyclean
# common-mostlyclean is in Makerules.
216 -rm -f
$(foreach o
,$(object-suffixes-for-libc
),\
217 $(common-objpfx
)$(patsubst %,$(libtype
$o),c
)) \
218 $(addprefix $(objpfx
),$(install-lib
))
219 parent-clean
: parent-mostlyclean common-clean
221 postclean
= $(addprefix $(common-objpfx
),$(postclean-generated
)) \
222 $(addprefix $(objpfx
),sysd-dirs sysd-rules
) \
223 $(addprefix $(objpfx
),sysd-sorted soversions.mk soversions.i
)
226 # This is done this way rather than having `subdir_clean' be a
227 # dependency of this target so that libc.a will be removed before the
228 # subdirectories are dealt with and so they won't try to remove object
229 # files from it when it's going to be removed anyway.
230 @
$(MAKE
) subdir_clean no_deps
=t
232 mostlyclean: parent-mostlyclean
233 @
$(MAKE
) subdir_mostlyclean no_deps
=t
237 @
$(MAKE
) subdir_testclean no_deps
=t
239 tests
: $(objpfx
)c
++-types-check.out
$(objpfx
)check-local-headers.out
241 check-data
:= $(firstword $(wildcard \
242 $(foreach M
,$(config-machine
) $(base-machine
),\
243 scripts
/data
/c
++-types-
$M-$(config-os
).data
)))
244 ifneq (,$(check-data
))
245 $(objpfx
)c
++-types-check.out
: $(check-data
) scripts
/check-c
++-types.sh
246 scripts
/check-c
++-types.sh
$< $(CXX
) $(filter-out -std
=gnu99
-Wstrict-prototypes
,$(CFLAGS
)) $(CPPFLAGS
) > $@
248 $(objpfx
)c
++-types-check.out
:
249 @echo
'WARNING C++ tests not run; create a c++-types-XXX file'
254 $(objpfx
)check-local-headers.out
: scripts
/check-local-headers.sh
255 scripts
/check-local-headers.sh
"$(includedir)" "$(objpfx)" > $@
258 installed-headers
= argp
/argp.h assert
/assert.h catgets
/nl_types.h \
259 crypt
/crypt.h ctype
/ctype.h debug
/execinfo.h \
260 dirent
/dirent.h dlfcn
/dlfcn.h elf
/elf.h elf
/link.h \
261 gmon
/sys
/gmon.h gmon
/sys
/gmon_out.h gmon
/sys
/profil.h \
262 grp
/grp.h iconv
/iconv.h iconv
/gconv.h \
263 $(wildcard inet
/netinet
/*.h
) \
264 $(wildcard inet
/arpa
/*.h inet
/protocols
/*.h
) \
265 inet
/aliases.h inet
/ifaddrs.h inet
/netinet
/ip6.h \
266 inet
/netinet
/icmp6.h intl
/libintl.h io
/sys
/stat.h \
267 io
/sys
/statfs.h io
/sys
/vfs.h io
/sys
/statvfs.h \
268 io
/fcntl.h io
/sys
/fcntl.h io
/poll.h io
/sys
/poll.h \
269 io
/utime.h io
/ftw.h io
/fts.h io
/sys
/sendfile.h \
270 libio
/stdio.h libio
/libio.h locale
/locale.h \
271 locale
/langinfo.h locale
/xlocale.h login
/utmp.h \
272 login
/lastlog.h login
/pty.h malloc
/malloc.h \
273 malloc
/obstack.h malloc
/mcheck.h math
/math.h \
274 math
/complex.h math
/fenv.h math
/tgmath.h misc
/sys
/uio.h \
275 $(wildcard nis
/rpcsvc
/*.h
) nptl_db
/thread_db.h \
276 nptl
/sysdeps
/pthread
/pthread.h nptl
/semaphore.h \
277 nss
/nss.h posix
/sys
/utsname.h posix
/sys
/times.h \
278 posix
/sys
/wait.h posix
/sys
/types.h posix
/unistd.h \
279 posix
/glob.h posix
/regex.h posix
/wordexp.h posix
/fnmatch.h\
280 posix
/getopt.h posix
/tar.h posix
/sys
/unistd.h \
281 posix
/sched.h posix
/re_comp.h posix
/wait.h \
282 posix
/cpio.h posix
/spawn.h pwd
/pwd.h resolv
/resolv.h \
283 resolv
/netdb.h
$(wildcard resolv
/arpa
/*.h
) \
284 resource
/sys
/resource.h resource
/sys
/vlimit.h \
285 resource
/sys
/vtimes.h resource
/ulimit.h rt
/aio.h \
286 rt
/mqueue.h setjmp
/setjmp.h shadow
/shadow.h \
287 signal
/signal.h signal
/sys
/signal.h socket
/sys
/socket.h \
288 socket
/sys
/un.h stdio-common
/printf.h \
289 stdio-common
/stdio_ext.h stdlib
/stdlib.h stdlib
/alloca.h \
290 stdlib
/monetary.h stdlib
/fmtmsg.h stdlib
/ucontext.h \
291 sysdeps
/generic
/inttypes.h sysdeps
/generic
/stdint.h \
292 stdlib
/errno.h stdlib
/sys
/errno.h string
/string.h \
293 string
/strings.h string
/memory.h string
/endian.h \
294 string
/argz.h string
/envz.h string
/byteswap.h \
295 $(wildcard sunrpc
/rpc
/*.h sunrpc
/rpcsvc
/*.h
) \
296 sysvipc
/sys
/ipc.h sysvipc
/sys
/msg.h sysvipc
/sys
/sem.h \
297 sysvipc
/sys
/shm.h termios
/termios.h \
298 termios
/sys
/termios.h termios
/sys
/ttychars.h time
/time.h \
299 time
/sys
/time.h time
/sys
/timeb.h wcsmbs
/wchar.h \
302 tests
: $(objpfx
)begin-end-check.out
303 $(objpfx
)begin-end-check.out
: scripts
/begin-end-check.pl
304 $(PERL
) scripts
/begin-end-check.pl
$(installed-headers
) > $@
307 # The realclean target is just like distclean for the parent, but we want
308 # the subdirs to know the difference in case they care.
309 realclean distclean: parent-clean
310 # This is done this way rather than having `subdir_distclean' be a
311 # dependency of this target so that libc.a will be removed before the
312 # subdirectories are dealt with and so they won't try to remove object
313 # files from it when it's going to be removed anyway.
314 @
$(MAKE
) distclean-1 no_deps
=t distclean-1
=$@ avoid-generated
=yes \
315 sysdep-subdirs
="$(sysdep-subdirs)"
318 # Subroutine of distclean and realclean.
319 distclean-1
: subdir_
$(distclean-1
)
320 -rm -f
$(config-generated
)
321 -rm -f
$(addprefix $(objpfx
),config.status config.cache config.log
)
322 -rm -f
$(addprefix $(objpfx
),config.make config-name.h config.h
)
324 -rm -f
$(objpfx
)Makefile
326 -rm -f
$(sysdep-
$(distclean-1
))
328 # Make the TAGS file for Emacs users.
332 scripts
/list-sources.sh | sed
-n
'/Makefile/p;\
333 $(foreach S,[chsSyl] cxx sh bash pl,\
334 $(subst .,\.,/.$S\(.in\)*$$/p;))' \
337 # Make the distribution tarfile.
338 .PHONY
: dist tag-for-dist
340 generated
:= $(generated
) stubs.h
342 README
: README.template version.h
344 sed
-e
's/RELEASE/$(release)/' -e
's/VERSION/$(version)/' < $< > $@
345 # Make it unwritable so I won't change it by mistake.
347 ifeq ($(with-cvs
),yes
)
348 test ! -d CVS || cvs
$(CVSOPTS
) commit
-m
'Remade for $(release)-$(version)' $@
351 files-for-dist
:= README FAQ INSTALL NOTES configure
353 tag-of-stem
= glibc-
$(subst .
,_
,$*)
355 # Add-ons in the main repository but distributed in their own tar files.
356 dist-separate
= libidn linuxthreads
358 # Directories in each add-on.
359 dist-separate-libidn
= libidn
360 dist-separate-linuxthreads
= linuxthreads linuxthreads_db
362 glibc-
%.
tar $(dist-separate
:%=glibc-
%-%.
tar): $(files-for-dist
) \
363 $(foreach D
,$(dist-separate
),\
366 $(MAKE
) -q
`find sysdeps $(addsuffix /sysdeps,$(add-ons)) \
368 cvs
$(CVSOPTS
) -Q
export -d glibc-
$* -r
$(tag-of-stem
) libc
369 # Touch all the configure scripts going into the tarball since cvs export
370 # might have delivered configure.in newer than configure.
371 find glibc-
$* -name configure
-print | xargs touch
372 $(dist-do-separate-dirs
)
373 tar cf glibc-
$*.
tar glibc-
$*
375 define dist-do-separate-dirs
376 $(foreach dir,$(dist-separate
),
377 tar cf glibc-
$(dir)-$*.
tar -C glibc-
$* $(dist-separate-
$(dir))
378 rm -rf
$(addprefix glibc-
$*/,$(dist-separate-
$(dir)))
382 # Do `make dist dist-version=X.Y.Z' to make tar files of an older version.
383 dist-version
= $(version
)
385 dist: $(foreach Z
,.bz2 .gz
,glibc-
$(dist-version
).
tar$Z \
386 $(foreach D
,$(dist-separate
),\
387 glibc-
$D-$(dist-version
).
tar$Z))
390 tag-for-dist
: tag-
$(dist-version
)
391 tag-
%: $(files-for-dist
)
392 cvs
$(CVSOPTS
) -Q tag
-c
$(tag-of-stem
)
396 makeinfo --no-validate
--no-warn
--no-headers
$< -o
$@
399 INSTALL
: manual
/install.texi
; $(format-me
)
400 NOTES
: manual
/creature.texi
; $(format-me
)
401 manual
/dir-add.texi manual
/dir-add.
info: FORCE
402 $(MAKE
) $(PARALLELMFLAGS
) -C
$(@D
) $(@F
)
403 FAQ
: scripts
/gen-FAQ.pl FAQ.in
404 $(PERL
) $^
> $@.new
&& rm -f
$@
&& mv
$@.new
$@
&& chmod a-w
$@
405 ifeq ($(with-cvs
),yes
)
406 test ! -d CVS || cvs
$(CVSOPTS
) commit
-m
'Regenerated: $(PERL) $^' $@
410 iconvdata
/% localedata
/% po
/% manual
/%: FORCE
411 $(MAKE
) $(PARALLELMFLAGS
) -C
$(@D
) $(@F
)
413 # glibc 2.0 contains some header files which aren't used with glibc 2.1
415 # These rules should remove those headers
416 ifeq (,$(install_root
))
417 ifeq ($(old-glibc-headers
),yes
)
418 install: remove-old-headers
422 headers2_0
:= __math.h bytesex.h confname.h direntry.h elfclass.h \
423 errnos.h fcntlbits.h huge_val.h ioctl-types.h \
424 ioctls.h iovec.h jmp_buf.h libc-lock.h local_lim.h \
425 mathcalls.h mpool.h nan.h ndbm.h posix1_lim.h \
426 posix2_lim.h posix_opt.h resourcebits.h schedbits.h \
427 selectbits.h semaphorebits.h sigaction.h sigcontext.h \
428 signum.h sigset.h sockaddrcom.h socketbits.h stab.def \
429 statbuf.h statfsbuf.h stdio-lock.h stdio_lim.h \
430 syscall-list.h termbits.h timebits.h ustatbits.h \
431 utmpbits.h utsnamelen.h waitflags.h waitstatus.h \
432 xopen_lim.h gnu
/types.h sys
/ipc_buf.h \
433 sys
/kernel_termios.h sys
/msq_buf.h sys
/sem_buf.h \
434 sys
/shm_buf.h sys
/socketcall.h sigstack.h
436 .PHONY
: remove-old-headers
438 rm -f
$(addprefix $(inst_includedir
)/, $(headers2_0
))