1 # Copyright (C) 1991-2019 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, see
16 # <http://www.gnu.org/licenses/>.
19 # Makefile configuration options for the GNU C library.
22 This makefile requires GNU Make.
25 all: # Make this the default goal
27 ifneq "$(origin +included-Makeconfig)" "file"
29 +included-Makeconfig := yes
35 # $(common-objdir) is the place to put objects and
36 # such that are not specific to a single subdir.
38 objpfx := $(patsubst %//,%/,$(objdir)/$(subdir)/)
39 common-objpfx = $(objdir)/
40 common-objdir = $(objdir)
42 objdir must be defined by the build-directory Makefile.
45 # Root of the sysdeps tree.
46 sysdep_dir := $(..)sysdeps
47 export sysdep_dir := $(sysdep_dir)
49 # Get the values defined by options to `configure'.
50 include $(common-objpfx)config.make
52 # What flags to give to sources which call user provided callbacks
53 uses-callbacks = -fexceptions
55 # What flags to give to tests which test stack alignment
56 stack-align-test-flags =
58 # Complete path to sysdep dirs.
59 # `configure' writes a definition of `config-sysdirs' in `config.make'.
60 sysdirs := $(foreach D,$(config-sysdirs),$(firstword $(filter /%,$D) $(..)$D))
62 +sysdep_dirs = $(sysdirs)
64 +sysdep_dirs := $(objdir) $(+sysdep_dirs)
67 # Run config.status to update config.make and config.h. We don't show the
68 # dependence of config.h to Make, because it is only touched when it
69 # changes and so config.status would be run every time; the dependence of
70 # config.make should suffice to force regeneration and re-exec, and the new
71 # image will notice if config.h changed.
72 $(common-objpfx)config.make: $(common-objpfx)config.status \
73 $(..)config.make.in $(..)config.h.in
74 cd $(<D); $(SHELL) $(<F)
76 # Find all the sysdeps configure fragments, to make sure we re-run
77 # configure when any of them changes.
78 $(common-objpfx)config.status: $(..)version.h $(..)configure \
79 $(foreach dir,$(sysdirs),\
80 $(wildcard $(dir)/Implies) \
82 $(firstword $(wildcard \
83 $(addprefix $(dir)/,configure configure.ac))))) \
85 $(wildcard $(..)sysdeps/*/preconfigure $(..)sysdeps/*/preconfigure.ac))
86 @cd $(@D); if test -f $(@F); then exec $(SHELL) $(@F) --recheck; else \
87 echo The GNU C library has not been configured. >&2; \
88 echo Run \`configure\' to configure it before building. >&2; \
89 echo Try \`configure --help\' for more details. >&2; \
92 # We don't want CPPFLAGS to be exported to the command running configure.
95 # Get the user's configuration parameters.
96 ifneq ($(wildcard $(..)configparms),)
97 include $(..)configparms
100 ifneq ($(wildcard $(common-objpfx)configparms),)
101 include $(common-objpfx)configparms
106 #### These are the configuration variables. You can define values for
107 #### the variables below in the file `configparms'.
108 #### Do NOT edit this file.
112 # Common prefix for machine-independent installation directories.
113 ifeq ($(origin prefix),undefined) # ifndef would override explicit empty value.
117 # Decide whether we shall build the programs or not. We always do this
118 # unless the user tells us (in configparms) or we are building for a
120 ifndef build-programs
121 ifneq ($(config-os),none)
128 # Common prefix for machine-dependent installation directories.
129 ifeq ($(origin exec_prefix),undefined)
130 exec_prefix = $(prefix)
133 # Where to install the library and object files.
135 libdir = $(exec_prefix)/lib
137 inst_libdir = $(install_root)$(libdir)
139 # Where to install the shared library.
141 slibdir = $(exec_prefix)/lib
143 inst_slibdir = $(install_root)$(slibdir)
145 # Where to install the dynamic linker.
149 inst_rtlddir = $(install_root)$(rtlddir)
151 # Prefix to put on files installed in $(libdir). For libraries `libNAME.a',
152 # the prefix is spliced between `lib' and the name, so the linker switch
153 # `-l$(libprefix)NAME' finds the library; for other files the prefix is
154 # just prepended to the whole file name.
155 ifeq ($(origin libprefix),undefined)
159 # Where to install the header files.
161 includedir = $(prefix)/include
163 inst_includedir = $(install_root)$(includedir)
165 # Where to install machine-independent data files.
166 # These are the timezone database, and the locale database.
168 datadir = $(prefix)/share
170 inst_datadir = $(install_root)$(datadir)
172 # Where to install the timezone data files (which are machine-independent).
174 zonedir = $(datadir)/zoneinfo
176 inst_zonedir = $(install_root)$(zonedir)
178 # Where to install the compiled binary locale archive and compiled
179 # binary locale files.
181 complocaledir = $(libdir)/locale
183 inst_complocaledir = $(install_root)$(complocaledir)
185 # Where to install the message catalog data files (which are
186 # machine-independent).
188 localedir = $(datadir)/locale
190 inst_localedir = $(install_root)$(localedir)
192 # Where to install the locale charmap source files.
194 i18ndir = $(datadir)/i18n
196 inst_i18ndir = $(install_root)$(i18ndir)
198 # Where to install the shared object for charset transformation.
200 gconvdir = $(libdir)/gconv
202 inst_gconvdir = $(install_root)$(gconvdir)
204 # Where to install programs.
206 bindir = $(exec_prefix)/bin
208 inst_bindir = $(install_root)$(bindir)
210 # Where to install internal programs.
212 libexecdir = $(exec_prefix)/libexec
214 inst_libexecdir = $(install_root)$(libexecdir)
216 # Where to install administrative programs.
218 rootsbindir = $(exec_prefix)/sbin
220 inst_rootsbindir = $(install_root)$(rootsbindir)
223 sbindir = $(exec_prefix)/sbin
225 inst_sbindir = $(install_root)$(sbindir)
227 # Where to install the Info files.
229 infodir = $(prefix)/info
231 inst_infodir = $(install_root)$(infodir)
233 # Where to install audit libraries.
235 auditdir = $(libdir)/audit
237 inst_auditdir = $(install_root)$(auditdir)
239 # Where to install default configuration files. These include the local
240 # timezone specification and network data base files.
242 sysconfdir = $(prefix)/etc
244 inst_sysconfdir = $(install_root)$(sysconfdir)
246 # Directory for the database files and Makefile for nss_db.
248 vardbdir = $(localstatedir)/db
250 inst_vardbdir = $(install_root)$(vardbdir)
252 # Where to install the "localtime" timezone file; this is the file whose
253 # contents $(localtime) specifies. If this is a relative pathname, it is
254 # relative to $(zonedir). It is a good idea to put this somewhere
255 # other than there, so the zoneinfo directory contains only universal data,
256 # localizing the configuration data elsewhere.
257 ifndef localtime-file
258 localtime-file = $(sysconfdir)/localtime
261 # What to use for leap second specifications in compiling the default
262 # timezone files. Set this to `/dev/null' for no leap second handling as
263 # 1003.1 requires, or to `leapseconds' for proper leap second handling.
264 # Both zone flavors are always available as `posix/ZONE' and `right/ZONE'.
265 # This variable determines the default: if it's `/dev/null',
266 # ZONE==posix/ZONE; if it's `leapseconds', ZONE==right/ZONE.
268 leapseconds = /dev/null
271 # What timezone's DST rules should be used when a POSIX-style TZ
272 # environment variable doesn't specify any rules. For 1003.1 compliance
273 # this timezone must use rules that are as U.S. federal law defines DST.
274 # Run `make -C time echo-zonenames' to see a list of available zone names.
275 # This setting can be changed with `zic -p TIMEZONE' at any time.
276 # If you want POSIX.1 compatibility, use `America/New_York'.
278 posixrules = America/New_York
281 # Where to install the "posixrules" timezone file; this is file
282 # whose contents $(posixrules) specifies. If this is a relative
283 # pathname, it is relative to $(zonedir).
284 ifndef posixrules-file
285 posixrules-file = posixrules
289 # Directory where your system's native header files live.
290 # This is used on Unix systems to generate some GNU libc header files.
292 sysincludedir = /usr/include
296 # Commands to install files.
298 INSTALL_DATA = $(INSTALL) -m 644
300 ifndef INSTALL_SCRIPT
301 INSTALL_SCRIPT = $(INSTALL)
303 ifndef INSTALL_PROGRAM
304 INSTALL_PROGRAM = $(INSTALL)
311 # The name of the C compiler.
312 # If you've got GCC, and it works, use it.
313 ifeq ($(origin CC),default)
317 # The name of the C compiler to use for compilations of programs to run on
318 # the host that is building the library. If you set CC to a
319 # cross-compiler, you must set this to the normal compiler.
324 # Default flags to pass the C compiler.
325 ifndef default_cflags
326 ifeq ($(release),stable)
327 default_cflags := -g -O2
329 default_cflags := -g -O
333 # Flags to pass the C compiler when assembling preprocessed assembly code
339 as-needed := -Wl,--as-needed
340 no-as-needed := -Wl,--no-as-needed
342 # Must be supported by the linker.
343 no-whole-archive = -Wl,--no-whole-archive
344 whole-archive = -Wl,--whole-archive
346 # Installed name of the startup code.
347 # The ELF convention is that the startfile is called crt1.o
348 start-installed-name = crt1.o
349 # On systems that do not need a special startfile for statically linked
350 # binaries, simply set it to the normal name.
351 ifndef static-start-installed-name
352 static-start-installed-name = $(start-installed-name)
355 ifeq (yes,$(enable-static-pie))
356 # Link with rcrt1.o, instead of crt1.o, to call _dl_relocate_static_pie
357 # to relocate static PIE.
358 real-static-start-installed-name = r$(static-start-installed-name)
360 real-static-start-installed-name = $(static-start-installed-name)
363 ifeq (yesyes,$(build-shared)$(have-z-combreloc))
364 combreloc-LDFLAGS = -Wl,-z,combreloc
365 LDFLAGS.so += $(combreloc-LDFLAGS)
366 LDFLAGS-rtld += $(combreloc-LDFLAGS)
369 relro-LDFLAGS = -Wl,-z,relro
370 LDFLAGS.so += $(relro-LDFLAGS)
371 LDFLAGS-rtld += $(relro-LDFLAGS)
373 ifeq (yes,$(have-hash-style))
374 # For the time being we unconditionally use 'both'. At some time we
375 # should declare statically linked code as 'out of luck' and compile
376 # with --hash-style=gnu only.
377 hashstyle-LDFLAGS = -Wl,--hash-style=both
378 LDFLAGS.so += $(hashstyle-LDFLAGS)
379 LDFLAGS-rtld += $(hashstyle-LDFLAGS)
382 ifeq (yes,$(enable-static-pie))
384 # Compile libc.a and libc_p.a with -fPIE/-fpie for static PIE.
385 pie-default = $(pie-ccflag)
386 ifeq (yes,$(have-static-pie))
387 default-pie-ldflag = -static-pie
389 # Static PIE can't have dynamic relocations in read-only segments since
390 # static PIE is mapped into memory by kernel. --eh-frame-hdr is needed
391 # for PIE to support exception.
392 default-pie-ldflag = -Wl,-pie,--no-dynamic-linker,--eh-frame-hdr,-z,text
396 # If lazy relocations are disabled, add the -z now flag. Use
397 # LDFLAGS-lib.so instead of LDFLAGS.so, to avoid adding the flag to
399 ifeq ($(bind-now),yes)
400 LDFLAGS-lib.so += -Wl,-z,now
401 # Extra flags for dynamically linked non-test main programs.
402 link-extra-flags += -Wl,-z,now
405 # Command to run after every final link (executable or shared object).
406 # This is invoked with $(call after-link,...), so it should operate on
407 # the file $1. This can be set to do some sort of post-processing on
408 # binaries, or to perform some sort of static sanity check.
413 # Additional libraries to link into every test.
414 link-extra-libs-tests = $(libsupport)
416 # Command for linking PIE programs with the C library.
418 +link-pie-before-libc = $(if $($(@F)-no-pie),$(no-pie-ldflag),-pie) \
419 -Wl,-O1 -nostdlib -nostartfiles -o $@ \
420 $(sysdep-LDFLAGS) $(LDFLAGS) $(LDFLAGS-$(@F)) \
421 $(combreloc-LDFLAGS) $(relro-LDFLAGS) $(hashstyle-LDFLAGS) \
422 $(firstword $(CRT-$(@F)) $(csu-objpfx)S$(start-installed-name)) \
423 $(+preinit) $(+prectorS) \
424 $(filter-out $(addprefix $(csu-objpfx),start.o \
425 S$(start-installed-name))\
426 $(+preinit) $(link-extra-libs) \
427 $(common-objpfx)libc% $(+postinit),$^) \
429 +link-pie-after-libc = $(+postctorS) $(+postinit)
431 $(CC) $(link-libc-rpath-link) $(+link-pie-before-libc) $(rtld-LDFLAGS) \
432 $(link-extra-flags) $(link-libc) $(+link-pie-after-libc)
433 $(call after-link,$@)
435 define +link-pie-tests
436 $(CC) $(+link-pie-before-libc) $(rtld-tests-LDFLAGS) $(link-libc-tests) \
437 $(+link-pie-after-libc)
438 $(call after-link,$@)
440 define +link-pie-printers-tests
441 $(CC) $(+link-pie-before-libc) $(built-rtld-LDFLAGS) \
442 $(link-libc-printers-tests) $(+link-pie-after-libc)
443 $(call after-link,$@)
446 # Command for statically linking programs with the C library.
448 +link-static-before-libc = -nostdlib -nostartfiles -static -o $@ \
449 $(if $($(@F)-no-pie),$(no-pie-ldflag),$(default-pie-ldflag)) \
450 $(sysdep-LDFLAGS) $(LDFLAGS) $(LDFLAGS-$(@F)) \
451 $(firstword $(CRT-$(@F)) $(csu-objpfx)$(real-static-start-installed-name)) \
452 $(+preinit) $(+prectorT) \
453 $(filter-out $(addprefix $(csu-objpfx),start.o \
454 $(start-installed-name))\
455 $(+preinit) $(link-extra-libs-static) \
456 $(common-objpfx)libc% $(+postinit),$^) \
457 $(link-extra-libs-static)
458 +link-static-after-libc = $(+postctorT) $(+postinit)
460 $(CC) $(+link-static-before-libc) $(link-extra-flags) $(link-libc-static) \
461 $(+link-static-after-libc)
462 $(call after-link,$@)
464 define +link-static-tests
465 $(CC) $(+link-static-before-libc) $(link-libc-static-tests) \
466 $(+link-static-after-libc)
467 $(call after-link,$@)
470 # Commands for linking programs with the C library.
472 ifeq (yes,$(build-shared))
473 ifeq (yes,$(cc-pie-default))
474 no-pie-ldflag = -no-pie
476 ifeq (yes,$(build-pie-default))
478 +link-tests = $(+link-pie-tests)
479 +link-printers-tests = $(+link-pie-printers-tests)
480 else # not build-pie-default
481 +link-before-libc = -nostdlib -nostartfiles -o $@ \
482 $(sysdep-LDFLAGS) $(LDFLAGS) $(LDFLAGS-$(@F)) \
483 $(combreloc-LDFLAGS) $(relro-LDFLAGS) $(hashstyle-LDFLAGS) \
484 $(firstword $(CRT-$(@F)) $(csu-objpfx)$(start-installed-name)) \
485 $(+preinit) $(+prector) \
486 $(filter-out $(addprefix $(csu-objpfx),start.o \
487 $(start-installed-name))\
488 $(+preinit) $(link-extra-libs) \
489 $(common-objpfx)libc% $(+postinit),$^) \
491 +link-after-libc = $(+postctor) $(+postinit)
493 $(CC) $(link-libc-rpath-link) $(+link-before-libc) $(rtld-LDFLAGS) \
494 $(link-extra-flags) $(link-libc) $(+link-after-libc)
495 $(call after-link,$@)
498 $(CC) $(+link-before-libc) $(rtld-tests-LDFLAGS) $(link-libc-tests) \
500 $(call after-link,$@)
502 define +link-printers-tests
503 $(CC) $(+link-before-libc) $(built-rtld-LDFLAGS) $(link-libc-printers-tests) \
505 $(call after-link,$@)
507 endif # build-pie-default
509 +link = $(+link-static)
510 +link-tests = $(+link-static-tests)
511 +link-printers-tests = $(+link-static-tests)
515 # The pretty printer test programs need to be compiled without optimizations
516 # so they won't confuse gdb. We could use either the 'GCC optimize' pragma
517 # or the 'optimize' function attribute to achieve this; however, at least on
518 # ARM, gcc always produces different debugging symbols when invoked with
519 # a -O greater than 0 than when invoked with -O0, regardless of anything else
520 # we're using to suppress optimizations. Therefore, we need to explicitly pass
521 # -O0 to it through CFLAGS.
522 # Additionally, the build system will try to -include $(common-objpfx)/config.h
523 # when compiling the tests, which will throw an error if some special macros
524 # (such as __OPTIMIZE__ and IS_IN_build) aren't defined. To avoid this, we
525 # tell gcc to define IS_IN_build.
526 CFLAGS-printers-tests := -O0 -ggdb3 -DIS_IN_build
528 ifeq (yes,$(build-shared))
529 # These indicate whether to link using the built ld.so or the installed one.
530 installed-rtld-LDFLAGS = -Wl,-dynamic-linker=$(rtlddir)/$(rtld-installed-name)
531 built-rtld-LDFLAGS = -Wl,-dynamic-linker=$(elf-objpfx)ld.so
534 rtld-LDFLAGS = $(installed-rtld-LDFLAGS)
537 ifndef rtld-tests-LDFLAGS
538 ifeq (yes,$(build-hardcoded-path-in-tests))
539 rtld-tests-LDFLAGS = $(built-rtld-LDFLAGS)
541 rtld-tests-LDFLAGS = $(installed-rtld-LDFLAGS)
542 endif # build-hardcoded-path-in-tests
543 endif # rtld-tests-LDFLAGS
548 ifeq (yes,$(build-shared))
549 # We need the versioned name of libc.so in the deps of $(others) et al
550 # so that the symlink to libc.so is created before anything tries to
551 # run the linked programs.
552 link-libc-rpath = -Wl,-rpath=$(rpath-link)
553 link-libc-rpath-link = -Wl,-rpath-link=$(rpath-link)
555 # For programs which are not tests, $(link-libc-rpath-link) is added
556 # directly in $(+link), $(+link-pie) above, so that -Wl,-rpath-link
557 # comes before the expansion of LDLIBS-* and affects libraries added
558 # there. For shared objects, -Wl,-rpath-link is added via
559 # $(build-shlib-helper) and $(build-module-helper) in Makerules (also
560 # before the expansion of LDLIBS-* variables).
562 # Tests use -Wl,-rpath instead of -Wl,-rpath-link for
563 # build-hardcoded-path-in-tests.
564 ifeq (yes,$(build-hardcoded-path-in-tests))
565 link-libc-tests-rpath-link = $(link-libc-rpath)
567 link-libc-tests-rpath-link = $(link-libc-rpath-link)
568 endif # build-hardcoded-path-in-tests
570 link-libc-before-gnulib = $(common-objpfx)libc.so$(libc.so-version) \
571 $(common-objpfx)$(patsubst %,$(libtype.oS),c) \
572 $(as-needed) $(elf-objpfx)ld.so \
574 link-libc = $(link-libc-before-gnulib) $(gnulib)
576 link-libc-tests-after-rpath-link = $(link-libc-before-gnulib) $(gnulib-tests)
577 link-libc-tests = $(link-libc-tests-rpath-link) \
578 $(link-libc-tests-after-rpath-link)
579 # Pretty printer test programs always require rpath instead of rpath-link.
580 link-libc-printers-tests = $(link-libc-rpath) \
581 $(link-libc-tests-after-rpath-link)
583 # This is how to find at build-time things that will be installed there.
584 rpath-dirs = math elf dlfcn nss nis rt resolv mathvec support
586 $(common-objdir):$(subst $(empty) ,:,$(patsubst ../$(subdir),.,$(rpath-dirs:%=$(common-objpfx)%)))
588 link-libc = $(common-objpfx)libc.a $(otherlibs) $(gnulib) $(common-objpfx)libc.a $(gnulib)
589 link-libc-tests = $(common-objpfx)libc.a $(otherlibs) $(gnulib-tests) $(common-objpfx)libc.a $(gnulib-tests)
593 # Differences in the linkers on the various platforms.
594 LDFLAGS-rpath-ORIGIN = -Wl,-rpath,'$$ORIGIN'
595 LDFLAGS-soname-fname = -Wl,-soname,$(@F)
596 LDFLAGS-rdynamic = -rdynamic
597 LDFLAGS-Bsymbolic = -Bsymbolic
599 # Choose the default search path for the dynamic linker based on
600 # where we will install libraries.
601 ifneq ($(libdir),$(slibdir))
602 default-rpath = $(slibdir):$(libdir)
604 default-rpath = $(libdir)
607 ifndef link-extra-libs
608 link-extra-libs = $(LDLIBS-$(@F))
609 link-extra-libs-static = $(link-extra-libs)
612 # The static libraries.
613 link-libc-static = -Wl,--start-group $(common-objpfx)libc.a $(static-gnulib) -Wl,--end-group
614 link-libc-static-tests = -Wl,--start-group $(common-objpfx)libc.a $(static-gnulib-tests) -Wl,--end-group
616 # How to link against libgcc. Some libgcc functions, such as those
617 # for "long long" arithmetic or software floating point, can always be
618 # built without use of C library headers and do not have any global
619 # state so can safely be linked statically into any executable or
620 # shared library requiring them; these functions are in libgcc.a.
621 # Other functions, relating to exception handling, may require C
622 # library headers to build and it may not be safe to have more than
623 # one copy of them in a process; these functions are only in
624 # libgcc_s.so and libgcc_eh.a.
626 # To avoid circular dependencies when bootstrapping, it is desirable
627 # to avoid use of libgcc_s and libgcc_eh in building glibc. Where any
628 # glibc functionality (in particular, thread cancellation) requires
629 # exception handling, this is implemented through dlopen of libgcc_s
630 # to avoid unnecessary dependencies on libgcc_s by programs not using
631 # that functionality; executables built with glibc do not use
632 # exception handling other than through thread cancellation.
634 # Undefined references to functions from libgcc_eh or libgcc_s may
635 # arise for code built with -fexceptions. In the case of statically
636 # linked programs installed by glibc, unwinding will never actually
637 # occur at runtime and the use of elf/static-stubs.c to resolve these
638 # references is safe. In the case of statically linked test programs
639 # and test programs built with -fexceptions, unwinding may occur in
640 # some cases and it is preferable to link with libgcc_eh or libgcc_s
641 # so that the testing is as similar as possible to how programs will
642 # be built with the installed glibc.
644 # Some architectures have architecture-specific systems for exception
645 # handling that may involve undefined references to
646 # architecture-specific functions. On those architectures,
647 # gnulib-arch and static-gnulib-arch may be defined in sysdeps
648 # makefiles to use additional libraries for linking executables and
649 # shared libraries built by glibc.
651 ifneq ($(have-cc-with-libunwind),yes)
656 libgcc_eh := -Wl,--as-needed -lgcc_s $(libunwind) -Wl,--no-as-needed
658 gnulib = -lgcc $(gnulib-arch)
659 gnulib-tests := -lgcc $(libgcc_eh)
661 # By default, elf/static-stubs.o, instead of -lgcc_eh, is used to
662 # statically link programs. When --disable-shared is used, we use
663 # -lgcc_eh since elf/static-stubs.o isn't sufficient.
664 ifeq (yes,$(build-shared))
665 static-gnulib = -lgcc $(static-gnulib-arch)
667 static-gnulib = -lgcc -lgcc_eh $(static-gnulib-arch)
669 static-gnulib-tests := -lgcc -lgcc_eh $(libunwind)
670 libc.so-gnulib := -lgcc
672 +preinit = $(addprefix $(csu-objpfx),crti.o)
673 +postinit = $(addprefix $(csu-objpfx),crtn.o)
674 +prector = `$(CC) $(sysdep-LDFLAGS) --print-file-name=crtbegin.o`
675 +postctor = `$(CC) $(sysdep-LDFLAGS) --print-file-name=crtend.o`
676 # Variants of the two previous definitions for linking PIE programs.
677 +prectorS = `$(CC) $(sysdep-LDFLAGS) --print-file-name=crtbeginS.o`
678 +postctorS = `$(CC) $(sysdep-LDFLAGS) --print-file-name=crtendS.o`
679 # Variants of the two previous definitions for statically linking programs.
680 ifeq (yes,$(enable-static-pie))
681 # Static PIE must use PIE variants.
682 +prectorT = $(+prectorS)
683 +postctorT = $(+postctorS)
685 +prectorT = `$(CC) $(sysdep-LDFLAGS) --print-file-name=crtbeginT.o`
686 +postctorT = `$(CC) $(sysdep-LDFLAGS) --print-file-name=crtend.o`
688 csu-objpfx = $(common-objpfx)csu/
689 elf-objpfx = $(common-objpfx)elf/
691 # A command that, prepended to the name and arguments of a program,
692 # and run on the build system, causes that program with those
693 # arguments to be run on the host for which the library is built.
697 # Likewise, but the name of the program is preceded by
698 # <variable>=<value> assignments for environment variables.
699 ifndef test-wrapper-env
700 test-wrapper-env = $(test-wrapper) env
702 # Likewise, but the program's environment will be empty except for any
703 # explicit <variable>=<value> assignments preceding the program name.
704 ifndef test-wrapper-env-only
705 test-wrapper-env-only = $(test-wrapper) env -i
708 # Whether to run test programs built for the library's host system.
709 ifndef run-built-tests
710 ifeq (yes|,$(cross-compiling)|$(test-wrapper))
713 run-built-tests = yes
717 # Whether to stop immediately when a test fails. Nonempty means to
718 # stop, empty means not to stop.
719 ifndef stop-on-test-failure
720 stop-on-test-failure =
723 # How to run a program we just linked with our library.
724 # The program binary is assumed to be $(word 2,$^).
725 built-program-file = $(dir $(word 2,$^))$(notdir $(word 2,$^))
726 rtld-prefix = $(elf-objpfx)$(rtld-installed-name) \
728 $(rpath-link)$(patsubst %,:%,$(sysdep-library-path))
729 ifeq (yes,$(build-shared))
731 sysdep-library-path = \
732 $(subst $(empty) ,:,$(strip $(patsubst -Wl$(comma)-rpath-link=%, %,\
733 $(filter -Wl$(comma)-rpath-link=%,\
734 $(sysdep-LDFLAGS)))))
735 # $(run-via-rtld-prefix) is a command that, when prepended to the name
736 # of a program built with the newly built library, produces a command
737 # that, executed on the host for which the library is built, runs that
738 # program. For tests listed in tests-static or xtests-static, it is
740 run-via-rtld-prefix = \
741 $(if $(strip $(filter $(notdir $(built-program-file)), \
742 $(tests-static) $(xtests-static))),, $(rtld-prefix))
744 run-via-rtld-prefix =
746 # $(run-program-env) is the default environment variable settings to
747 # use when running a program built with the newly built library.
748 run-program-env = GCONV_PATH=$(common-objpfx)iconvdata \
749 LOCPATH=$(common-objpfx)localedata LC_ALL=C
750 # $(run-program-prefix) is a command that, when prepended to the name
751 # of a program built with the newly built library, produces a command
752 # that, executed on the build system on which "make" is run, runs that
753 # program. $(run-program-prefix-before-env) and
754 # $(run-program-prefix-after-env) are similar, but separate parts
755 # before and after a list of environment variables.
756 run-program-prefix-before-env = $(test-wrapper-env)
757 run-program-prefix-after-env = $(run-via-rtld-prefix)
758 run-program-prefix = $(run-program-prefix-before-env) $(run-program-env) \
759 $(run-program-prefix-after-env)
760 # $(built-program-cmd) is a command that, executed on the build system
761 # on which "make" is run, runs the newly built program that is the
762 # second dependency of the makefile target in which
763 # $(built-program-cmd) is used. $(built-program-cmd-before-env) and
764 # $(built-program-cmd-after-env) are similar, before and after a list
765 # of environment variables.
766 built-program-cmd-before-env = $(test-wrapper-env)
767 built-program-cmd-after-env = $(run-via-rtld-prefix) $(built-program-file)
768 built-program-cmd = $(built-program-cmd-before-env) $(run-program-env) \
769 $(built-program-cmd-after-env)
770 # $(host-built-program-cmd) is a command that, executed on the host
771 # for which the library is built, runs the newly built program that is
772 # the second dependency of the makefile target in which
773 # $(host-built-program-cmd) is used.
774 host-built-program-cmd = $(run-via-rtld-prefix) $(built-program-file)
780 # $(test-via-rtld-prefix) is a command that, when prepended to the name
781 # of a test program built with the newly built library, produces a command
782 # that, executed on the host for which the library is built, runs that
783 # program. For tests listed in tests-static or xtests-static as well
784 # as when test programs are hardcoded to the newly built libraries, it
787 # $(test-program-prefix) is a command that, when prepended to the name
788 # of a test program built with the newly built library, produces a command
789 # that, executed on the build system on which "make" is run, runs that
790 # test program. $(test-program-prefix-before-env) and
791 # $(test-program-prefix-after-env) are similar, before and after a
792 # list of environment variables.
794 # $(test-program-cmd) is a command that, executed on the build system
795 # on which "make" is run, runs the newly built test program that is the
796 # second dependency of the makefile target in which
797 # $(test-program-cmd) is used. $(test-program-cmd-before-env) and
798 # $(test-program-cmd-after-env) are similar, before and after a list
799 # of environment variables.
801 # $(host-test-program-cmd) is a command that, executed on the host
802 # for which the library is built, runs the newly built test program that
803 # is the second dependency of the makefile target in which
804 # $(host-test-program-cmd) is used.
806 ifeq (yes,$(build-hardcoded-path-in-tests))
807 test-via-rtld-prefix =
808 test-program-prefix-before-env = $(test-wrapper-env)
809 test-program-prefix-after-env =
810 test-program-prefix = $(test-program-prefix-before-env) $(run-program-env) \
811 $(test-program-prefix-after-env)
812 test-program-cmd-before-env = $(test-wrapper-env)
813 test-program-cmd-after-env = $(built-program-file)
814 test-program-cmd = $(test-program-cmd-before-env) $(run-program-env) \
815 $(test-program-cmd-after-env)
816 host-test-program-cmd = $(built-program-file)
818 test-via-rtld-prefix = $(run-via-rtld-prefix)
819 test-program-prefix-before-env = $(run-program-prefix-before-env)
820 test-program-prefix-after-env = $(run-program-prefix-after-env)
821 test-program-prefix = $(run-program-prefix)
822 test-program-cmd-before-env = $(built-program-cmd-before-env)
823 test-program-cmd-after-env = $(built-program-cmd-after-env)
824 test-program-cmd = $(built-program-cmd)
825 host-test-program-cmd = $(host-built-program-cmd)
828 # Extra flags to pass to GCC.
829 ifeq ($(all-warnings),yes)
830 +gccwarn := -Wall -Wwrite-strings -Wcast-qual -Wbad-function-cast -Wmissing-noreturn -Wmissing-prototypes -Wmissing-declarations -Wcomment -Wcomments -Wtrigraphs -Wsign-compare -Wfloat-equal -Wmultichar
832 +gccwarn := -Wall -Wwrite-strings
835 ifeq ($(enable-werror),yes)
838 +gccwarn-c = -Wstrict-prototypes -Wold-style-definition
840 # We do not depend on the address of constants in different files to be
841 # actually different, so allow the compiler to merge them all.
842 +merge-constants = -fmerge-all-constants
844 # We have to assume that glibc functions are called in any rounding
845 # mode and also change the rounding mode in a few functions. So,
846 # disable any optimization that assume default rounding mode.
847 +math-flags = -frounding-math
849 # Logically only "libnldbl", "nonlib" and "testsuite" should be using
850 # -fno-math-errno. However due to GCC bug #88576, only "libm" can use
852 +extra-math-flags = $(if $(filter libm,$(in-module)),-fno-math-errno,-fmath-errno)
854 # We might want to compile with some stack-protection flag.
855 ifneq ($(stack-protector),)
856 +stack-protector=$(stack-protector)
859 # This is the program that generates makefile dependencies from C source files.
860 # The -MP flag tells GCC >= 3.2 (which we now require) to produce dummy
861 # targets for headers so that removed headers don't break the build.
863 +mkdep = $(CC) -M -MP
866 # The program that makes Emacs-style TAGS files.
869 # The `xgettext' program for producing .pot files from sources.
874 # The `m4' macro processor; this is used by sysdeps/sparc/Makefile (and
875 # perhaps others) to preprocess assembly code in some cases.
878 # To force installation of files even if they are older than the
879 # installed files. This variable is included in the dependency list
880 # of all installation targets.
881 ifeq ($(force-install),yes)
882 +force = force-install
888 #### End of configuration variables.
891 # This tells some versions of GNU make before 3.63 not to export all variables.
894 # We want to echo the commands we're running without
895 # umpteen zillion filenames along with it (we use `...' instead)
896 # but we don't want this echoing done when the user has said
897 # he doesn't want to see commands echoed by using -s.
898 ifneq "$(findstring s,$(MAKEFLAGS))" "" # if -s
899 +cmdecho := echo >/dev/null
904 # These are the flags given to the compiler to tell
905 # it what sort of optimization and/or debugging output to do.
907 # If `CFLAGS' was defined, use that.
909 +cflags := $(filter-out -I%,$(CFLAGS))
913 # If none of the above worked, default to "-g -O".
914 ifeq "$(strip $(+cflags))" ""
915 +cflags := $(default_cflags)
916 endif # $(+cflags) == ""
918 +cflags += $(cflags-cpu) $(+gccwarn) $(+merge-constants) $(+math-flags) \
922 # Each sysdeps directory can contain header files that both will be
923 # used to compile and will be installed. Each can also contain an
924 # include/ subdirectory, whose header files will be used to compile
925 # but will not be installed, and will take precedence over the
926 # installed files. This mirrors the top-level include/ subdirectory.
927 +sysdep-includes := $(foreach dir,$(+sysdep_dirs),\
928 $(addprefix -I,$(wildcard $(dir)/include) $(dir)))
930 # These are flags given to the C compiler to tell it to look for
931 # include files (including ones given in angle brackets) in the parent
932 # library source directory, in the include directory, and in the
934 +includes = -I$(..)include $(if $(subdir),$(objpfx:%/=-I%)) \
935 $(+sysdep-includes) $(includes) \
936 $(patsubst %/,-I%,$(..)) $(libio-include) -I. $(sysincludes)
938 # Since libio has several internal header files, we use a -I instead
939 # of many little headers in the include directory.
940 libio-include = -I$(..)libio
942 # List of non-library modules that we build.
943 built-modules = iconvprogs iconvdata ldconfig lddlibc4 libmemusage \
944 libSegFault libpcprofile librpcsvc locale-programs \
945 memusagestat nonlib nscd extramodules libnldbl libsupport \
948 in-module = $(subst -,_,$(firstword $(libof-$(basename $(@F))) \
953 # Build ld.so, libc.so and libpthread.so with -ftls-model=initial-exec
954 tls-model = $(if $(filter libpthread rtld \
955 libc,$(in-module)),-ftls-model=initial-exec,)
957 module-cppflags-real = -include $(common-objpfx)libc-modules.h \
958 -DMODULE_NAME=$(in-module)
960 # We don't need libc-modules.h and the MODULE_NAME definition for .v.i
961 # files. These targets don't (and will likely never need to) use the IS_IN
962 # facility. In fact, shlib-versions should not use it because that will
963 # create a circular dependency as libc-modules.h is generated from
965 module-cppflags = $(if $(filter %.v.i,$(@F)),,$(module-cppflags-real))
967 # These are the variables that the implicit compilation rules use.
968 # Note that we can't use -std=* in CPPFLAGS, because it overrides
969 # the implicit -lang-asm and breaks cpp behavior for .S files--notably
970 # it causes cpp to stop predefining __ASSEMBLER__.
971 CPPFLAGS = $(config-extra-cppflags) $(CPPUNDEFS) $(CPPFLAGS-config) \
972 $($(subdir)-CPPFLAGS) \
973 $(+includes) $(defines) $(module-cppflags) \
974 -include $(..)include/libc-symbols.h $(sysdep-CPPFLAGS) \
975 $(CPPFLAGS-$(suffix $@)) \
976 $(foreach lib,$(libof-$(basename $(@F))) \
977 $(libof-$(<F)) $(libof-$(@F)),$(CPPFLAGS-$(lib))) \
978 $(CPPFLAGS-$(<F)) $(CPPFLAGS-$(@F)) $(CPPFLAGS-$(basename $(@F)))
980 ifneq (no,$(have-tunables))
981 CPPFLAGS += -DTOP_NAMESPACE=glibc
984 override CFLAGS = -std=gnu11 -fgnu89-inline $(config-extra-cflags) \
985 $(filter-out %frame-pointer,$(+cflags)) $(+gccwarn-c) \
986 $(+extra-math-flags) \
987 $(sysdep-CFLAGS) $(CFLAGS-$(suffix $@)) $(CFLAGS-$(<F)) \
988 $(CFLAGS-$(@F)) $(tls-model) \
989 $(foreach lib,$(libof-$(basename $(@F))) \
990 $(libof-$(<F)) $(libof-$(@F)),$(CFLAGS-$(lib)))
991 # Use our copies of cstdlib and cmath.
992 override CXXFLAGS = -I$(common-objpfx) $(c++-sysincludes) \
993 $(filter-out %frame-pointer,$(+cflags)) $(sysdep-CFLAGS) \
994 $(CFLAGS-$(suffix $@)) $(CFLAGS-$(<F)) $(CFLAGS-$(@F))
996 # If everything is compiled with -fPIC (implicitly) we must tell this by
997 # defining the PIC symbol.
998 ifeq (yes,$(build-pic-default))
1002 # Enable object files for different versions of the library.
1003 # Various things use $(object-suffixes) to know what all to make.
1004 # The compilation rules use $(CPPFLAGS-${SUFFIX}) and $(CFLAGS-${SUFFIX})
1005 # to pass different flags for each flavor.
1006 libtypes = $(foreach o,$(object-suffixes-for-libc),$(libtype$o))
1007 # .op may be added to all-object-suffixes below.
1008 all-object-suffixes := .o .os .oS
1010 CPPFLAGS-.o = $(pic-default)
1011 # libc.a must be compiled with -fPIE/-fpie for static PIE.
1012 CFLAGS-.o = $(filter %frame-pointer,$(+cflags)) $(pie-default)
1014 object-suffixes += .o
1015 ifeq (yes,$(build-shared))
1016 # Under --enable-shared, we will build a shared library of PIC objects.
1017 # The PIC object files are named foo.os.
1018 object-suffixes += .os
1019 CPPFLAGS-.os = -DPIC -DSHARED
1020 CFLAGS-.os = $(filter %frame-pointer,$(+cflags)) $(pic-ccflag)
1021 libtype.os := lib%_pic.a
1022 # This can be changed by a sysdep makefile
1024 # This one should always stay like this unless there is a very good reason.
1027 # This can be changed by a sysdep makefile
1029 # This one should always stay like this unless there is a very good reason.
1031 ifeq (yes,$(build-profile))
1032 # Under --enable-profile, we will build a static library of profiled objects.
1033 # The profiled object files are named foo.op.
1034 all-object-suffixes += .op
1035 object-suffixes += .op
1036 CPPFLAGS-.op = -DPROF $(pic-default)
1037 # libc_p.a must be compiled with -fPIE/-fpie for static PIE.
1038 CFLAGS-.op = -pg $(pie-default)
1039 libtype.op = lib%_p.a
1042 # Convenience variable for when we want to treat shared-library cases
1043 # differently from the rest.
1044 object-suffixes-noshared := $(filter-out .os,$(object-suffixes))
1046 object-suffixes-for-libc := $(object-suffixes)
1048 ifeq (yes,$(build-shared))
1049 # Build special library that contains the static-only routines for libc.
1050 object-suffixes-for-libc += .oS
1052 # Must build the routines as PIC, though, because they can end up in (users')
1053 # shared objects. We don't want to use CFLAGS-os because users may, for
1054 # example, make that processor-specific.
1055 CFLAGS-.oS = $(CFLAGS-.o) $(PIC-ccflag) $(extra-nonshared-cflags)
1056 CPPFLAGS-.oS = $(CPPFLAGS-.o) -DPIC -DLIBC_NONSHARED=1
1057 libtype.oS = lib%_nonshared.a
1060 # The assembler can generate debug information too.
1062 ASFLAGS := $(filter -g% -fdebug-prefix-map=%,$(CFLAGS))
1064 override ASFLAGS += -Werror=undef $(ASFLAGS-config) $(asflags-cpu)
1070 move-if-change = $(SHELL) $(..)scripts/move-if-change
1072 -include $(common-objpfx)sysd-sorted
1073 subdirs = $(sorted-subdirs)
1074 subdir-srcdirs = $(foreach dir,$(subdirs),\
1075 $(firstword $($(dir)-srcdir) $(..)$(dir)))
1077 # This is a pair of implicit rules to preprocess a file with # comments,
1078 # %ifdef et al, based on config.h settings or other %include'd files.
1079 # We use chained rules instead of a pipeline here so that we can properly
1080 # check the exit status of cpp rather than using its bad output when there
1081 # is a preprocessing error. Another rule should depend on the output file
1082 # `FOO.v', and along with that `FOO.v.i' should be given dependencies
1083 # listing both its input files, and any header files that it may reference
1084 # (but no commands).
1085 %.v.i: $(common-objpfx)config.h $(..)Makeconfig
1086 sed '/^[ ]*%/!s/#.*$$//;/^[ ]*$$/d;s/^[ ]*%/#/' \
1087 $(filter-out FORCE %.h $(..)Makeconfig,$^) \
1088 | $(CC) -E -undef $(CPPFLAGS) -x assembler-with-cpp - \
1092 sed '/^[ ]*#/d;/^[ ]*$$/d' $< > $@T
1095 ifeq (yes, $(build-shared))
1097 # To generate a header to support more than one ABI for different
1098 # architecture variants, the CPU/Makefile defines abi-variants to be a
1099 # list of names for those variants (e.g. 32 64), and, for each variant,
1100 # defines abi-$(variant)-condition to be the condition for those options
1101 # to use in a C #if condition. abi-includes may be defined to a list of
1102 # headers to include in the generated header, if the default does not
1103 # suffice. default-abi is defined to be the ABI for the current glibc
1107 abi-includes := bits/wordsize.h
1110 # Process the shlib-versions file, which tells us what shared library
1111 # version numbers to use when we install shared objects on this system.
1112 # We need to wait until $(subdirs) is complete.
1113 ifeq ($(sysd-sorted-done),t)
1114 -include $(common-objpfx)soversions.mk
1115 ifndef avoid-generated
1116 $(common-objpfx)shlib-versions.v.i: \
1117 $(wildcard $(+sysdep_dirs:=/shlib-versions) \
1118 $(subdir-srcdirs:=/shlib-versions)) \
1121 $(common-objpfx)soversions.i: $(..)scripts/soversions.awk \
1122 $(common-objpfx)shlib-versions.v
1125 $(common-objpfx)soversions.mk: $(common-objpfx)soversions.i $(..)Makeconfig
1126 (while read which lib number setname; do \
1127 eval seen_$$which=1; \
1128 test x"$$which" = xDEFAULT || continue; \
1130 [0-9]*) echo "$$lib.so-version=.$$number"; \
1131 echo "all-sonames+=$$lib=$$lib.so\$$($$lib.so-version)";;\
1132 *) echo "$$lib.so-version=$$number"; \
1133 echo "all-sonames+=$$lib=\$$($$lib.so-version)";;\
1136 echo soversions.mk-done = t;) < $< > $@T; exit 0
1141 postclean-generated += soversions.mk soversions.i \
1142 shlib-versions.v shlib-versions.v.i
1144 before-compile += $(common-objpfx)libc-modules.h
1145 common-generated += libc-modules.h libc-modules.stmp
1146 ifeq ($(soversions.mk-done),t)
1147 # Generate a header with macro definitions for use with the IS_IN macro.
1148 # These are the possible values for the MODULE_NAME macro defined when building
1149 # sources, to identify which module the translation unit is going to be built
1151 $(common-objpfx)libc-modules.h: $(common-objpfx)libc-modules.stmp; @:
1152 $(common-objpfx)libc-modules.stmp: $(..)scripts/gen-libc-modules.awk \
1153 $(common-objpfx)soversions.i
1154 $(AWK) -v buildlist="$(subst -,_,$(built-modules))" -f $^ > ${@:stmp=T}
1155 $(move-if-change) ${@:stmp=T} ${@:stmp=h}
1160 # Build the tunables list header early since it could be used by any module in
1162 ifneq (no,$(have-tunables))
1163 before-compile += $(common-objpfx)dl-tunable-list.h
1164 common-generated += dl-tunable-list.h dl-tunable-list.stmp
1166 $(common-objpfx)dl-tunable-list.h: $(common-objpfx)dl-tunable-list.stmp; @:
1167 $(common-objpfx)dl-tunable-list.stmp: \
1168 $(..)scripts/gen-tunables.awk \
1169 $(..)elf/dl-tunables.list \
1170 $(wildcard $(subdirs:%=$(..)%/dl-tunables.list)) \
1171 $(wildcard $(sysdirs:%=%/dl-tunables.list))
1172 $(AWK) -f $^ > ${@:stmp=T}
1173 $(move-if-change) ${@:stmp=T} ${@:stmp=h}
1177 # Generate version maps, but wait until sysdep-subdirs is known
1178 ifeq ($(sysd-sorted-done),t)
1179 ifeq ($(build-shared),yes)
1180 -include $(common-objpfx)sysd-versions
1181 -include $(common-objpfx)Versions.mk
1182 $(addprefix $(common-objpfx),$(version-maps)): $(common-objpfx)sysd-versions
1183 common-generated += $(version-maps)
1184 postclean-generated += sysd-versions Versions.all abi-versions.h \
1185 Versions.def Versions.v.i Versions.v Versions.mk
1187 ifndef avoid-generated
1188 ifneq ($(sysd-versions-subdirs),$(sorted-subdirs) $(config-sysdirs))
1189 sysd-versions-force = FORCE
1193 $(common-objpfx)Versions.def: $(..)scripts/versionlist.awk \
1194 $(common-objpfx)Versions.v
1195 LC_ALL=C $(AWK) -f $^ > $@T
1198 $(common-objpfx)Versions.all: $(..)scripts/firstversions.awk \
1199 $(common-objpfx)soversions.i \
1200 $(common-objpfx)Versions.def
1201 { while read which lib version setname; do \
1202 test x"$$which" = xDEFAULT || continue; \
1203 test -z "$$setname" || echo "$$lib : $$setname"; \
1204 done < $(word 2,$^); \
1206 } | LC_ALL=C $(AWK) -f $< > $@T
1208 $(common-objpfx)Versions.mk: $(..)scripts/haveversions.awk \
1209 $(common-objpfx)Versions.all
1212 # See %.v/%.v.i implicit rules in Makeconfig.
1213 $(common-objpfx)Versions.v.i: $(wildcard $(subdirs:%=$(..)%/Versions)) \
1214 $(wildcard $(sysdirs:%=%/Versions)) \
1215 $(sysd-versions-force)
1216 $(common-objpfx)sysd-versions: $(common-objpfx)versions.stmp
1217 $(common-objpfx)versions.stmp: $(common-objpfx)Versions.all \
1218 $(common-objpfx)Versions.v \
1219 $(..)scripts/versions.awk
1220 ( echo 'sysd-versions-subdirs = $(subdirs) $(config-sysdirs)' ; \
1222 | LC_ALL=C $(AWK) -v buildroot=$(common-objpfx) -v defsfile=$< \
1223 -v move_if_change='$(move-if-change)' \
1225 ) > $(common-objpfx)sysd-versionsT
1226 mv -f $(common-objpfx)sysd-versionsT $(common-objpfx)sysd-versions
1228 endif # avoid-generated
1229 endif # $(build-shared) = yes
1230 endif # sysd-sorted-done
1232 # The name under which the run-time dynamic linker is installed.
1233 # We are currently going for the convention that `/lib/ld.so.1'
1234 # names the SVR4/ELF ABI-compliant dynamic linker.
1235 ifndef rtld-installed-name
1237 rtld-installed-name = $(ld.so-version)
1239 rtld-installed-name = ld.so.1
1243 ifndef rtld-version-installed-name
1244 rtld-version-installed-name = ld-$(version).so
1247 endif # build-shared
1250 ifeq ($(build-shared),yes)
1251 libdl = $(common-objpfx)dlfcn/libdl.so$(libdl.so-version)
1253 libdl = $(common-objpfx)dlfcn/libdl.a
1256 ifeq ($(build-shared),yes)
1257 libm = $(common-objpfx)math/libm.so$(libm.so-version)
1258 libmvec = $(common-objpfx)mathvec/libmvec.so$(libmvec.so-version)
1260 libm = $(common-objpfx)math/libm.a
1261 libmvec = $(common-objpfx)mathvec/libmvec.a
1264 ifeq ($(build-shared),yes)
1265 libsupport = $(common-objpfx)support/libsupport_nonshared.a
1267 libsupport = $(common-objpfx)support/libsupport.a
1270 # This is a partial list of subdirectories containing the library source.
1271 # The order is more or less arbitrary. The sorting step will take care of the
1272 # dependencies and generate sorted-subdirs dynamically.
1273 all-subdirs = csu assert ctype locale intl catgets math setjmp signal \
1274 stdlib stdio-common libio malloc string wcsmbs time dirent \
1275 grp pwd posix io termios resource misc socket sysvipc gmon \
1276 gnulib iconv iconvdata wctype manual shadow gshadow po argp \
1277 localedata timezone rt conform debug mathvec support \
1280 ifeq ($(build-crypt),yes)
1281 all-subdirs += crypt
1285 ifndef avoid-generated
1286 # sysd-sorted itself will contain rules making the sysd-sorted target
1287 # depend on Depend files. But if you just added a Depend file to an
1288 # existing directory not in all-subdirs, then sysd-sorted needs to
1289 # be regenerated, so it depends on existing $(sorted-subdirs:=/Depend) files.
1290 all-Depend-files := $(wildcard $(sort \
1291 $(foreach dir,$(all-subdirs),\
1292 $(firstword $($(dir)-srcdir) \
1293 $(..)$(dir))/Depend) \
1294 $(sorted-subdirs:=/Depend)))
1295 $(common-objpfx)sysd-sorted: $(..)scripts/gen-sorted.awk \
1296 $(common-objpfx)config.make $(..)Makeconfig \
1297 $(wildcard $(sysdirs:=/Subdirs)) \
1300 -v subdirs='$(all-subdirs)' \
1302 $(filter %/Subdirs %/Depend,$^) > $@-tmp
1304 $(all-Depend-files): ;
1307 # This gives partial TARGET:SOURCE pattern pairs to have rules
1308 # emitted into sysd-rules. A sysdeps Makeconfig fragment can
1309 # add its own special object file prefix to this list with e.g. foo-%:%
1310 # to have foo-*.? compiled from *.? using $(foo-CPPFLAGS).
1311 sysd-rules-patterns := %:% rtld-%:rtld-% rtld-%:% m_%:s_%
1313 # Let sysdeps/ subdirs contain a Makeconfig fragment for us to include here.
1314 sysdep-makeconfigs := $(wildcard $(+sysdep_dirs:=/Makeconfig))
1315 ifneq (,$(sysdep-makeconfigs))
1316 include $(sysdep-makeconfigs)
1319 # Compute just the target patterns. Makeconfig has set sysd-rules-patterns.
1320 sysd-rules-targets := $(sort $(foreach p,$(sysd-rules-patterns),\
1321 $(firstword $(subst :, ,$p))))
1323 # A sysdeps Makeconfig fragment may set libc-reentrant to yes.
1324 ifeq (yes,$(libc-reentrant))
1325 defines += -D_LIBC_REENTRANT
1327 libio-mtsafe = -D_IO_MTSAFE_IO
1330 # The name to give to a test in test results summaries.
1331 test-name = $(strip $(patsubst %.out, %, $(patsubst $(common-objpfx)%, %, $@)))
1333 # Likewise, in XFAIL variable names.
1334 test-xfail-name = $(strip $(patsubst %.out, %, $(patsubst $(objpfx)%, %, $@)))
1336 # Command to output a test status line (such as PASS: test-name). If
1337 # test-xfail-$(test-xfail-name) has a nonempty value, the status will be
1338 # XPASS or XFAIL rather than PASS or FAIL.
1339 evaluate-test = $(..)scripts/evaluate-test.sh $(test-name) $$? \
1340 $(if $(test-xfail-$(test-xfail-name)),true,false) \
1341 $(if $(stop-on-test-failure),true,false) \
1342 > $(common-objpfx)$(test-name).test-result
1344 endif # Makeconfig not yet included