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