Fix testsuite timeout handling
[glibc.git] / Makeconfig
blobbe45c3a0b9a8a9b9382621c2ba3d41c80d2e0683
1 # Copyright (C) 1991-2016 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.
21 ifneq (,)
22 This makefile requires GNU Make.
23 endif
25 all: # Make this the default goal
27 ifneq "$(origin +included-Makeconfig)" "file"
29 +included-Makeconfig := yes
31 ifdef subdir
32 .. := ../
33 endif
35 # $(common-objdir) is the place to put objects and
36 # such that are not specific to a single subdir.
37 ifdef objdir
38 objpfx := $(patsubst %//,%/,$(objdir)/$(subdir)/)
39 common-objpfx = $(objdir)/
40 common-objdir = $(objdir)
41 else
42 objdir must be defined by the build-directory Makefile.
43 endif
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 # Add-ons that contribute sysdeps trees get added to the include list
63 # after sysdeps/generic.  This makes #include <sysdeps/...> work right
64 # to find specific add-on files without assuming the add-on directory name.
65 # It also means that headers can go into an add-on's base directory
66 # instead of the add-on needing a sysdeps/generic of its own.
67 sysdeps-srcdirs := $(foreach add-on,$(sysdeps-add-ons),\
68                              $(firstword $(filter /%,$(add-on)) \
69                                          $(..)$(add-on)))
70 +sysdep_dirs = $(sysdirs) $(sysdeps-srcdirs)
71 ifdef objdir
72 +sysdep_dirs := $(objdir) $(+sysdep_dirs)
73 endif
75 # Run config.status to update config.make and config.h.  We don't show the
76 # dependence of config.h to Make, because it is only touched when it
77 # changes and so config.status would be run every time; the dependence of
78 # config.make should suffice to force regeneration and re-exec, and the new
79 # image will notice if config.h changed.
80 $(common-objpfx)config.make: $(common-objpfx)config.status \
81                              $(..)config.make.in $(..)config.h.in
82         cd $(<D); $(SHELL) $(<F)
84 # Find all the add-on and sysdeps configure fragments, to make sure we
85 # re-run configure when any of them changes.
86 $(common-objpfx)config.status: $(..)version.h $(..)configure \
87                                $(foreach dir,$(sysdirs),\
88                                          $(wildcard $(dir)/Implies) \
89                                          $(patsubst %.ac,%,\
90                                                     $(firstword $(wildcard \
91  $(addprefix $(dir)/,configure configure.ac))))) \
92                                $(patsubst %.ac,%,\
93  $(wildcard $(..)sysdeps/*/preconfigure $(..)sysdeps/*/preconfigure.ac)) \
94                                $(patsubst %.ac,%,\
95                                           $(foreach add-on,$(add-ons),\
96                                                     $(firstword $(wildcard \
97  $(addprefix $(firstword $(filter /%,$(add-on)) $(..)$(add-on))/,\
98              configure configure.ac))) \
99  $(wildcard $(addprefix $(firstword $(filter /%,$(add-on)) $(..)$(add-on))/,\
100                         sysdeps/*/preconfigure sysdeps/*/preconfigure.ac))))
101         @cd $(@D); if test -f $(@F); then exec $(SHELL) $(@F) --recheck; else \
102          echo The GNU C library has not been configured. >&2; \
103          echo Run \`configure\' to configure it before building. >&2; \
104          echo Try \`configure --help\' for more details. >&2; \
105          exit 1; fi
107 # We don't want CPPFLAGS to be exported to the command running configure.
108 unexport CPPFLAGS
110 # Get the user's configuration parameters.
111 ifneq ($(wildcard $(..)configparms),)
112 include $(..)configparms
113 endif
114 ifneq ($(objpfx),)
115 ifneq ($(wildcard $(common-objpfx)configparms),)
116 include $(common-objpfx)configparms
117 endif
118 endif
120 ####
121 ####    These are the configuration variables.  You can define values for
122 ####    the variables below in the file `configparms'.
123 ####    Do NOT edit this file.
124 ####
127 # Common prefix for machine-independent installation directories.
128 ifeq ($(origin prefix),undefined) # ifndef would override explicit empty value.
129 prefix = /usr/local
130 endif
132 # Decide whether we shall build the programs or not.  We always do this
133 # unless the user tells us (in configparms) or we are building for a
134 # standalone target.
135 ifndef build-programs
136 ifneq ($(config-os),none)
137 build-programs=yes
138 else
139 build-programs=no
140 endif
141 endif
143 # Common prefix for machine-dependent installation directories.
144 ifeq ($(origin exec_prefix),undefined)
145 exec_prefix = $(prefix)
146 endif
148 # Where to install the library and object files.
149 ifndef libdir
150 libdir = $(exec_prefix)/lib
151 endif
152 inst_libdir = $(install_root)$(libdir)
154 # Where to install the shared library.
155 ifndef slibdir
156 slibdir = $(exec_prefix)/lib
157 endif
158 inst_slibdir = $(install_root)$(slibdir)
160 # Where to install the dynamic linker.
161 ifndef rtlddir
162 rtlddir = $(slibdir)
163 endif
164 inst_rtlddir = $(install_root)$(rtlddir)
166 # Prefix to put on files installed in $(libdir).  For libraries `libNAME.a',
167 # the prefix is spliced between `lib' and the name, so the linker switch
168 # `-l$(libprefix)NAME' finds the library; for other files the prefix is
169 # just prepended to the whole file name.
170 ifeq ($(origin libprefix),undefined)
171 libprefix =
172 endif
174 # Where to install the header files.
175 ifndef includedir
176 includedir = $(prefix)/include
177 endif
178 inst_includedir = $(install_root)$(includedir)
180 # Where to install machine-independent data files.
181 # These are the timezone database, and the locale database.
182 ifndef datadir
183 datadir = $(prefix)/share
184 endif
185 inst_datadir = $(install_root)$(datadir)
187 # Where to install the timezone data files (which are machine-independent).
188 ifndef zonedir
189 zonedir = $(datadir)/zoneinfo
190 endif
191 inst_zonedir = $(install_root)$(zonedir)
193 # Where to install the compiled binary locale archive and compiled
194 # binary locale files.
195 ifndef complocaledir
196 complocaledir = $(libdir)/locale
197 endif
198 inst_complocaledir = $(install_root)$(complocaledir)
200 # Where to install the message catalog data files (which are
201 # machine-independent).
202 ifndef localedir
203 localedir = $(datadir)/locale
204 endif
205 inst_localedir = $(install_root)$(localedir)
207 # Where to install the locale charmap source files.
208 ifndef i18ndir
209 i18ndir = $(datadir)/i18n
210 endif
211 inst_i18ndir = $(install_root)$(i18ndir)
213 # Where to install the shared object for charset transformation.
214 ifndef gconvdir
215 gconvdir = $(libdir)/gconv
216 endif
217 inst_gconvdir = $(install_root)$(gconvdir)
219 # Where to install programs.
220 ifndef bindir
221 bindir = $(exec_prefix)/bin
222 endif
223 inst_bindir = $(install_root)$(bindir)
225 # Where to install internal programs.
226 ifndef libexecdir
227 libexecdir = $(exec_prefix)/libexec
228 endif
229 inst_libexecdir = $(install_root)$(libexecdir)
231 # Where to install administrative programs.
232 ifndef rootsbindir
233 rootsbindir = $(exec_prefix)/sbin
234 endif
235 inst_rootsbindir = $(install_root)$(rootsbindir)
237 ifndef sbindir
238 sbindir = $(exec_prefix)/sbin
239 endif
240 inst_sbindir = $(install_root)$(sbindir)
242 # Where to install the Info files.
243 ifndef infodir
244 infodir = $(prefix)/info
245 endif
246 inst_infodir = $(install_root)$(infodir)
248 # Where to install audit libraries.
249 ifndef auditdir
250 auditdir = $(libdir)/audit
251 endif
252 inst_auditdir = $(install_root)$(auditdir)
254 # Where to install default configuration files.  These include the local
255 # timezone specification and network data base files.
256 ifndef sysconfdir
257 sysconfdir = $(prefix)/etc
258 endif
259 inst_sysconfdir = $(install_root)$(sysconfdir)
261 # Directory for the database files and Makefile for nss_db.
262 ifndef vardbdir
263 vardbdir = $(localstatedir)/db
264 endif
265 inst_vardbdir = $(install_root)$(vardbdir)
267 # Where to install the "localtime" timezone file; this is the file whose
268 # contents $(localtime) specifies.  If this is a relative pathname, it is
269 # relative to $(zonedir).  It is a good idea to put this somewhere
270 # other than there, so the zoneinfo directory contains only universal data,
271 # localizing the configuration data elsewhere.
272 ifndef localtime-file
273 localtime-file = $(sysconfdir)/localtime
274 endif
276 # What to use for leap second specifications in compiling the default
277 # timezone files.  Set this to `/dev/null' for no leap second handling as
278 # 1003.1 requires, or to `leapseconds' for proper leap second handling.
279 # Both zone flavors are always available as `posix/ZONE' and `right/ZONE'.
280 # This variable determines the default: if it's `/dev/null',
281 # ZONE==posix/ZONE; if it's `leapseconds', ZONE==right/ZONE.
282 ifndef leapseconds
283 leapseconds = /dev/null
284 endif
286 # What timezone's DST rules should be used when a POSIX-style TZ
287 # environment variable doesn't specify any rules.  For 1003.1 compliance
288 # this timezone must use rules that are as U.S. federal law defines DST.
289 # Run `make -C time echo-zonenames' to see a list of available zone names.
290 # This setting can be changed with `zic -p TIMEZONE' at any time.
291 # If you want POSIX.1 compatibility, use `America/New_York'.
292 ifndef posixrules
293 posixrules = America/New_York
294 endif
296 # Where to install the "posixrules" timezone file; this is file
297 # whose contents $(posixrules) specifies.  If this is a relative
298 # pathname, it is relative to $(zonedir).
299 ifndef posixrules-file
300 posixrules-file = posixrules
301 endif
304 # Directory where your system's native header files live.
305 # This is used on Unix systems to generate some GNU libc header files.
306 ifndef sysincludedir
307 sysincludedir = /usr/include
308 endif
311 # Commands to install files.
312 ifndef INSTALL_DATA
313 INSTALL_DATA = $(INSTALL) -m 644
314 endif
315 ifndef INSTALL_SCRIPT
316 INSTALL_SCRIPT = $(INSTALL)
317 endif
318 ifndef INSTALL_PROGRAM
319 INSTALL_PROGRAM = $(INSTALL)
320 endif
321 ifndef INSTALL
322 INSTALL = install
323 endif
326 # The name of the C compiler.
327 # If you've got GCC, and it works, use it.
328 ifeq ($(origin CC),default)
329 CC := gcc
330 endif
332 # The name of the C compiler to use for compilations of programs to run on
333 # the host that is building the library.  If you set CC to a
334 # cross-compiler, you must set this to the normal compiler.
335 ifndef BUILD_CC
336 BUILD_CC = $(CC)
337 endif
339 # Default flags to pass the C compiler.
340 ifndef default_cflags
341 ifeq ($(release),stable)
342 default_cflags := -g -O2
343 else
344 default_cflags := -g -O
345 endif
346 endif
348 # Flags to pass the C compiler when assembling preprocessed assembly code
349 # (`.S' files).
350 ifndef asm-CPPFLAGS
351 asm-CPPFLAGS =
352 endif
354 as-needed := -Wl,--as-needed
355 no-as-needed := -Wl,--no-as-needed
357 # Must be supported by the linker.
358 no-whole-archive = -Wl,--no-whole-archive
359 whole-archive = -Wl,--whole-archive
361 # Installed name of the startup code.
362 # The ELF convention is that the startfile is called crt1.o
363 start-installed-name = crt1.o
364 # On systems that do not need a special startfile for statically linked
365 # binaries, simply set it to the normal name.
366 ifndef static-start-installed-name
367 static-start-installed-name = $(start-installed-name)
368 endif
370 ifeq (yesyes,$(build-shared)$(have-z-combreloc))
371 combreloc-LDFLAGS = -Wl,-z,combreloc
372 LDFLAGS.so += $(combreloc-LDFLAGS)
373 LDFLAGS-rtld += $(combreloc-LDFLAGS)
374 endif
376 relro-LDFLAGS = -Wl,-z,relro
377 LDFLAGS.so += $(relro-LDFLAGS)
378 LDFLAGS-rtld += $(relro-LDFLAGS)
380 ifeq (yes,$(have-hash-style))
381 # For the time being we unconditionally use 'both'.  At some time we
382 # should declare statically linked code as 'out of luck' and compile
383 # with --hash-style=gnu only.
384 hashstyle-LDFLAGS = -Wl,--hash-style=both
385 LDFLAGS.so += $(hashstyle-LDFLAGS)
386 LDFLAGS-rtld += $(hashstyle-LDFLAGS)
387 endif
389 # Command to run after every final link (executable or shared object).
390 # This is invoked with $(call after-link,...), so it should operate on
391 # the file $1.  This can be set to do some sort of post-processing on
392 # binaries, or to perform some sort of static sanity check.
393 ifndef after-link
394 after-link =
395 endif
397 # Additional libraries to link into every test.
398 link-extra-libs-tests = $(libsupport)
400 # Command for linking PIE programs with the C library.
401 ifndef +link-pie
402 +link-pie-before-libc = $(CC) -pie -Wl,-O1 -nostdlib -nostartfiles -o $@ \
403              $(sysdep-LDFLAGS) $(LDFLAGS) $(LDFLAGS-$(@F)) \
404              $(combreloc-LDFLAGS) $(relro-LDFLAGS) $(hashstyle-LDFLAGS) \
405              $(addprefix $(csu-objpfx),S$(start-installed-name)) \
406              $(+preinit) $(+prectorS) \
407              $(filter-out $(addprefix $(csu-objpfx),start.o \
408                                                     S$(start-installed-name))\
409                           $(+preinit) $(link-extra-libs) \
410                           $(common-objpfx)libc% $(+postinit),$^) \
411              $(link-extra-libs)
412 +link-pie-after-libc = $(+postctorS) $(+postinit)
413 define +link-pie
414 $(+link-pie-before-libc) $(rtld-LDFLAGS) $(link-libc) $(+link-pie-after-libc)
415 $(call after-link,$@)
416 endef
417 define +link-pie-tests
418 $(+link-pie-before-libc) $(link-extra-libs-tests) \
419   $(rtld-tests-LDFLAGS) $(link-libc-tests) $(+link-pie-after-libc)
420 $(call after-link,$@)
421 endef
422 define +link-pie-printers-tests
423 $(+link-pie-before-libc) $(built-rtld-LDFLAGS) $(link-libc-printers-tests) \
424                          $(+link-pie-after-libc)
425 $(call after-link,$@)
426 endef
427 endif
428 # Command for statically linking programs with the C library.
429 ifndef +link-static
430 +link-static-before-libc = $(CC) -nostdlib -nostartfiles -static -o $@ \
431               $(sysdep-LDFLAGS) $(LDFLAGS) $(LDFLAGS-$(@F))  \
432               $(addprefix $(csu-objpfx),$(static-start-installed-name)) \
433               $(+preinit) $(+prectorT) \
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)
439 +link-static-after-libc = $(+postctorT) $(+postinit)
440 define +link-static
441 $(+link-static-before-libc) $(link-libc-static) $(+link-static-after-libc)
442 $(call after-link,$@)
443 endef
444 define +link-static-tests
445 $(+link-static-before-libc) $(link-extra-libs-tests) \
446   $(link-libc-static-tests) $(+link-static-after-libc)
447 $(call after-link,$@)
448 endef
449 endif
450 # Commands for linking programs with the C library.
451 ifndef +link
452 ifeq (yes,$(build-shared))
453 ifeq (yes,$(build-pie-default))
454 no-pie-ldflag = -no-pie
455 +link = $(+link-pie)
456 +link-tests = $(+link-pie-tests)
457 +link-printers-tests = $(+link-pie-printers-tests)
458 else  # not build-pie-default
459 +link-before-libc = $(CC) -nostdlib -nostartfiles -o $@ \
460               $(sysdep-LDFLAGS) $(LDFLAGS) $(LDFLAGS-$(@F)) \
461               $(combreloc-LDFLAGS) $(relro-LDFLAGS) $(hashstyle-LDFLAGS) \
462               $(addprefix $(csu-objpfx),$(start-installed-name)) \
463               $(+preinit) $(+prector) \
464               $(filter-out $(addprefix $(csu-objpfx),start.o \
465                                                      $(start-installed-name))\
466                            $(+preinit) $(link-extra-libs) \
467                            $(common-objpfx)libc% $(+postinit),$^) \
468               $(link-extra-libs)
469 +link-after-libc = $(+postctor) $(+postinit)
470 define +link
471 $(+link-before-libc) $(rtld-LDFLAGS) $(link-libc) $(+link-after-libc)
472 $(call after-link,$@)
473 endef
474 define +link-tests
475 $(+link-before-libc) $(link-extra-libs-tests) \
476   $(rtld-tests-LDFLAGS) $(link-libc-tests) $(+link-after-libc)
477 $(call after-link,$@)
478 endef
479 define +link-printers-tests
480 $(+link-before-libc) $(built-rtld-LDFLAGS) $(link-libc-printers-tests) \
481                      $(+link-after-libc)
482 $(call after-link,$@)
483 endef
484 endif  # build-pie-default
485 else  # build-static
486 +link = $(+link-static)
487 +link-tests = $(+link-static-tests)
488 +link-printers-tests = $(+link-static-tests)
489 endif  # build-shared
490 endif  # +link
492 # The pretty printer test programs need to be compiled without optimizations
493 # so they won't confuse gdb.  We could use either the 'GCC optimize' pragma
494 # or the 'optimize' function attribute to achieve this; however, at least on
495 # ARM, gcc always produces different debugging symbols when invoked with
496 # a -O greater than 0 than when invoked with -O0, regardless of anything else
497 # we're using to suppress optimizations.  Therefore, we need to explicitly pass
498 # -O0 to it through CFLAGS.
499 # Additionally, the build system will try to -include $(common-objpfx)/config.h
500 # when compiling the tests, which will throw an error if some special macros
501 # (such as __OPTIMIZE__ and IS_IN_build) aren't defined.  To avoid this, we
502 # tell gcc to define IS_IN_build.
503 CFLAGS-printers-tests := -O0 -ggdb3 -DIS_IN_build
505 ifeq (yes,$(build-shared))
506 # These indicate whether to link using the built ld.so or the installed one.
507 installed-rtld-LDFLAGS = -Wl,-dynamic-linker=$(rtlddir)/$(rtld-installed-name)
508 built-rtld-LDFLAGS = -Wl,-dynamic-linker=$(elf-objpfx)ld.so
510 ifndef rtld-LDFLAGS
511 rtld-LDFLAGS = $(installed-rtld-LDFLAGS)
512 endif
514 ifndef rtld-tests-LDFLAGS
515 ifeq (yes,$(build-hardcoded-path-in-tests))
516 rtld-tests-LDFLAGS = $(built-rtld-LDFLAGS)
517 else
518 rtld-tests-LDFLAGS = $(installed-rtld-LDFLAGS)
519 endif  # build-hardcoded-path-in-tests
520 endif  # rtld-tests-LDFLAGS
522 endif  # build-shared
524 ifndef link-libc
525 ifeq (yes,$(build-shared))
526 # We need the versioned name of libc.so in the deps of $(others) et al
527 # so that the symlink to libc.so is created before anything tries to
528 # run the linked programs.
529 link-libc-rpath = -Wl,-rpath=$(rpath-link)
530 link-libc-rpath-link = -Wl,-rpath-link=$(rpath-link)
532 ifeq (yes,$(build-hardcoded-path-in-tests))
533 link-libc-tests-rpath-link = $(link-libc-rpath)
534 else
535 link-libc-tests-rpath-link = $(link-libc-rpath-link)
536 endif  # build-hardcoded-path-in-tests
538 link-libc-before-gnulib = $(common-objpfx)libc.so$(libc.so-version) \
539                           $(common-objpfx)$(patsubst %,$(libtype.oS),c) \
540                           $(as-needed) $(elf-objpfx)ld.so \
541                           $(no-as-needed)
542 link-libc = $(link-libc-rpath-link) $(link-libc-before-gnulib) $(gnulib)
544 link-libc-tests-after-rpath-link = $(link-libc-before-gnulib) $(gnulib-tests)
545 link-libc-tests = $(link-libc-tests-rpath-link) \
546                   $(link-libc-tests-after-rpath-link)
547 # Pretty printer test programs always require rpath instead of rpath-link.
548 link-libc-printers-tests = $(link-libc-rpath) \
549                            $(link-libc-tests-after-rpath-link)
551 # This is how to find at build-time things that will be installed there.
552 rpath-dirs = math elf dlfcn nss nis rt resolv crypt mathvec support
553 rpath-link = \
554 $(common-objdir):$(subst $(empty) ,:,$(patsubst ../$(subdir),.,$(rpath-dirs:%=$(common-objpfx)%)))
555 else  # build-static
556 link-libc = $(common-objpfx)libc.a $(otherlibs) $(gnulib) $(common-objpfx)libc.a $(gnulib)
557 link-libc-tests = $(common-objpfx)libc.a $(otherlibs) $(gnulib-tests) $(common-objpfx)libc.a $(gnulib-tests)
558 endif  # build-shared
559 endif  # link-libc
561 # Differences in the linkers on the various platforms.
562 LDFLAGS-rpath-ORIGIN = -Wl,-rpath,'$$ORIGIN'
563 LDFLAGS-soname-fname = -Wl,-soname,$(@F)
564 LDFLAGS-rdynamic = -rdynamic
565 LDFLAGS-Bsymbolic = -Bsymbolic
567 # Choose the default search path for the dynamic linker based on
568 # where we will install libraries.
569 ifneq ($(libdir),$(slibdir))
570 default-rpath = $(slibdir):$(libdir)
571 else
572 default-rpath = $(libdir)
573 endif
575 ifndef link-extra-libs
576 link-extra-libs = $(LDLIBS-$(@F))
577 link-extra-libs-static = $(link-extra-libs)
578 endif
580 # The static libraries.
581 link-libc-static = -Wl,--start-group $(common-objpfx)libc.a $(static-gnulib) -Wl,--end-group
582 link-libc-static-tests = -Wl,--start-group $(common-objpfx)libc.a $(static-gnulib-tests) -Wl,--end-group
584 # How to link against libgcc.  Some libgcc functions, such as those
585 # for "long long" arithmetic or software floating point, can always be
586 # built without use of C library headers and do not have any global
587 # state so can safely be linked statically into any executable or
588 # shared library requiring them; these functions are in libgcc.a.
589 # Other functions, relating to exception handling, may require C
590 # library headers to build and it may not be safe to have more than
591 # one copy of them in a process; these functions are only in
592 # libgcc_s.so and libgcc_eh.a.
594 # To avoid circular dependencies when bootstrapping, it is desirable
595 # to avoid use of libgcc_s and libgcc_eh in building glibc.  Where any
596 # glibc functionality (in particular, thread cancellation) requires
597 # exception handling, this is implemented through dlopen of libgcc_s
598 # to avoid unnecessary dependencies on libgcc_s by programs not using
599 # that functionality; executables built with glibc do not use
600 # exception handling other than through thread cancellation.
602 # Undefined references to functions from libgcc_eh or libgcc_s may
603 # arise for code built with -fexceptions.  In the case of statically
604 # linked programs installed by glibc, unwinding will never actually
605 # occur at runtime and the use of elf/static-stubs.c to resolve these
606 # references is safe.  In the case of statically linked test programs
607 # and test programs built with -fexceptions, unwinding may occur in
608 # some cases and it is preferable to link with libgcc_eh or libgcc_s
609 # so that the testing is as similar as possible to how programs will
610 # be built with the installed glibc.
612 # Some architectures have architecture-specific systems for exception
613 # handling that may involve undefined references to
614 # architecture-specific functions.  On those architectures,
615 # gnulib-arch and static-gnulib-arch may be defined in sysdeps
616 # makefiles to use additional libraries for linking executables and
617 # shared libraries built by glibc.
618 ifndef gnulib
619 ifneq ($(have-cc-with-libunwind),yes)
620   libunwind =
621 else
622   libunwind = -lunwind
623 endif
624 libgcc_eh := -Wl,--as-needed -lgcc_s $(libunwind) -Wl,--no-as-needed
625 gnulib-arch =
626 gnulib = -lgcc $(gnulib-arch)
627 gnulib-tests := -lgcc $(libgcc_eh)
628 static-gnulib-arch =
629 # By default, elf/static-stubs.o, instead of -lgcc_eh, is used to
630 # statically link programs.  When --disable-shared is used, we use
631 # -lgcc_eh since elf/static-stubs.o isn't sufficient.
632 ifeq (yes,$(build-shared))
633 static-gnulib = -lgcc $(static-gnulib-arch)
634 else
635 static-gnulib = -lgcc -lgcc_eh $(static-gnulib-arch)
636 endif
637 static-gnulib-tests := -lgcc -lgcc_eh $(libunwind)
638 libc.so-gnulib := -lgcc
639 endif
640 +preinit = $(addprefix $(csu-objpfx),crti.o)
641 +postinit = $(addprefix $(csu-objpfx),crtn.o)
642 +prector = `$(CC) $(sysdep-LDFLAGS) --print-file-name=crtbegin.o`
643 +postctor = `$(CC) $(sysdep-LDFLAGS) --print-file-name=crtend.o`
644 # Variants of the two previous definitions for linking PIE programs.
645 +prectorS = `$(CC) $(sysdep-LDFLAGS) --print-file-name=crtbeginS.o`
646 +postctorS = `$(CC) $(sysdep-LDFLAGS) --print-file-name=crtendS.o`
647 # Variants of the two previous definitions for statically linking programs.
648 +prectorT = `$(CC) $(sysdep-LDFLAGS) --print-file-name=crtbeginT.o`
649 +postctorT = `$(CC) $(sysdep-LDFLAGS) --print-file-name=crtend.o`
650 csu-objpfx = $(common-objpfx)csu/
651 elf-objpfx = $(common-objpfx)elf/
653 # A command that, prepended to the name and arguments of a program,
654 # and run on the build system, causes that program with those
655 # arguments to be run on the host for which the library is built.
656 ifndef test-wrapper
657 test-wrapper =
658 endif
659 # Likewise, but the name of the program is preceded by
660 # <variable>=<value> assignments for environment variables.
661 ifndef test-wrapper-env
662 test-wrapper-env = $(test-wrapper) env
663 endif
664 # Likewise, but the program's environment will be empty except for any
665 # explicit <variable>=<value> assignments preceding the program name.
666 ifndef test-wrapper-env-only
667 test-wrapper-env-only = $(test-wrapper) env -i
668 endif
670 # Whether to run test programs built for the library's host system.
671 ifndef run-built-tests
672 ifeq (yes|,$(cross-compiling)|$(test-wrapper))
673 run-built-tests = no
674 else
675 run-built-tests = yes
676 endif
677 endif
679 # Whether to stop immediately when a test fails.  Nonempty means to
680 # stop, empty means not to stop.
681 ifndef stop-on-test-failure
682 stop-on-test-failure =
683 endif
685 # How to run a program we just linked with our library.
686 # The program binary is assumed to be $(word 2,$^).
687 built-program-file = $(dir $(word 2,$^))$(notdir $(word 2,$^))
688 rtld-prefix = $(elf-objpfx)$(rtld-installed-name)                             \
689               --library-path                                                  \
690               $(rpath-link)$(patsubst %,:%,$(sysdep-library-path))
691 ifeq (yes,$(build-shared))
692 comma = ,
693 sysdep-library-path = \
694 $(subst $(empty) ,:,$(strip $(patsubst -Wl$(comma)-rpath-link=%, %,\
695                                        $(filter -Wl$(comma)-rpath-link=%,\
696                                                 $(sysdep-LDFLAGS)))))
697 # $(run-via-rtld-prefix) is a command that, when prepended to the name
698 # of a program built with the newly built library, produces a command
699 # that, executed on the host for which the library is built, runs that
700 # program.  For tests listed in tests-static or xtests-static, it is
701 # empty.
702 run-via-rtld-prefix =                                                         \
703   $(if $(strip $(filter $(notdir $(built-program-file)),                      \
704                         $(tests-static) $(xtests-static))),, $(rtld-prefix))
705 else
706 run-via-rtld-prefix =
707 endif
708 # $(run-program-env) is the default environment variable settings to
709 # use when running a program built with the newly built library.
710 run-program-env = GCONV_PATH=$(common-objpfx)iconvdata \
711                   LOCPATH=$(common-objpfx)localedata LC_ALL=C
712 # $(run-program-prefix) is a command that, when prepended to the name
713 # of a program built with the newly built library, produces a command
714 # that, executed on the build system on which "make" is run, runs that
715 # program.  $(run-program-prefix-before-env) and
716 # $(run-program-prefix-after-env) are similar, but separate parts
717 # before and after a list of environment variables.
718 run-program-prefix-before-env = $(test-wrapper-env)
719 run-program-prefix-after-env = $(run-via-rtld-prefix)
720 run-program-prefix = $(run-program-prefix-before-env) $(run-program-env) \
721                      $(run-program-prefix-after-env)
722 # $(built-program-cmd) is a command that, executed on the build system
723 # on which "make" is run, runs the newly built program that is the
724 # second dependency of the makefile target in which
725 # $(built-program-cmd) is used.  $(built-program-cmd-before-env) and
726 # $(built-program-cmd-after-env) are similar, before and after a list
727 # of environment variables.
728 built-program-cmd-before-env = $(test-wrapper-env)
729 built-program-cmd-after-env = $(run-via-rtld-prefix) $(built-program-file)
730 built-program-cmd = $(built-program-cmd-before-env) $(run-program-env) \
731                     $(built-program-cmd-after-env)
732 # $(host-built-program-cmd) is a command that, executed on the host
733 # for which the library is built, runs the newly built program that is
734 # the second dependency of the makefile target in which
735 # $(host-built-program-cmd) is used.
736 host-built-program-cmd = $(run-via-rtld-prefix) $(built-program-file)
738 ifndef LD
739 LD := ld -X
740 endif
742 # $(test-via-rtld-prefix) is a command that, when prepended to the name
743 # of a test program built with the newly built library, produces a command
744 # that, executed on the host for which the library is built, runs that
745 # program.  For tests listed in tests-static or xtests-static as well
746 # as when test programs are hardcoded to the newly built libraries, it
747 # is empty.
749 # $(test-program-prefix) is a command that, when prepended to the name
750 # of a test program built with the newly built library, produces a command
751 # that, executed on the build system on which "make" is run, runs that
752 # test program.  $(test-program-prefix-before-env) and
753 # $(test-program-prefix-after-env) are similar, before and after a
754 # list of environment variables.
756 # $(test-program-cmd) is a command that, executed on the build system
757 # on which "make" is run, runs the newly built test program that is the
758 # second dependency of the makefile target in which
759 # $(test-program-cmd) is used.  $(test-program-cmd-before-env) and
760 # $(test-program-cmd-after-env) are similar, before and after a list
761 # of environment variables.
763 # $(host-test-program-cmd) is a command that, executed on the host
764 # for which the library is built, runs the newly built test program that
765 # is the second dependency of the makefile target in which
766 # $(host-test-program-cmd) is used.
768 ifeq (yes,$(build-hardcoded-path-in-tests))
769 test-via-rtld-prefix =
770 test-program-prefix-before-env = $(test-wrapper-env)
771 test-program-prefix-after-env =
772 test-program-prefix = $(test-program-prefix-before-env) $(run-program-env) \
773                       $(test-program-prefix-after-env)
774 test-program-cmd-before-env = $(test-wrapper-env)
775 test-program-cmd-after-env = $(built-program-file)
776 test-program-cmd = $(test-program-cmd-before-env) $(run-program-env) \
777                    $(test-program-cmd-after-env)
778 host-test-program-cmd = $(built-program-file)
779 else
780 test-via-rtld-prefix = $(run-via-rtld-prefix)
781 test-program-prefix-before-env = $(run-program-prefix-before-env)
782 test-program-prefix-after-env = $(run-program-prefix-after-env)
783 test-program-prefix = $(run-program-prefix)
784 test-program-cmd-before-env = $(built-program-cmd-before-env)
785 test-program-cmd-after-env = $(built-program-cmd-after-env)
786 test-program-cmd = $(built-program-cmd)
787 host-test-program-cmd = $(host-built-program-cmd)
788 endif
790 # Extra flags to pass to GCC.
791 ifeq ($(all-warnings),yes)
792 +gccwarn := -Wall -Wwrite-strings -Wcast-qual -Wbad-function-cast -Wmissing-noreturn -Wmissing-prototypes -Wmissing-declarations -Wcomment -Wcomments -Wtrigraphs -Wsign-compare -Wfloat-equal -Wmultichar
793 else
794 +gccwarn := -Wall -Wwrite-strings
795 endif
796 +gccwarn += -Wundef
797 ifeq ($(enable-werror),yes)
798 +gccwarn += -Werror
799 endif
800 +gccwarn-c = -Wstrict-prototypes -Wold-style-definition
802 # We do not depend on the address of constants in different files to be
803 # actually different, so allow the compiler to merge them all.
804 +merge-constants = -fmerge-all-constants
806 # We have to assume that glibc functions are called in any rounding
807 # mode and also change the rounding mode in a few functions. So,
808 # disable any optimization that assume default rounding mode.
809 +math-flags = -frounding-math
811 # This is the program that generates makefile dependencies from C source files.
812 # The -MP flag tells GCC >= 3.2 (which we now require) to produce dummy
813 # targets for headers so that removed headers don't break the build.
814 ifndef +mkdep
815 +mkdep = $(CC) -M -MP
816 endif
818 # The program that makes Emacs-style TAGS files.
819 ETAGS   := etags
821 # The `xgettext' program for producing .pot files from sources.
822 ifndef XGETTEXT
823 XGETTEXT = xgettext
824 endif
826 # The `m4' macro processor; this is used by sysdeps/sparc/Makefile (and
827 # perhaps others) to preprocess assembly code in some cases.
828 M4 = m4
830 # To force installation of files even if they are older than the
831 # installed files.  This variable is included in the dependency list
832 # of all installation targets.
833 ifeq ($(force-install),yes)
834 +force = force-install
835 else
836 +force =
837 endif
839 ####
840 #### End of configuration variables.
841 ####
843 # This tells some versions of GNU make before 3.63 not to export all variables.
844 .NOEXPORT:
846 # We want to echo the commands we're running without
847 # umpteen zillion filenames along with it (we use `...' instead)
848 # but we don't want this echoing done when the user has said
849 # he doesn't want to see commands echoed by using -s.
850 ifneq   "$(findstring s,$(MAKEFLAGS))" ""       # if -s
851 +cmdecho        := echo >/dev/null
852 else                                            # not -s
853 +cmdecho        := echo
854 endif                                           # -s
856 # These are the flags given to the compiler to tell
857 # it what sort of optimization and/or debugging output to do.
858 ifndef  +cflags
859 # If `CFLAGS' was defined, use that.
860 ifdef           CFLAGS
861 +cflags := $(filter-out -I%,$(CFLAGS))
862 endif           # CFLAGS
863 endif   # +cflags
865 # If none of the above worked, default to "-g -O".
866 ifeq    "$(strip $(+cflags))" ""
867 +cflags := $(default_cflags)
868 endif   # $(+cflags) == ""
870 +cflags += $(cflags-cpu) $(+gccwarn) $(+merge-constants) $(+math-flags)
871 +gcc-nowarn := -w
873 # Don't duplicate options if we inherited variables from the parent.
874 +cflags := $(sort $(+cflags))
876 # Each sysdeps directory can contain header files that both will be
877 # used to compile and will be installed.  Each can also contain an
878 # include/ subdirectory, whose header files will be used to compile
879 # but will not be installed, and will take precedence over the
880 # installed files.  This mirrors the top-level include/ subdirectory.
881 +sysdep-includes := $(foreach dir,$(+sysdep_dirs),\
882                               $(addprefix -I,$(wildcard $(dir)/include) $(dir)))
884 # These are flags given to the C compiler to tell it to look for
885 # include files (including ones given in angle brackets) in the parent
886 # library source directory, in the include directory, and in the
887 # current directory.
888 +includes = -I$(..)include $(if $(subdir),$(objpfx:%/=-I%)) \
889             $(+sysdep-includes) $(includes) \
890             $(patsubst %/,-I%,$(..)) $(libio-include) -I. $(sysincludes)
892 # Since libio has several internal header files, we use a -I instead
893 # of many little headers in the include directory.
894 libio-include = -I$(..)libio
896 # List of non-library modules that we build.
897 built-modules = iconvprogs iconvdata ldconfig lddlibc4 libmemusage \
898                 libSegFault libpcprofile librpcsvc locale-programs \
899                 memusagestat nonlib nscd extramodules libnldbl libsupport
901 in-module = $(subst -,_,$(firstword $(libof-$(basename $(@F))) \
902                                     $(libof-$(<F)) \
903                                     $(libof-$(@F)) \
904                                     libc))
906 # Build ld.so, libc.so and libpthread.so with -ftls-model=initial-exec
907 tls-model = $(if $(filter libpthread rtld \
908                           libc,$(in-module)),-ftls-model=initial-exec,)
910 module-cppflags-real = -include $(common-objpfx)libc-modules.h \
911                        -DMODULE_NAME=$(in-module)
913 # We don't need libc-modules.h and the MODULE_NAME definition for .v.i
914 # files.  These targets don't (and will likely never need to) use the IS_IN
915 # facility.  In fact, shlib-versions should not use it because that will
916 # create a circular dependency as libc-modules.h is generated from
917 # shlib-versions.
918 module-cppflags = $(if $(filter %.v.i,$(@F)),,$(module-cppflags-real))
920 # These are the variables that the implicit compilation rules use.
921 # Note that we can't use -std=* in CPPFLAGS, because it overrides
922 # the implicit -lang-asm and breaks cpp behavior for .S files--notably
923 # it causes cpp to stop predefining __ASSEMBLER__.
924 CPPFLAGS = $(config-extra-cppflags) $(CPPUNDEFS) $(CPPFLAGS-config) \
925            $($(subdir)-CPPFLAGS) \
926            $(+includes) $(defines) $(module-cppflags) \
927            -include $(..)include/libc-symbols.h $(sysdep-CPPFLAGS) \
928            $(CPPFLAGS-$(suffix $@)) \
929            $(foreach lib,$(libof-$(basename $(@F))) \
930                          $(libof-$(<F)) $(libof-$(@F)),$(CPPFLAGS-$(lib))) \
931            $(CPPFLAGS-$(<F)) $(CPPFLAGS-$(@F)) $(CPPFLAGS-$(basename $(@F)))
932 override CFLAGS = -std=gnu11 -fgnu89-inline $(config-extra-cflags) \
933                   $(filter-out %frame-pointer,$(+cflags)) $(+gccwarn-c) \
934                   $(sysdep-CFLAGS) $(CFLAGS-$(suffix $@)) $(CFLAGS-$(<F)) \
935                   $(CFLAGS-$(@F)) $(tls-model) \
936                   $(foreach lib,$(libof-$(basename $(@F))) \
937                                 $(libof-$(<F)) $(libof-$(@F)),$(CFLAGS-$(lib)))
938 # Use our copies of cstdlib and cmath.
939 override CXXFLAGS = -I$(common-objpfx) $(c++-sysincludes) \
940                     $(filter-out %frame-pointer,$(+cflags)) $(sysdep-CFLAGS) \
941                     $(CFLAGS-$(suffix $@)) $(CFLAGS-$(<F)) $(CFLAGS-$(@F))
943 # If everything is compiled with -fPIC (implicitly) we must tell this by
944 # defining the PIC symbol.
945 ifeq (yes,$(build-pic-default))
946 pic-default = -DPIC
947 endif
949 # Enable object files for different versions of the library.
950 # Various things use $(object-suffixes) to know what all to make.
951 # The compilation rules use $(CPPFLAGS-${SUFFIX}) and $(CFLAGS-${SUFFIX})
952 # to pass different flags for each flavor.
953 libtypes = $(foreach o,$(object-suffixes-for-libc),$(libtype$o))
954 # .op may be added to all-object-suffixes below.
955 all-object-suffixes := .o .os .oS
956 object-suffixes :=
957 CPPFLAGS-.o = $(pic-default)
958 CFLAGS-.o = $(filter %frame-pointer,$(+cflags))
959 libtype.o := lib%.a
960 object-suffixes += .o
961 ifeq (yes,$(build-shared))
962 # Under --enable-shared, we will build a shared library of PIC objects.
963 # The PIC object files are named foo.os.
964 object-suffixes += .os
965 CPPFLAGS-.os = -DPIC -DSHARED
966 CFLAGS-.os = $(filter %frame-pointer,$(+cflags)) $(pic-ccflag)
967 libtype.os := lib%_pic.a
968 # This can be changed by a sysdep makefile
969 pic-ccflag = -fPIC
970 # This one should always stay like this unless there is a very good reason.
971 PIC-ccflag = -fPIC
972 endif
973 # This can be changed by a sysdep makefile
974 pie-ccflag = -fpie
975 # This one should always stay like this unless there is a very good reason.
976 PIE-ccflag = -fPIE
977 ifeq (yes,$(build-profile))
978 # Under --enable-profile, we will build a static library of profiled objects.
979 # The profiled object files are named foo.op.
980 all-object-suffixes += .op
981 object-suffixes += .op
982 CPPFLAGS-.op = -DPROF $(pic-default)
983 CFLAGS-.op = -pg
984 libtype.op = lib%_p.a
985 endif
987 # Convenience variable for when we want to treat shared-library cases
988 # differently from the rest.
989 object-suffixes-noshared := $(filter-out .os,$(object-suffixes))
991 object-suffixes-for-libc := $(object-suffixes)
993 ifeq (yes,$(build-shared))
994 # Build special library that contains the static-only routines for libc.
995 object-suffixes-for-libc += .oS
997 # Must build the routines as PIC, though, because they can end up in (users')
998 # shared objects.  We don't want to use CFLAGS-os because users may, for
999 # example, make that processor-specific.
1000 CFLAGS-.oS = $(CFLAGS-.o) $(PIC-ccflag)
1001 CPPFLAGS-.oS = $(CPPFLAGS-.o) -DPIC -DLIBC_NONSHARED=1
1002 libtype.oS = lib%_nonshared.a
1003 endif
1005 # The assembler can generate debug information too.
1006 ifndef ASFLAGS
1007 ASFLAGS := $(filter -g% -fdebug-prefix-map=%,$(CFLAGS))
1008 endif
1009 ASFLAGS += -Werror=undef $(ASFLAGS-config) $(asflags-cpu)
1011 ifndef BUILD_CC
1012 BUILD_CC = $(CC)
1013 endif
1015 move-if-change = $(SHELL) $(..)scripts/move-if-change
1017 -include $(common-objpfx)sysd-sorted
1018 subdirs = $(sorted-subdirs)
1019 subdir-srcdirs = $(foreach dir,$(subdirs),\
1020                            $(firstword $($(dir)-srcdir) $(..)$(dir)))
1022 # This is a pair of implicit rules to preprocess a file with # comments,
1023 # %ifdef et al, based on config.h settings or other %include'd files.
1024 # We use chained rules instead of a pipeline here so that we can properly
1025 # check the exit status of cpp rather than using its bad output when there
1026 # is a preprocessing error.  Another rule should depend on the output file
1027 # `FOO.v', and along with that `FOO.v.i' should be given dependencies
1028 # listing both its input files, and any header files that it may reference
1029 # (but no commands).
1030 %.v.i: $(common-objpfx)config.h $(..)Makeconfig
1031         sed '/^[        ]*%/!s/#.*$$//;/^[      ]*$$/d;s/^[     ]*%/#/' \
1032             $(filter-out FORCE %.h $(..)Makeconfig,$^) \
1033         | $(CC) -E -undef $(CPPFLAGS) -x assembler-with-cpp - \
1034                    > $@T
1035         mv -f $@T $@
1036 %.v: %.v.i
1037         sed '/^[        ]*#/d;/^[       ]*$$/d' $< > $@T
1038         mv -f $@T $@
1040 ifeq (yes, $(build-shared))
1042 # To generate a header to support more than one ABI for different
1043 # architecture variants, the CPU/Makefile defines abi-variants to be a
1044 # list of names for those variants (e.g. 32 64), and, for each variant,
1045 # defines abi-$(variant)-condition to be the condition for those options
1046 # to use in a C #if condition.  abi-includes may be defined to a list of
1047 # headers to include in the generated header, if the default does not
1048 # suffice.  default-abi is defined to be the ABI for the current glibc
1049 # build.
1051 ifndef abi-includes
1052 abi-includes := bits/wordsize.h
1053 endif
1055 # Process the shlib-versions file, which tells us what shared library
1056 # version numbers to use when we install shared objects on this system.
1057 # We need to wait until $(subdirs) is complete.
1058 ifeq ($(sysd-sorted-done),t)
1059 -include $(common-objpfx)soversions.mk
1060 ifndef avoid-generated
1061 # This lets add-ons give more-specific matches that override defaults
1062 # in the top-level file.
1063 $(common-objpfx)shlib-versions.v.i: \
1064         $(wildcard $(+sysdep_dirs:=/shlib-versions) \
1065                    $(subdir-srcdirs:=/shlib-versions)) \
1066         $(..)shlib-versions
1068 $(common-objpfx)soversions.i: $(..)scripts/soversions.awk \
1069                               $(common-objpfx)shlib-versions.v
1070         $(AWK) -f $^ > $@T
1071         mv -f $@T $@
1072 $(common-objpfx)soversions.mk: $(common-objpfx)soversions.i $(..)Makeconfig
1073         (while read which lib number setname; do \
1074            eval seen_$$which=1; \
1075            test x"$$which" = xDEFAULT || continue; \
1076            case $$number in \
1077              [0-9]*) echo "$$lib.so-version=.$$number"; \
1078                      echo "all-sonames+=$$lib=$$lib.so\$$($$lib.so-version)";;\
1079              *)      echo "$$lib.so-version=$$number"; \
1080                      echo "all-sonames+=$$lib=\$$($$lib.so-version)";;\
1081            esac; \
1082          done; \
1083          echo soversions.mk-done = t;) < $< > $@T; exit 0
1084         mv -f $@T $@
1085 endif
1086 endif
1088 postclean-generated += soversions.mk soversions.i \
1089                        shlib-versions.v shlib-versions.v.i
1091 before-compile += $(common-objpfx)libc-modules.h
1092 ifeq ($(soversions.mk-done),t)
1093 # Generate a header with macro definitions for use with the IS_IN macro.
1094 # These are the possible values for the MODULE_NAME macro defined when building
1095 # sources, to identify which module the translation unit is going to be built
1096 # into.
1097 $(common-objpfx)libc-modules.h: $(common-objpfx)libc-modules.stmp; @:
1098 $(common-objpfx)libc-modules.stmp: $(..)scripts/gen-libc-modules.awk \
1099                                    $(common-objpfx)soversions.i
1100         $(AWK) -v buildlist="$(subst -,_,$(built-modules))" -f $^ > ${@:stmp=T}
1101         $(move-if-change) ${@:stmp=T} ${@:stmp=h}
1102         touch $@
1104 endif
1106 common-generated += libc-modules.h libc-modules.stmp
1108 # The name under which the run-time dynamic linker is installed.
1109 # We are currently going for the convention that `/lib/ld.so.1'
1110 # names the SVR4/ELF ABI-compliant dynamic linker.
1111 ifndef rtld-installed-name
1112 ifdef ld.so-version
1113 rtld-installed-name = $(ld.so-version)
1114 else
1115 rtld-installed-name = ld.so.1
1116 endif
1117 endif
1119 ifndef rtld-version-installed-name
1120 rtld-version-installed-name = ld-$(version).so
1121 endif
1123 endif # build-shared
1126 ifeq ($(build-shared),yes)
1127 libdl = $(common-objpfx)dlfcn/libdl.so$(libdl.so-version)
1128 else
1129 libdl = $(common-objpfx)dlfcn/libdl.a
1130 endif
1132 ifeq ($(build-shared),yes)
1133 libm = $(common-objpfx)math/libm.so$(libm.so-version)
1134 libmvec = $(common-objpfx)mathvec/libmvec.so$(libmvec.so-version)
1135 else
1136 libm = $(common-objpfx)math/libm.a
1137 libmvec = $(common-objpfx)mathvec/libmvec.a
1138 endif
1140 ifeq ($(build-shared),yes)
1141 libsupport = $(common-objpfx)support/libsupport_nonshared.a
1142 else
1143 libsupport = $(common-objpfx)support/libsupport.a
1144 endif
1146 # These are the subdirectories containing the library source.  The order
1147 # is more or less arbitrary.  The sorting step will take care of the
1148 # dependencies.
1149 all-subdirs = csu assert ctype locale intl catgets math setjmp signal       \
1150               stdlib stdio-common libio malloc string wcsmbs time dirent    \
1151               grp pwd posix io termios resource misc socket sysvipc gmon    \
1152               gnulib iconv iconvdata wctype manual shadow gshadow po argp   \
1153               crypt localedata timezone rt conform debug mathvec support    \
1154               $(add-on-subdirs) dlfcn elf
1156 ifndef avoid-generated
1157 # sysd-sorted itself will contain rules making the sysd-sorted target
1158 # depend on Depend files.  But if you just added a Depend file to an
1159 # existing directory not in all-subdirs, then sysd-sorted needs to
1160 # be regenerated, so it depends on existing $(sorted-subdirs:=/Depend) files.
1161 all-Depend-files := $(wildcard $(sort \
1162                         $(foreach dir,$(all-subdirs),\
1163                                   $(firstword $($(dir)-srcdir) \
1164                                   $(..)$(dir))/Depend) \
1165                         $(sorted-subdirs:=/Depend)))
1166 $(common-objpfx)sysd-sorted: $(..)scripts/gen-sorted.awk \
1167                              $(common-objpfx)config.make $(..)Makeconfig \
1168                              $(wildcard $(sysdirs:=/Subdirs)) \
1169                              $(all-Depend-files)
1170         $(AWK) -f $< \
1171                -v subdirs='$(all-subdirs)' \
1172                -v srcpfx='$(..)' \
1173                $(filter %/Subdirs %/Depend,$^) > $@-tmp
1174         mv -f $@-tmp $@
1175 $(all-Depend-files): ;
1176 endif
1178 # This gives partial TARGET:SOURCE pattern pairs to have rules
1179 # emitted into sysd-rules.  A sysdeps Makeconfig fragment can
1180 # add its own special object file prefix to this list with e.g. foo-%:%
1181 # to have foo-*.? compiled from *.? using $(foo-CPPFLAGS).
1182 sysd-rules-patterns := %:% rtld-%:rtld-% rtld-%:% m_%:s_%
1184 # Let sysdeps/ subdirs contain a Makeconfig fragment for us to include here.
1185 sysdep-makeconfigs := $(wildcard $(+sysdep_dirs:=/Makeconfig))
1186 ifneq (,$(sysdep-makeconfigs))
1187 include $(sysdep-makeconfigs)
1188 endif
1190 # Compute just the target patterns.  Makeconfig has set sysd-rules-patterns.
1191 sysd-rules-targets := $(sort $(foreach p,$(sysd-rules-patterns),\
1192                                          $(firstword $(subst :, ,$p))))
1194 # A sysdeps Makeconfig fragment may set libc-reentrant to yes.
1195 ifeq (yes,$(libc-reentrant))
1196 defines += -D_LIBC_REENTRANT
1198 libio-mtsafe = -D_IO_MTSAFE_IO
1199 endif
1201 # The name to give to a test in test results summaries.
1202 test-name = $(strip $(patsubst %.out, %, $(patsubst $(common-objpfx)%, %, $@)))
1204 # Likewise, in XFAIL variable names.
1205 test-xfail-name = $(strip $(patsubst %.out, %, $(patsubst $(objpfx)%, %, $@)))
1207 # Command to output a test status line (such as PASS: test-name).  If
1208 # test-xfail-$(test-xfail-name) has a nonempty value, the status will be
1209 # XPASS or XFAIL rather than PASS or FAIL.
1210 evaluate-test = $(..)scripts/evaluate-test.sh $(test-name) $$? \
1211                   $(if $(test-xfail-$(test-xfail-name)),true,false) \
1212                   $(if $(stop-on-test-failure),true,false) \
1213                   > $(common-objpfx)$(test-name).test-result
1215 endif # Makeconfig not yet included
1217 # Local Variables:
1218 # mode: makefile
1219 # End: