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 sysdeps-srcdirs := $(foreach add-on,$(sysdeps-add-ons),\
111 $(firstword $(filter /%,$(add-on)) \
113 +sysdep_dirs = $(sysdirs) $(sysdeps-srcdirs)
115 +sysdep_dirs := $(objdir) $(+sysdep_dirs)
118 # Run config.status to update config.make and config.h. We don't show the
119 # dependence of config.h to Make, because it is only touched when it
120 # changes and so config.status would be run every time; the dependence of
121 # config.make should suffice to force regeneration and re-exec, and the new
122 # image will notice if config.h changed.
123 $(common-objpfx)config.make: $(common-objpfx)config.status \
124 $(..)config.make.in $(..)config.h.in
125 cd $(<D); $(SHELL) $(<F)
127 # Find all the add-on and sysdeps configure fragments, to make sure we
128 # re-run configure when any of them changes.
129 $(common-objpfx)config.status: $(..)version.h $(..)configure \
130 $(foreach dir,$(sysdirs),\
131 $(wildcard $(dir)/Implies) \
133 $(firstword $(wildcard \
134 $(addprefix $(dir)/,configure configure.in))))) \
136 $(foreach add-on,$(add-ons),\
137 $(firstword $(wildcard \
138 $(addprefix $(firstword $(filter /%,$(add-on)) $(..)$(add-on))/,\
139 configure configure.in)))))
140 @cd $(@D); if test -f $(@F); then exec $(SHELL) $(@F) --recheck; else \
141 echo The GNU C library has not been configured. >&2; \
142 echo Run \`configure\' to configure it before building. >&2; \
143 echo Try \`configure --help\' for more details. >&2; \
146 # We don't want CPPFLAGS to be exported to the command running configure.
149 # Get the user's configuration parameters.
150 ifneq ($(wildcard $(..)configparms),)
151 include $(..)configparms
154 ifneq ($(wildcard $(common-objpfx)configparms),)
155 include $(common-objpfx)configparms
160 #### These are the configuration variables. You can define values for
161 #### the variables below in the file `configparms'.
162 #### Do NOT edit this file.
166 # Common prefix for machine-independent installation directories.
167 ifeq ($(origin prefix),undefined) # ifndef would override explicit empty value.
171 # Decide whether we shall build the programs or not. We always do this
172 # unless the user tells us (in configparms) or we are building for a
174 ifndef build-programs
175 ifneq ($(config-os),none)
182 # Common prefix for machine-dependent installation directories.
183 ifeq ($(origin exec_prefix),undefined)
184 exec_prefix = $(prefix)
187 # Where to install the library and object files.
189 libdir = $(exec_prefix)/lib
191 inst_libdir = $(install_root)$(libdir)
193 # Where to install the shared library and dynamic linker.
195 slibdir = $(exec_prefix)/lib
197 inst_slibdir = $(install_root)$(slibdir)
199 # Prefix to put on files installed in $(libdir). For libraries `libNAME.a',
200 # the prefix is spliced between `lib' and the name, so the linker switch
201 # `-l$(libprefix)NAME' finds the library; for other files the prefix is
202 # just prepended to the whole file name.
203 ifeq ($(origin libprefix),undefined)
207 # Where to install the header files.
209 includedir = $(prefix)/include
211 inst_includedir = $(install_root)$(includedir)
213 # Where to install machine-independent data files.
214 # These are the timezone database, and the locale database.
216 datadir = $(prefix)/share
218 inst_datadir = $(install_root)$(datadir)
220 # Where to install the timezone data files (which are machine-independent).
222 zonedir = $(datadir)/zoneinfo
224 inst_zonedir = $(install_root)$(zonedir)
226 # Where to install the locale files.
228 localedir = $(libdir)/locale
230 inst_localedir = $(install_root)$(localedir)
232 # Where to install the message catalog data files (which are
233 # machine-independent).
235 msgcatdir = $(datadir)/locale
237 inst_msgcatdir = $(install_root)$(msgcatdir)
239 # Where to install the locale charmap source files.
241 i18ndir = $(datadir)/i18n
243 inst_i18ndir = $(install_root)$(i18ndir)
245 # Where to install the shared object for charset transformation.
247 gconvdir = $(libdir)/gconv
249 inst_gconvdir = $(install_root)$(gconvdir)
251 # Where to install programs.
253 bindir = $(exec_prefix)/bin
255 inst_bindir = $(install_root)$(bindir)
257 # Where to install internal programs.
259 libexecdir = $(exec_prefix)/libexec
261 inst_libexecdir = $(install_root)$(libexecdir)
263 # Where to install administrative programs.
265 rootsbindir = $(exec_prefix)/sbin
267 inst_rootsbindir = $(install_root)$(rootsbindir)
270 sbindir = $(exec_prefix)/sbin
272 inst_sbindir = $(install_root)$(sbindir)
274 # Where to install the Info files.
276 infodir = $(prefix)/info
278 inst_infodir = $(install_root)$(infodir)
280 # Where to install default configuration files. These include the local
281 # timezone specification and network data base files.
283 sysconfdir = $(prefix)/etc
285 inst_sysconfdir = $(install_root)$(sysconfdir)
287 # What timezone should be the installed default (e.g., US/Eastern).
288 # Run `make -C time echo-zonenames' to see a list of available zone names.
289 # The local timezone can be changed with `zic -l TIMEZONE' at any time.
294 # Where to install the "localtime" timezone file; this is the file whose
295 # contents $(localtime) specifies. If this is a relative pathname, it is
296 # relative to $(zonedir). It is a good idea to put this somewhere
297 # other than there, so the zoneinfo directory contains only universal data,
298 # localizing the configuration data elsewhere.
299 ifndef localtime-file
300 localtime-file = $(sysconfdir)/localtime
301 inst_localtime-file = $(install_root)$(localtime-file)
304 # What to use for leap second specifications in compiling the default
305 # timezone files. Set this to `/dev/null' for no leap second handling as
306 # 1003.1 requires, or to `leapseconds' for proper leap second handling.
307 # Both zone flavors are always available as `posix/ZONE' and `right/ZONE'.
308 # This variable determines the default: if it's `/dev/null',
309 # ZONE==posix/ZONE; if it's `leapseconds', ZONE==right/ZONE.
311 leapseconds = /dev/null
314 # What timezone's DST rules should be used when a POSIX-style TZ
315 # environment variable doesn't specify any rules. For 1003.1 compliance
316 # this timezone must use rules that are as U.S. federal law defines DST.
317 # Run `make -C time echo-zonenames' to see a list of available zone names.
318 # This setting can be changed with `zic -p TIMEZONE' at any time.
319 # If you want POSIX.1 compatibility, use `America/New_York'.
321 posixrules = America/New_York
324 # Where to install the "posixrules" timezone file; this is file
325 # whose contents $(posixrules) specifies. If this is a relative
326 # pathname, it is relative to $(zonedir).
327 ifndef posixrules-file
328 posixrules-file = posixrules
332 # Directory where your system's native header files live.
333 # This is used on Unix systems to generate some GNU libc header files.
335 sysincludedir = /usr/include
339 # Commands to install files.
341 INSTALL_DATA = $(INSTALL) -m 644
343 ifndef INSTALL_SCRIPT
344 INSTALL_SCRIPT = $(INSTALL)
346 ifndef INSTALL_PROGRAM
347 INSTALL_PROGRAM = $(INSTALL)
354 # The name of the C compiler.
355 # If you've got GCC, and it works, use it.
356 ifeq ($(origin CC),default)
360 # The name of the C compiler to use for compilations of programs to run on
361 # the host that is building the library. If you set CC to a
362 # cross-compiler, you must set this to the normal compiler.
367 # Default flags to pass the C compiler.
368 ifndef default_cflags
369 ifeq ($(release),stable)
370 default_cflags := -g -O2
372 default_cflags := -g -O
376 # Flags to pass the C compiler when assembling preprocessed assembly code
377 # (`.S' files). On some systems the assembler doesn't understand the `#' line
378 # directives the preprocessor produces. If you have troubling compiling
379 # assembly code, try using -P here to suppress these directives.
384 # ELF always supports init/fini sections
389 # Installed name of the startup code.
390 ifneq ($(have-initfini),yes)
391 # When not having init/fini, there is just one startfile, called crt0.o.
392 start-installed-name = crt0.o
394 # On systems having init/fini, crt0.o is called crt1.o, and there are
395 # some additional bizarre files.
396 start-installed-name = crt1.o
398 # On systems that do not need a special startfile for statically linked
399 # binaries, simply set it to the normal name.
400 ifndef static-start-installed-name
401 static-start-installed-name = $(start-installed-name)
404 ifeq (yesyesyes,$(build-shared)$(elf)$(have-z-combreloc))
405 combreloc-LDFLAGS = -Wl,-z,combreloc
406 LDFLAGS.so += $(combreloc-LDFLAGS)
407 LDFLAGS-rtld += $(combreloc-LDFLAGS)
410 ifeq (yes,$(have-z-relro))
411 relro-LDFLAGS = -Wl,-z,relro
412 LDFLAGS.so += $(relro-LDFLAGS)
413 LDFLAGS-rtld += $(relro-LDFLAGS)
416 # Command for linking programs with the C library.
418 +link = $(CC) -nostdlib -nostartfiles -o $@ \
419 $(sysdep-LDFLAGS) $(config-LDFLAGS) $(LDFLAGS) $(LDFLAGS-$(@F)) \
420 $(combreloc-LDFLAGS) $(relro-LDFLAGS) \
421 $(addprefix $(csu-objpfx),$(start-installed-name)) \
422 $(+preinit) $(+prector) \
423 $(filter-out $(addprefix $(csu-objpfx),start.o \
424 $(start-installed-name))\
425 $(+preinit) $(link-extra-libs) \
426 $(common-objpfx)libc% $(+postinit),$^) \
427 $(link-extra-libs) $(link-libc) $(+postctor) $(+postinit)
429 # Command for statically linking programs with the C library.
431 +link-static = $(CC) -nostdlib -nostartfiles -static -o $@ \
432 $(sysdep-LDFLAGS) $(LDFLAGS) $(LDFLAGS-$(@F)) \
433 $(addprefix $(csu-objpfx),$(static-start-installed-name)) \
434 $(+preinit) $(+prector) \
435 $(filter-out $(addprefix $(csu-objpfx),start.o \
436 $(start-installed-name))\
437 $(+preinit) $(link-extra-libs-static) \
438 $(common-objpfx)libc% $(+postinit),$^) \
439 $(link-extra-libs-static) $(link-libc-static) $(+postctor) $(+postinit)
441 # Command for statically linking bounded-pointer programs with the C library.
443 +link-bounded = $(CC) -nostdlib -nostartfiles -static -fbounded-pointers -o $@ \
444 $(sysdep-LDFLAGS) $(LDFLAGS) \
445 $(addprefix $(csu-objpfx),b$(static-start-installed-name)) \
446 $(+preinit) $(+prector) \
447 $(filter-out $(addprefix $(csu-objpfx),start.ob \
448 $(start-installed-name))\
449 $(+preinit) $(link-extra-libs-bounded) \
450 $(common-objpfx)libc% $(+postinit),$^) \
451 $(link-extra-libs-bounded) $(link-libc-bounded) $(+postctor) $(+postinit)
453 ifndef config-LDFLAGS
454 ifeq (yesyes,$(build-shared)$(elf))
455 config-LDFLAGS = -Wl,-dynamic-linker=$(slibdir)/$(rtld-installed-name)
459 ifeq (yes,$(build-shared))
461 # We need the versioned name of libc.so in the deps of $(others) et al
462 # so that the symlink to libc.so is created before anything tries to
463 # run the linked programs.
464 link-libc = -Wl,-rpath-link=$(rpath-link) \
465 $(common-objpfx)libc.so$(libc.so-version) \
466 $(common-objpfx)$(patsubst %,$(libtype.oS),c) $(gnulib)
467 # This is how to find at build-time things that will be installed there.
468 rpath-dirs = math elf dlfcn nss nis rt resolv crypt
471 $(common-objdir):$(subst $(empty) ,:,$(patsubst ../$(subdir),.,$(rpath-dirs:%=$(common-objpfx)%)))
472 elfobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)elf)
474 nssobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)nss)
475 resolvobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)resolv)
476 link-libc = $(common-objpfx)libc.a $(otherlibs) $(gnulib) $(common-objpfx)libc.a $(gnulib)
480 # Differences in the linkers on the various platforms.
482 LDFLAGS-rpath-ORIGIN = -Wl,-rpath,'$$ORIGIN'
483 LDFLAGS-soname-fname = -Wl,-soname,$(@F)
484 LDFLAGS-rdynamic = -rdynamic
485 LDFLAGS-Bsymbolic = -Bsymbolic
488 # Choose the default search path for the dynamic linker based on
489 # where we will install libraries.
490 ifneq ($(libdir),$(slibdir))
491 default-rpath = $(slibdir):$(libdir)
493 default-rpath = $(libdir)
496 ifndef link-extra-libs
497 link-extra-libs = $(LDLIBS-$(@F))
498 link-extra-libs-static = $(link-extra-libs)
499 link-extra-libs-bounded = $(link-extra-libs)
502 # The static libraries.
503 ifeq (yes,$(build-static))
504 link-libc-static = $(common-objpfx)libc.a $(static-gnulib) $(common-objpfx)libc.a
506 ifeq (yes,$(build-shared))
507 # We can try to link the programs with lib*_pic.a...
508 link-libc-static = $(static-gnulib) $(common-objpfx)libc_pic.a
511 link-libc-bounded = $(common-objpfx)libc_b.a $(gnulib) $(common-objpfx)libc_b.a
514 ifneq ($(have-cc-with-libunwind),yes)
519 ifneq ($(have-as-needed),yes)
520 libgcc_eh := -lgcc_eh $(libunwind)
522 libgcc_eh := -Wl,--as-needed -lgcc_s$(libgcc_s_suffix) $(libunwind) -Wl,--no-as-needed
524 gnulib := -lgcc $(libgcc_eh)
525 static-gnulib := -lgcc -lgcc_eh $(libunwind)
526 libc.so-gnulib := -lgcc
529 +preinit = $(addprefix $(csu-objpfx),crti.o)
530 +postinit = $(addprefix $(csu-objpfx),crtn.o)
531 +prector = `$(CC) --print-file-name=crtbegin.o`
532 +postctor = `$(CC) --print-file-name=crtend.o`
533 +interp = $(addprefix $(elf-objpfx),interp.os)
535 csu-objpfx = $(common-objpfx)csu/
536 elf-objpfx = $(common-objpfx)elf/
538 # How to run a program we just linked with our library.
539 # The program binary is assumed to be $(word 2,$^).
540 built-program-file = $(dir $(word 2,$^))$(notdir $(word 2,$^))
541 ifeq (yesyes,$(build-shared)$(elf))
543 sysdep-library-path = \
544 $(subst $(empty) ,:,$(strip $(patsubst -Wl$(comma)-rpath-link=%, %,\
545 $(filter -Wl$(comma)-rpath-link=%,\
546 $(sysdep-LDFLAGS)))))
547 run-program-prefix = $(if $(filter $(notdir $(built-program-file)),\
548 $(tests-static) $(xtests-static)),, \
549 $(elf-objpfx)$(rtld-installed-name) \
550 --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)))
554 # Never use $(run-program-prefix) for the statically-linked %-bp test programs
555 built-program-cmd = $(patsubst %,$(run-program-prefix),\
556 $(filter-out %-bp,$(built-program-file))) \
557 $(built-program-file)
567 # Extra flags to pass to GCC.
568 ifeq ($(all-warnings),yes)
569 +gccwarn := -Wall -Wwrite-strings -Winline -Wcast-qual -Wbad-function-cast -Wmissing-noreturn -Wmissing-prototypes -Wmissing-declarations -Wcomment -Wcomments -Wtrigraphs -Wsign-compare -Wfloat-equal -Wmultichar
571 +gccwarn := -Wall -Wwrite-strings -Winline
573 +gccwarn-c = -Wstrict-prototypes
575 # We do not depend on the address of constants in different files to be
576 # actually different, so allow the compiler to merge them all.
577 +merge-constants = -fmerge-all-constants
579 # This is the program that generates makefile dependencies from C source files.
580 # The -MP flag tells GCC >= 3.2 (which we now require) to produce dummy
581 # targets for headers so that removed headers don't break the build.
583 +mkdep = $(CC) -M -MP
586 # The program that makes Emacs-style TAGS files.
589 # The `xgettext' program for producing .pot files from sources.
594 # The `m4' macro processor; this is used by sysdeps/sparc/Makefile (and
595 # perhaps others) to preprocess assembly code in some cases.
598 # To force installation of files even if they are older than the
599 # installed files. This variable is included in the dependency list
600 # of all installation targets.
601 ifeq ($(force-install),yes)
602 +force = force-install
608 #### End of configuration variables.
611 # This tells some versions of GNU make before 3.63 not to export all variables.
614 # We want to echo the commands we're running without
615 # umpteen zillion filenames along with it (we use `...' instead)
616 # but we don't want this echoing done when the user has said
617 # he doesn't want to see commands echoed by using -s.
618 ifneq "$(findstring s,$(MAKEFLAGS))" "" # if -s
619 +cmdecho := echo >/dev/null
624 # These are the flags given to the compiler to tell
625 # it what sort of optimization and/or debugging output to do.
627 # If `CFLAGS' was defined, use that.
629 +cflags := $(filter-out -I%,$(CFLAGS))
633 # If none of the above worked, default to "-g -O".
634 ifeq "$(strip $(+cflags))" ""
635 +cflags := $(default_cflags)
636 endif # $(+cflags) == ""
638 +cflags += $(addprefix -mcpu=,$(with-cpu)) $(+gccwarn) $(+merge-constants)
641 # Don't duplicate options if we inherited variables from the parent.
642 +cflags := $(sort $(+cflags))
645 # These are flags given to the C compiler to tell it to look for
646 # include files (including ones given in angle brackets) in the parent
647 # library source directory, in the include directory, and in the
649 +sysdep-includes = $(addprefix -I,$(+sysdep_dirs))
650 +includes = -I$(..)include $(if $(subdir),$(objpfx:%/=-I%)) \
651 $(+sysdep-includes) $(includes) \
652 $(patsubst %/,-I%,$(..)) $(libio-include) -I. $(sysincludes)
654 # Since libio has several internal header files, we use a -I instead
655 # of many little headers in the include directory.
656 libio-include = -I$(..)libio
658 # These are the variables that the implicit compilation rules use.
659 # Note that we can't use -std=* in CPPFLAGS, because it overrides
660 # the implicit -lang-asm and breaks cpp behavior for .S files--notably
661 # it causes cpp to stop predefining __ASSEMBLER__.
662 CPPFLAGS = $($(subdir)-CPPFLAGS) $(+includes) $(defines) \
663 -include $(..)include/libc-symbols.h $(sysdep-CPPFLAGS) \
664 $(CPPFLAGS-$(suffix $@)) \
665 $(foreach lib,$(libof-$(basename $(@F))) \
666 $(libof-$(<F)) $(libof-$(@F)),$(CPPFLAGS-$(lib))) \
667 $(CPPFLAGS-$(<F)) $(CPPFLAGS-$(@F)) $(CPPFLAGS-$(basename $(@F)))
668 override CFLAGS = -std=gnu99 \
669 $(filter-out %frame-pointer,$(+cflags)) $(+gccwarn-c) \
670 $(sysdep-CFLAGS) $(CFLAGS-$(suffix $@)) $(CFLAGS-$(<F)) \
672 override CXXFLAGS = $(c++-sysincludes) \
673 $(filter-out %frame-pointer,$(+cflags)) $(sysdep-CFLAGS) \
674 $(CFLAGS-$(suffix $@)) $(CFLAGS-$(<F)) $(CFLAGS-$(@F))
676 # If everything is compiled with -fPIC (implicitly) we must tell this by
677 # defining the PIC symbol.
678 ifeq (yes,$(build-pic-default))
682 # Enable object files for different versions of the library.
683 # Various things use $(object-suffixes) to know what all to make.
684 # The compilation rules use $(CPPFLAGS-${SUFFIX}) and $(CFLAGS-${SUFFIX})
685 # to pass different flags for each flavor.
686 libtypes = $(foreach o,$(object-suffixes-for-libc),$(libtype$o))
687 all-object-suffixes := .o .os .op .og .ob .oS
689 CPPFLAGS-.o = $(pic-default)
690 CFLAGS-.o = $(filter %frame-pointer,$(+cflags))
691 ifeq (yes,$(build-static))
693 object-suffixes += .o
695 ifeq (yes,$(build-shared))
696 # Under --enable-shared, we will build a shared library of PIC objects.
697 # The PIC object files are named foo.os.
698 object-suffixes += .os
699 CPPFLAGS-.os = -DPIC -DSHARED
700 CFLAGS-.os = $(filter %frame-pointer,$(+cflags)) $(pic-ccflag)
701 libtype.os := lib%_pic.a
702 # This can be changed by a sysdep makefile
704 # This one should always stay like this unless there is a very good reason.
707 ifeq (yes,$(build-profile))
708 # Under --enable-profile, we will build a static library of profiled objects.
709 # The profiled object files are named foo.op.
710 object-suffixes += .op
711 CPPFLAGS-.op = -DPROF $(pic-default)
713 libtype.op = lib%_p.a
715 ifeq (yes,$(build-omitfp))
716 # Under --enable-omitfp, we build the library optimized without
717 # debugging information using -fomit-frame-pointer, and build an extra
718 # library with debugging information. The debuggable objects are named foo.og.
719 object-suffixes += .og
720 CPPFLAGS-.og = $(pic-default)
722 CFLAGS-.o = $(filter %frame-pointer,$(+cflags)) -g0 -O99 -fomit-frame-pointer -D__USE_STRING_INLINES
723 CFLAGS-.os += -g0 -O99 -fomit-frame-pointer -D__USE_STRING_INLINES
724 libtype.og = lib%_g.a
728 ifeq (yes,$(build-bounded))
729 # Under --enable-bounded, we build the library with `-fbounded-pointers -g'
730 # to runtime bounds checking. The bounded-pointer objects are named foo.ob.
731 # We disable sibling-call optimizations so that stack traces will be complete
732 # and thus aid debugging, since after all, BPs are a debugging tool.
733 object-suffixes += .ob
734 CPPFLAGS-.ob = -fbounded-pointers $(pic-default)
735 CFLAGS-.ob = -g -O2 -fno-optimize-sibling-calls -fno-strict-aliasing
736 libtype.ob = lib%_b.a
739 object-suffixes-for-libc := $(object-suffixes)
741 ifeq (yes,$(build-shared))
742 # Build special library that contains the static-only routines for libc.
743 object-suffixes-for-libc += .oS
745 # Must build the routines as PIC, though, because they can end up in (users')
746 # shared objects. We don't want to use CFLAGS-os because users may, for
747 # example, make that processor-specific.
748 CFLAGS-.oS = $(CFLAGS-.o) $(PIC-ccflag)
749 CPPFLAGS-.oS = $(CPPFLAGS-.o) -DPIC -DLIBC_NONSHARED=1
750 libtype.oS = lib%_nonshared.a
753 # The assembler can generate debug information too.
755 ifeq ($(have-cpp-asm-debuginfo),yes)
756 ASFLAGS := $(filter -g%,$(CFLAGS))
761 ASFLAGS += $(ASFLAGS-config)
767 move-if-change = $(SHELL) $(..)scripts/move-if-change
769 -include $(common-objpfx)sysd-sorted
770 subdirs = $(sorted-subdirs)
771 subdir-srcdirs = $(foreach dir,$(subdirs),\
772 $(firstword $($(dir)-srcdir) $(..)$(dir)))
774 ifeq (yes, $(build-shared))
776 # This is a pair of implicit rules to preprocess a file with # comments,
777 # %ifdef et al, based on config.h settings or other %include'd files.
778 # We use chained rules instead of a pipeline here so that we can properly
779 # check the exit status of cpp rather than using its bad output when there
780 # is a preprocessing error. Another rule should depend on the output file
781 # `FOO.v', and along with that `FOO.v.i' should be given dependencies
782 # listing both its input files, and any header files that it may reference
784 %.v.i: $(common-objpfx)config.h
785 sed '/^[ ]*#/d;s/^[ ]*%/#/' $(filter-out FORCE %.h,$^) \
786 | $(CC) -E -undef $(CPPFLAGS) -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