1 # Copyright (C) 1991-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 # Makefile configuration options for the GNU C library.
23 This makefile requires GNU Make.
26 all: # Make this the default goal
28 ifneq "$(origin +included-Makeconfig)" "file"
30 +included-Makeconfig := yes
36 # If config.make exists, the source directory was configured,
37 # so don't try to be clever and find another directory to build in.
38 ifneq (,$(wildcard $(..)config.make))
41 else # Not configured.
49 # Directory for object files and libc.a. If this is not defined, the
50 # object files live in the subdirectories where their sources live, and
51 # libc.a lives in the parent directory (this probably doesn't work any
54 ifeq ($(filter /%,$(ARCH)),)
55 objdir := $(..)$(ARCH)
61 # $(common-objdir) is the place to put objects and
62 # such that are not specific to a single subdir.
64 objpfx := $(patsubst %//,%/,$(objdir)/$(subdir)/)
65 common-objpfx = $(objdir)/
66 common-objdir = $(objdir)
73 # This is a kludge. make wizards might grok.
74 common-objpfx = sysdeps/../
79 # Root of the sysdeps tree.
80 sysdep_dir := $(..)sysdeps
81 export sysdep_dir := $(sysdep_dir)
83 # Get the values defined by options to `configure'.
84 include $(common-objpfx)config.make
86 # What flags to give to sources which call user provided callbacks
87 uses-callbacks = $(exceptions)
89 # What flags to give to tests which test stack alignment
90 stack-align-test-flags =
92 # We have a special subdir for each binary format.
93 # For now, only ELF is fully supported.
97 # This is probably better than nothing.
101 # Complete path to sysdep dirs.
102 # `configure' writes a definition of `config-sysdirs' in `config.make'.
103 sysdirs := $(foreach D,$(config-sysdirs),$(firstword $(filter /%,$D) $(..)$D))
105 # Add-ons that contribute sysdeps trees get added to the include list
106 # after sysdeps/generic. This makes #include <sysdeps/...> work right
107 # to find specific add-on files without assuming the add-on directory name.
108 # It also means that headers can go into an add-on's base directory
109 # instead of the add-on needing a sysdeps/generic of its own.
110 +sysdep_dirs := $(sysdirs) $(foreach add-on,$(sysdeps-add-ons),\
111 $(firstword $(filter /%,$(add-on)) \
114 +sysdep_dirs := $(objdir) $(+sysdep_dirs)
117 # Run config.status to update config.make and config.h. We don't show the
118 # dependence of config.h to Make, because it is only touched when it
119 # changes and so config.status would be run every time; the dependence of
120 # config.make should suffice to force regeneration and re-exec, and the new
121 # image will notice if config.h changed.
122 $(common-objpfx)config.make: $(common-objpfx)config.status \
123 $(..)config.make.in $(..)config.h.in
124 cd $(<D); $(SHELL) $(<F)
126 # Find all the add-on and sysdeps configure fragments, to make sure we
127 # re-run configure when any of them changes.
128 $(common-objpfx)config.status: $(..)version.h $(..)configure \
129 $(foreach dir,$(sysdirs),\
130 $(wildcard $(dir)/Implies) \
132 $(firstword $(wildcard \
133 $(addprefix $(dir)/,configure configure.in))))) \
135 $(foreach add-on,$(add-ons),\
136 $(firstword $(wildcard \
137 $(addprefix $(firstword $(filter /%,$(add-on)) $(..)$(add-on))/,\
138 configure configure.in)))))
139 @cd $(@D); if test -f $(@F); then exec $(SHELL) $(@F) --recheck; else \
140 echo The GNU C library has not been configured. >&2; \
141 echo Run \`configure\' to configure it before building. >&2; \
142 echo Try \`configure --help\' for more details. >&2; \
145 # We don't want CPPFLAGS to be exported to the command running configure.
148 # Get the user's configuration parameters.
149 ifneq ($(wildcard $(..)configparms),)
150 include $(..)configparms
153 ifneq ($(wildcard $(common-objpfx)configparms),)
154 include $(common-objpfx)configparms
159 #### These are the configuration variables. You can define values for
160 #### the variables below in the file `configparms'.
161 #### Do NOT edit this file.
165 # Common prefix for machine-independent installation directories.
166 ifeq ($(origin prefix),undefined) # ifndef would override explicit empty value.
170 # Decide whether we shall build the programs or not. We always do this
171 # unless the user tells us (in configparms) or we are building for a
173 ifndef build-programs
174 ifneq ($(config-os),none)
181 # Common prefix for machine-dependent installation directories.
182 ifeq ($(origin exec_prefix),undefined)
183 exec_prefix = $(prefix)
186 # Where to install the library and object files.
188 libdir = $(exec_prefix)/lib
190 inst_libdir = $(install_root)$(libdir)
192 # Where to install the shared library and dynamic linker.
194 slibdir = $(exec_prefix)/lib
196 inst_slibdir = $(install_root)$(slibdir)
198 # Prefix to put on files installed in $(libdir). For libraries `libNAME.a',
199 # the prefix is spliced between `lib' and the name, so the linker switch
200 # `-l$(libprefix)NAME' finds the library; for other files the prefix is
201 # just prepended to the whole file name.
202 ifeq ($(origin libprefix),undefined)
206 # Where to install the header files.
208 includedir = $(prefix)/include
210 inst_includedir = $(install_root)$(includedir)
212 # Where to install machine-independent data files.
213 # These are the timezone database, and the locale database.
215 datadir = $(prefix)/share
217 inst_datadir = $(install_root)$(datadir)
219 # Where to install the timezone data files (which are machine-independent).
221 zonedir = $(datadir)/zoneinfo
223 inst_zonedir = $(install_root)$(zonedir)
225 # Where to install the locale files.
227 localedir = $(libdir)/locale
229 inst_localedir = $(install_root)$(localedir)
231 # Where to install the message catalog data files (which are
232 # machine-independent).
234 msgcatdir = $(datadir)/locale
236 inst_msgcatdir = $(install_root)$(msgcatdir)
238 # Where to install the locale charmap source files.
240 i18ndir = $(datadir)/i18n
242 inst_i18ndir = $(install_root)$(i18ndir)
244 # Where to install the shared object for charset transformation.
246 gconvdir = $(libdir)/gconv
248 inst_gconvdir = $(install_root)$(gconvdir)
250 # Where to install programs.
252 bindir = $(exec_prefix)/bin
254 inst_bindir = $(install_root)$(bindir)
256 # Where to install internal programs.
258 libexecdir = $(exec_prefix)/libexec
260 inst_libexecdir = $(install_root)$(libexecdir)
262 # Where to install administrative programs.
264 rootsbindir = $(exec_prefix)/sbin
266 inst_rootsbindir = $(install_root)$(rootsbindir)
269 sbindir = $(exec_prefix)/sbin
271 inst_sbindir = $(install_root)$(sbindir)
273 # Where to install the Info files.
275 infodir = $(prefix)/info
277 inst_infodir = $(install_root)$(infodir)
279 # Where to install default configuration files. These include the local
280 # timezone specification and network data base files.
282 sysconfdir = $(prefix)/etc
284 inst_sysconfdir = $(install_root)$(sysconfdir)
286 # What timezone should be the installed default (e.g., US/Eastern).
287 # Run `make -C time echo-zonenames' to see a list of available zone names.
288 # The local timezone can be changed with `zic -l TIMEZONE' at any time.
293 # Where to install the "localtime" timezone file; this is the file whose
294 # contents $(localtime) specifies. If this is a relative pathname, it is
295 # relative to $(zonedir). It is a good idea to put this somewhere
296 # other than there, so the zoneinfo directory contains only universal data,
297 # localizing the configuration data elsewhere.
298 ifndef localtime-file
299 localtime-file = $(sysconfdir)/localtime
300 inst_localtime-file = $(install_root)$(localtime-file)
303 # What to use for leap second specifications in compiling the default
304 # timezone files. Set this to `/dev/null' for no leap second handling as
305 # 1003.1 requires, or to `leapseconds' for proper leap second handling.
306 # Both zone flavors are always available as `posix/ZONE' and `right/ZONE'.
307 # This variable determines the default: if it's `/dev/null',
308 # ZONE==posix/ZONE; if it's `leapseconds', ZONE==right/ZONE.
310 leapseconds = /dev/null
313 # What timezone's DST rules should be used when a POSIX-style TZ
314 # environment variable doesn't specify any rules. For 1003.1 compliance
315 # this timezone must use rules that are as U.S. federal law defines DST.
316 # Run `make -C time echo-zonenames' to see a list of available zone names.
317 # This setting can be changed with `zic -p TIMEZONE' at any time.
318 # If you want POSIX.1 compatibility, use `America/New_York'.
320 posixrules = America/New_York
323 # Where to install the "posixrules" timezone file; this is file
324 # whose contents $(posixrules) specifies. If this is a relative
325 # pathname, it is relative to $(zonedir).
326 ifndef posixrules-file
327 posixrules-file = posixrules
331 # Directory where your system's native header files live.
332 # This is used on Unix systems to generate some GNU libc header files.
334 sysincludedir = /usr/include
338 # Commands to install files.
340 INSTALL_DATA = $(INSTALL) -m 644
342 ifndef INSTALL_SCRIPT
343 INSTALL_SCRIPT = $(INSTALL)
345 ifndef INSTALL_PROGRAM
346 INSTALL_PROGRAM = $(INSTALL)
353 # The name of the C compiler.
354 # If you've got GCC, and it works, use it.
355 ifeq ($(origin CC),default)
359 # The name of the C compiler to use for compilations of programs to run on
360 # the host that is building the library. If you set CC to a
361 # cross-compiler, you must set this to the normal compiler.
366 # Default flags to pass the C compiler.
367 ifndef default_cflags
368 ifeq ($(release),stable)
369 default_cflags := -g -O2
371 default_cflags := -g -O
375 # Flags to pass the C compiler when assembling preprocessed assembly code
376 # (`.S' files). On some systems the assembler doesn't understand the `#' line
377 # directives the preprocessor produces. If you have troubling compiling
378 # assembly code, try using -P here to suppress these directives.
383 # ELF always supports init/fini sections
388 # Installed name of the startup code.
389 ifneq ($(have-initfini),yes)
390 # When not having init/fini, there is just one startfile, called crt0.o.
391 start-installed-name = crt0.o
393 # On systems having init/fini, crt0.o is called crt1.o, and there are
394 # some additional bizarre files.
395 start-installed-name = crt1.o
397 # On systems that do not need a special startfile for statically linked
398 # binaries, simply set it to the normal name.
399 ifndef static-start-installed-name
400 static-start-installed-name = $(start-installed-name)
403 ifeq (yesyesyes,$(build-shared)$(elf)$(have-z-combreloc))
404 combreloc-LDFLAGS = -Wl,-z,combreloc
405 LDFLAGS.so += $(combreloc-LDFLAGS)
406 LDFLAGS-rtld += $(combreloc-LDFLAGS)
409 ifeq (yes,$(have-z-relro))
410 relro-LDFLAGS = -Wl,-z,relro
411 LDFLAGS.so += $(relro-LDFLAGS)
412 LDFLAGS-rtld += $(relro-LDFLAGS)
415 # Command for linking programs with the C library.
417 +link = $(CC) -nostdlib -nostartfiles -o $@ \
418 $(sysdep-LDFLAGS) $(config-LDFLAGS) $(LDFLAGS) $(LDFLAGS-$(@F)) \
419 $(combreloc-LDFLAGS) $(relro-LDFLAGS) \
420 $(addprefix $(csu-objpfx),$(start-installed-name)) \
421 $(+preinit) $(+prector) \
422 $(filter-out $(addprefix $(csu-objpfx),start.o \
423 $(start-installed-name))\
424 $(+preinit) $(link-extra-libs) \
425 $(common-objpfx)libc% $(+postinit),$^) \
426 $(link-extra-libs) $(link-libc) $(+postctor) $(+postinit)
428 # Command for statically linking programs with the C library.
430 +link-static = $(CC) -nostdlib -nostartfiles -static -o $@ \
431 $(sysdep-LDFLAGS) $(LDFLAGS) $(LDFLAGS-$(@F)) \
432 $(addprefix $(csu-objpfx),$(static-start-installed-name)) \
433 $(+preinit) $(+prector) \
434 $(filter-out $(addprefix $(csu-objpfx),start.o \
435 $(start-installed-name))\
436 $(+preinit) $(link-extra-libs-static) \
437 $(common-objpfx)libc% $(+postinit),$^) \
438 $(link-extra-libs-static) $(link-libc-static) $(+postctor) $(+postinit)
440 # Command for statically linking bounded-pointer programs with the C library.
442 +link-bounded = $(CC) -nostdlib -nostartfiles -static -fbounded-pointers -o $@ \
443 $(sysdep-LDFLAGS) $(LDFLAGS) \
444 $(addprefix $(csu-objpfx),b$(static-start-installed-name)) \
445 $(+preinit) $(+prector) \
446 $(filter-out $(addprefix $(csu-objpfx),start.ob \
447 $(start-installed-name))\
448 $(+preinit) $(link-extra-libs-bounded) \
449 $(common-objpfx)libc% $(+postinit),$^) \
450 $(link-extra-libs-bounded) $(link-libc-bounded) $(+postctor) $(+postinit)
452 ifndef config-LDFLAGS
453 ifeq (yesyes,$(build-shared)$(elf))
454 config-LDFLAGS = -Wl,-dynamic-linker=$(slibdir)/$(rtld-installed-name)
458 ifeq (yes,$(build-shared))
460 # We need the versioned name of libc.so in the deps of $(others) et al
461 # so that the symlink to libc.so is created before anything tries to
462 # run the linked programs.
463 link-libc = -Wl,-rpath-link=$(rpath-link) \
464 $(common-objpfx)libc.so$(libc.so-version) \
465 $(common-objpfx)$(patsubst %,$(libtype.oS),c) $(gnulib)
466 # This is how to find at build-time things that will be installed there.
467 rpath-dirs = math elf dlfcn nss nis rt resolv crypt
470 $(common-objdir):$(subst $(empty) ,:,$(patsubst ../$(subdir),.,$(rpath-dirs:%=$(common-objpfx)%)))
471 elfobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)elf)
473 nssobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)nss)
474 resolvobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)resolv)
475 link-libc = $(common-objpfx)libc.a $(otherlibs) $(gnulib) $(common-objpfx)libc.a $(gnulib)
479 # Differences in the linkers on the various platforms.
481 LDFLAGS-rpath-ORIGIN = -Wl,-rpath,'$$ORIGIN'
482 LDFLAGS-soname-fname = -Wl,-soname,$(@F)
483 LDFLAGS-rdynamic = -rdynamic
484 LDFLAGS-Bsymbolic = -Bsymbolic
487 # Choose the default search path for the dynamic linker based on
488 # where we will install libraries.
489 ifneq ($(libdir),$(slibdir))
490 default-rpath = $(slibdir):$(libdir)
492 default-rpath = $(libdir)
495 ifndef link-extra-libs
496 link-extra-libs = $(LDLIBS-$(@F))
497 link-extra-libs-static = $(link-extra-libs)
498 link-extra-libs-bounded = $(link-extra-libs)
501 # The static libraries.
502 ifeq (yes,$(build-static))
503 link-libc-static = $(common-objpfx)libc.a $(static-gnulib) $(common-objpfx)libc.a
505 ifeq (yes,$(build-shared))
506 # We can try to link the programs with lib*_pic.a...
507 link-libc-static = $(static-gnulib) $(common-objpfx)libc_pic.a
510 link-libc-bounded = $(common-objpfx)libc_b.a $(gnulib) $(common-objpfx)libc_b.a
513 ifneq ($(have-cc-with-libunwind),yes)
518 ifneq ($(have-as-needed),yes)
519 libgcc_eh := -lgcc_eh $(libunwind)
521 libgcc_eh := -Wl,--as-needed -lgcc_s$(libgcc_s_suffix) $(libunwind) -Wl,--no-as-needed
523 gnulib := -lgcc $(libgcc_eh)
524 static-gnulib := -lgcc -lgcc_eh $(libunwind)
525 libc.so-gnulib := -lgcc
528 +preinit = $(addprefix $(csu-objpfx),crti.o)
529 +postinit = $(addprefix $(csu-objpfx),crtn.o)
530 +prector = `$(CC) --print-file-name=crtbegin.o`
531 +postctor = `$(CC) --print-file-name=crtend.o`
532 +interp = $(addprefix $(elf-objpfx),interp.os)
534 csu-objpfx = $(common-objpfx)csu/
535 elf-objpfx = $(common-objpfx)elf/
537 # How to run a program we just linked with our library.
538 # The program binary is assumed to be $(word 2,$^).
539 built-program-file = $(dir $(word 2,$^))$(notdir $(word 2,$^))
540 ifeq (yesyes,$(build-shared)$(elf))
542 sysdep-library-path = \
543 $(subst $(empty) ,:,$(strip $(patsubst -Wl$(comma)-rpath-link=%, %,\
544 $(filter -Wl$(comma)-rpath-link=%,\
545 $(sysdep-LDFLAGS)))))
546 run-program-prefix = $(if $(filter $(notdir $(built-program-file)),\
547 $(tests-static) $(xtests-static)),, \
548 $(elf-objpfx)$(rtld-installed-name) \
549 --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)))
553 # Never use $(run-program-prefix) for the statically-linked %-bp test programs
554 built-program-cmd = $(patsubst %,$(run-program-prefix),\
555 $(filter-out %-bp,$(built-program-file))) \
556 $(built-program-file)
566 # Extra flags to pass to GCC.
567 ifeq ($(all-warnings),yes)
568 +gccwarn := -Wall -Wwrite-strings -Winline -Wcast-qual -Wbad-function-cast -Wmissing-noreturn -Wmissing-prototypes -Wmissing-declarations -Wcomment -Wcomments -Wtrigraphs -Wsign-compare -Wfloat-equal -Wmultichar
570 +gccwarn := -Wall -Wwrite-strings -Winline
572 +gccwarn-c = -Wstrict-prototypes
574 # We do not depend on the address of constants in different files to be
575 # actually different, so allow the compiler to merge them all.
576 +merge-constants = -fmerge-all-constants
578 # This is the program that generates makefile dependencies from C source files.
579 # The -MP flag tells GCC >= 3.2 (which we now require) to produce dummy
580 # targets for headers so that removed headers don't break the build.
582 +mkdep = $(CC) -M -MP
585 # The program that makes Emacs-style TAGS files.
588 # The `xgettext' program for producing .pot files from sources.
593 # The `m4' macro processor; this is used by sysdeps/sparc/Makefile (and
594 # perhaps others) to preprocess assembly code in some cases.
597 # To force installation of files even if they are older than the
598 # installed files. This variable is included in the dependency list
599 # of all installation targets.
600 ifeq ($(force-install),yes)
601 +force = force-install
607 #### End of configuration variables.
610 # This tells some versions of GNU make before 3.63 not to export all variables.
613 # We want to echo the commands we're running without
614 # umpteen zillion filenames along with it (we use `...' instead)
615 # but we don't want this echoing done when the user has said
616 # he doesn't want to see commands echoed by using -s.
617 ifneq "$(findstring s,$(MAKEFLAGS))" "" # if -s
618 +cmdecho := echo >/dev/null
623 # These are the flags given to the compiler to tell
624 # it what sort of optimization and/or debugging output to do.
626 # If `CFLAGS' was defined, use that.
628 +cflags := $(filter-out -I%,$(CFLAGS))
632 # If none of the above worked, default to "-g -O".
633 ifeq "$(strip $(+cflags))" ""
634 +cflags := $(default_cflags)
635 endif # $(+cflags) == ""
637 +cflags += $(addprefix -mcpu=,$(with-cpu)) $(+gccwarn) $(+merge-constants)
640 # Don't duplicate options if we inherited variables from the parent.
641 +cflags := $(sort $(+cflags))
644 # These are flags given to the C compiler to tell it to look for
645 # include files (including ones given in angle brackets) in the parent
646 # library source directory, in the include directory, and in the
648 +sysdep-includes = $(addprefix -I,$(+sysdep_dirs))
649 +includes = -I$(..)include $(if $(subdir),$(objpfx:%/=-I%)) \
650 $(+sysdep-includes) $(includes) \
651 $(patsubst %/,-I%,$(..)) $(libio-include) -I. $(sysincludes)
653 # Since libio has several internal header files, we use a -I instead
654 # of many little headers in the include directory.
655 libio-include = -I$(..)libio
657 # These are the variables that the implicit compilation rules use.
658 # Note that we can't use -std=* in CPPFLAGS, because it overrides
659 # the implicit -lang-asm and breaks cpp behavior for .S files--notably
660 # it causes cpp to stop predefining __ASSEMBLER__.
661 CPPFLAGS = $($(subdir)-CPPFLAGS) $(+includes) $(defines) \
662 -include $(..)include/libc-symbols.h $(sysdep-CPPFLAGS) \
663 $(CPPFLAGS-$(suffix $@)) \
664 $(foreach lib,$(libof-$(basename $(@F))) \
665 $(libof-$(<F)) $(libof-$(@F)),$(CPPFLAGS-$(lib))) \
666 $(CPPFLAGS-$(<F)) $(CPPFLAGS-$(@F)) $(CPPFLAGS-$(basename $(@F)))
667 override CFLAGS = -std=gnu99 \
668 $(filter-out %frame-pointer,$(+cflags)) $(+gccwarn-c) \
669 $(sysdep-CFLAGS) $(CFLAGS-$(suffix $@)) $(CFLAGS-$(<F)) \
671 override CXXFLAGS = $(c++-sysincludes) \
672 $(filter-out %frame-pointer,$(+cflags)) $(sysdep-CFLAGS) \
673 $(CFLAGS-$(suffix $@)) $(CFLAGS-$(<F)) $(CFLAGS-$(@F))
675 # If everything is compiled with -fPIC (implicitly) we must tell this by
676 # defining the PIC symbol.
677 ifeq (yes,$(build-pic-default))
681 # Enable object files for different versions of the library.
682 # Various things use $(object-suffixes) to know what all to make.
683 # The compilation rules use $(CPPFLAGS-${SUFFIX}) and $(CFLAGS-${SUFFIX})
684 # to pass different flags for each flavor.
685 libtypes = $(foreach o,$(object-suffixes-for-libc),$(libtype$o))
686 all-object-suffixes := .o .os .op .og .ob .oS
688 CPPFLAGS-.o = $(pic-default)
689 CFLAGS-.o = $(filter %frame-pointer,$(+cflags))
690 ifeq (yes,$(build-static))
692 object-suffixes += .o
694 ifeq (yes,$(build-shared))
695 # Under --enable-shared, we will build a shared library of PIC objects.
696 # The PIC object files are named foo.os.
697 object-suffixes += .os
698 CPPFLAGS-.os = -DPIC -DSHARED
699 CFLAGS-.os = $(filter %frame-pointer,$(+cflags)) $(pic-ccflag)
700 libtype.os := lib%_pic.a
701 # This can be changed by a sysdep makefile
703 # This one should always stay like this unless there is a very good reason.
706 ifeq (yes,$(build-profile))
707 # Under --enable-profile, we will build a static library of profiled objects.
708 # The profiled object files are named foo.op.
709 object-suffixes += .op
710 CPPFLAGS-.op = -DPROF $(pic-default)
712 libtype.op = lib%_p.a
714 ifeq (yes,$(build-omitfp))
715 # Under --enable-omitfp, we build the library optimized without
716 # debugging information using -fomit-frame-pointer, and build an extra
717 # library with debugging information. The debuggable objects are named foo.og.
718 object-suffixes += .og
719 CPPFLAGS-.og = $(pic-default)
721 CFLAGS-.o = $(filter %frame-pointer,$(+cflags)) -g0 -O99 -fomit-frame-pointer -D__USE_STRING_INLINES
722 CFLAGS-.os += -g0 -O99 -fomit-frame-pointer -D__USE_STRING_INLINES
723 libtype.og = lib%_g.a
727 ifeq (yes,$(build-bounded))
728 # Under --enable-bounded, we build the library with `-fbounded-pointers -g'
729 # to runtime bounds checking. The bounded-pointer objects are named foo.ob.
730 # We disable sibling-call optimizations so that stack traces will be complete
731 # and thus aid debugging, since after all, BPs are a debugging tool.
732 object-suffixes += .ob
733 CPPFLAGS-.ob = -fbounded-pointers $(pic-default)
734 CFLAGS-.ob = -g -O2 -fno-optimize-sibling-calls -fno-strict-aliasing
735 libtype.ob = lib%_b.a
738 object-suffixes-for-libc := $(object-suffixes)
740 ifeq (yes,$(build-shared))
741 # Build special library that contains the static-only routines for libc.
742 object-suffixes-for-libc += .oS
744 # Must build the routines as PIC, though, because they can end up in (users')
745 # shared objects. We don't want to use CFLAGS-os because users may, for
746 # example, make that processor-specific.
747 CFLAGS-.oS = $(CFLAGS-.o) $(PIC-ccflag)
748 CPPFLAGS-.oS = $(CPPFLAGS-.o) -DPIC -DLIBC_NONSHARED=1
749 libtype.oS = lib%_nonshared.a
752 # The assembler can generate debug information too.
754 ifeq ($(have-cpp-asm-debuginfo),yes)
755 ASFLAGS := $(filter -g%,$(CFLAGS))
760 ASFLAGS += $(ASFLAGS-config)
766 move-if-change = $(SHELL) $(..)scripts/move-if-change
768 -include $(common-objpfx)sysd-sorted
769 subdirs = $(sorted-subdirs)
770 subdir-srcdirs = $(foreach dir,$(subdirs),\
771 $(firstword $($(dir)-srcdir) $(..)$(dir)))
773 ifeq (yes, $(build-shared))
775 # This is a pair of implicit rules to preprocess a file with # comments,
776 # %ifdef et al, based on config.h settings or other %include'd files.
777 # We use chained rules instead of a pipeline here so that we can properly
778 # check the exit status of cpp rather than using its bad output when there
779 # is a preprocessing error. Another rule should depend on the output file
780 # `FOO.v', and along with that `FOO.v.i' should be given dependencies
781 # listing both its input files, and any header files that it may reference
783 %.v.i: $(common-objpfx)config.h
784 sed '/^[ ]*#/d;s/^[ ]*%/#/' $(filter-out FORCE %.h,$^) \
785 | $(CC) -E -undef $(CPPFLAGS) \
786 -DASSEMBLER -x assembler-with-cpp - \
790 sed '/^[ ]*#/d;/^[ ]*$$/d' $< > $@T
793 # Process the shlib-versions file, which tells us what shared library
794 # version numbers to use when we install shared objects on this system.
795 # We need to wait until $(subdirs) is complete.
796 ifeq ($(sysd-sorted-done),t)
797 -include $(common-objpfx)soversions.mk
798 ifndef avoid-generated
799 # This lets add-ons give more-specific matches that override defaults
800 # in the top-level file.
801 $(common-objpfx)shlib-versions.v.i: \
802 $(wildcard $(+sysdep_dirs:=/shlib-versions) \
803 $(subdir-srcdirs:=/shlib-versions)) \
806 soversions-default-setname = $(patsubst %, %,\
807 $(filter-out %_default,\
808 $(oldest-abi:%=GLIBC_%)))
809 $(common-objpfx)soversions.i: $(..)scripts/soversions.awk \
810 $(common-objpfx)shlib-versions.v
811 $(AWK) -v default_setname='$(soversions-default-setname)' \
812 -v cpu='$(config-machine)' \
813 -v vendor='$(config-vendor)' \
814 -v os='$(config-os)' \
817 $(common-objpfx)soversions.mk: $(common-objpfx)soversions.i $(..)Makeconfig
818 (seen_DEFAULT=0; seen_WORDSIZE32=0; seen_WORDSIZE64=0; \
819 while read which lib number setname; do \
820 eval seen_$$which=1; \
821 test x"$$which" = xDEFAULT || continue; \
823 [0-9]*) echo "$$lib.so-version=.$$number"; \
824 echo "all-sonames+=$$lib=$$lib.so\$$($$lib.so-version)";;\
825 *) echo "$$lib.so-version=$$number"; \
826 echo "all-sonames+=$$lib=\$$($$lib.so-version)";;\
829 case "$$seen_DEFAULT$$seen_WORDSIZE32$$seen_WORDSIZE64" in \
830 100) echo biarch = no;; \
831 101) echo biarch = 32;; \
832 ?1?) echo biarch = 64;; \
833 *) echo >&2 BUG; exit 2;; \
835 echo soversions.mk-done = t;) < $< > $@T; exit 0
840 postclean-generated += soversions.mk soversions.i \
841 shlib-versions.v shlib-versions.v.i
843 # Generate the header containing the names of all shared libraries.
844 # We use a stamp file to avoid unnecessary recompilations.
845 before-compile += $(common-objpfx)gnu/lib-names.h
846 ifeq ($(soversions.mk-done),t)
847 $(common-objpfx)gnu/lib-names.h: $(common-objpfx)gnu/lib-names.stmp; @:
848 $(common-objpfx)gnu/lib-names.stmp: $(..)scripts/lib-names.awk \
849 $(common-objpfx)soversions.i
850 $(make-target-directory)
851 @rm -f ${@:stmp=T} $@
852 $(AWK) -f $^ > ${@:stmp=T}
853 $(move-if-change) ${@:stmp=T} ${@:stmp=h}
857 common-generated += gnu/lib-names.h gnu/lib-names.stmp
859 # The name under which the run-time dynamic linker is installed.
860 # We are currently going for the convention that `/lib/ld.so.1'
861 # names the SVR4/ELF ABI-compliant dynamic linker.
862 ifndef rtld-installed-name
864 rtld-installed-name = $(ld.so-version)
866 rtld-installed-name = ld.so.1
870 ifndef rtld-version-installed-name
871 rtld-version-installed-name = ld-$(version).so
879 ifeq ($(build-shared),yes)
880 libdl = $(common-objpfx)dlfcn/libdl.so$(libdl.so-version)
882 libdl = $(common-objpfx)dlfcn/libdl.a
885 ifneq (,$(findstring aix,$(config-os)))
886 ifeq ($(build-shared),yes)
888 libdl = $(common-objpfx)dlfcn/libdl.so$(libdl.so-version)
890 # No libdl without shared libs on AIX
895 # No ELF, no AIX - no libdl, at least for now.
901 # These are the subdirectories containing the library source. The order
902 # is more or less arbitrary. The sorting step will take care of the
904 all-subdirs = csu assert ctype locale intl catgets math setjmp signal \
905 stdlib stdio-common libio malloc string wcsmbs time dirent \
906 grp pwd posix io termios resource misc socket sysvipc gmon \
907 gnulib iconv iconvdata wctype manual shadow po argp \
908 crypt nss localedata timezone rt conform debug \
909 $(add-on-subdirs) $(dlfcn) $(binfmt-subdir)
911 ifndef avoid-generated
912 all-Depend-files := $(wildcard $(foreach dir,$(all-subdirs),\
913 $(firstword $($(dir)-srcdir) \
914 $(..)$(dir))/Depend))
915 $(common-objpfx)sysd-sorted: $(..)scripts/gen-sorted.awk \
916 $(common-objpfx)config.make $(..)Makeconfig \
917 $(wildcard $(sysdirs:=/Subdirs)) \
920 -v subdirs='$(all-subdirs)' \
922 $(filter %/Subdirs %/Depend,$^) > $@-tmp
924 $(all-Depend-files): ;
927 # Let sysdeps/ subdirs contain a Makeconfig fragment for us to include here.
928 sysdep-makeconfigs := $(wildcard $(+sysdep_dirs:=/Makeconfig))
929 ifneq (,$(sysdep-makeconfigs))
930 include $(sysdep-makeconfigs)
934 endif # Makeconfig not yet included