@@ -78,7 +78,9 @@ sysdirs := $(foreach D,$(config-sysdirs),$(firstword $(filter /%,$D) $(..)$D))
+sysdep_dirs = $(sysdirs)
ifdef objdir
-+sysdep_dirs := $(objdir) $(+sysdep_dirs)
++sysdep_dirs := \
+ $(objdir) \
+ $(+sysdep_dirs)
endif
# Run config.status to update config.make and config.h. We don't show the
@@ -341,9 +343,13 @@ endif
# Default flags to pass the C compiler.
ifndef default_cflags
ifeq ($(release),stable)
-default_cflags := -g -O2
+default_cflags := \
+ -g \
+ -O2
else
-default_cflags := -g -O
+default_cflags := \
+ -g \
+ -O
endif
endif
@@ -429,20 +435,34 @@ link-extra-libs-tests = $(libsupport)
# Command for linking PIE programs with the C library.
ifndef +link-pie
-+link-pie-before-inputs = $(if $($(@F)-no-pie),$(no-pie-ldflag),-pie) \
- $(if $($(@F)-no-dt-relr),$(no-dt-relr-ldflag),$(dt-relr-ldflag)) \
- -Wl,-O1 -nostdlib -nostartfiles \
- $(sysdep-LDFLAGS) $(LDFLAGS) $(LDFLAGS-$(@F)) \
- $(relro-LDFLAGS) $(hashstyle-LDFLAGS) \
- $(firstword $(CRT-$(@F)) $(csu-objpfx)S$(start-installed-name)) \
- $(+preinit) $(+prectorS)
-+link-pie-before-libc = -o $@ $(+link-pie-before-inputs) \
- $(filter-out $(addprefix $(csu-objpfx),start.o \
- S$(start-installed-name)) \
- $(+preinit) $(link-extra-libs) \
- $(common-objpfx)libc% $(+postinit),$^) \
- $(link-extra-libs)
-+link-pie-after-libc = $(+postctorS) $(+postinit)
++link-pie-before-inputs = \
+ $(if $($(@F)-no-pie),$(no-pie-ldflag),-pie) \
+ $(if $($(@F)-no-dt-relr),$(no-dt-relr-ldflag),$(dt-relr-ldflag)) \
+ -Wl,-O1 \
+ -nostdlib \
+ -nostartfiles \
+ $(sysdep-LDFLAGS) \
+ $(LDFLAGS) \
+ $(LDFLAGS-$(@F)) \
+ $(relro-LDFLAGS) \
+ $(hashstyle-LDFLAGS) \
+ $(firstword $(CRT-$(@F)) $(csu-objpfx)S$(start-installed-name)) \
+ $(+preinit) \
+ $(+prectorS)
++link-pie-before-libc = \
+ -o $@ \
+ $(+link-pie-before-inputs) \
+ $(filter-out \
+ $(addprefix $(csu-objpfx),start.o S$(start-installed-name)) \
+ $(+preinit) \
+ $(link-extra-libs) \
+ $(common-objpfx)libc% \
+ $(+postinit), \
+ $^) \
+ $(link-extra-libs)
++link-pie-after-libc = \
+ $(+postctorS) \
+ $(+postinit)
define +link-pie
$(CC) $(link-libc-rpath-link) $(+link-pie-before-libc) $(rtld-LDFLAGS) \
$(link-extra-flags) $(link-libc) $(+link-pie-after-libc)
@@ -461,19 +481,32 @@ endef
endif
# Command for statically linking programs with the C library.
ifndef +link-static
-+link-static-before-inputs = -nostdlib -nostartfiles -static \
- $(if $($(@F)-no-pie),$(no-pie-ldflag),$(static-pie-ldflag)) \
- $(if $($(@F)-no-dt-relr),$(no-dt-relr-ldflag),$(static-pie-dt-relr-ldflag)) \
- $(sysdep-LDFLAGS) $(LDFLAGS) $(LDFLAGS-$(@F)) \
- $(firstword $(CRT-$(@F)) $(csu-objpfx)$(real-static-start-installed-name)) \
- $(+preinit) $(+prectorT)
-+link-static-before-libc = -o $@ $(+link-static-before-inputs) \
- $(filter-out $(addprefix $(csu-objpfx),start.o \
- $(start-installed-name)) \
- $(+preinit) $(link-extra-libs-static) \
- $(common-objpfx)libc% $(+postinit),$^) \
- $(link-extra-libs-static)
-+link-static-after-libc = $(+postctorT) $(+postinit)
++link-static-before-inputs = \
+ -nostdlib \
+ -nostartfiles \
+ -static \
+ $(if $($(@F)-no-pie),$(no-pie-ldflag),$(static-pie-ldflag)) \
+ $(if $($(@F)-no-dt-relr),$(no-dt-relr-ldflag),$(static-pie-dt-relr-ldflag)) \
+ $(sysdep-LDFLAGS) \
+ $(LDFLAGS) \
+ $(LDFLAGS-$(@F)) \
+ $(firstword $(CRT-$(@F)) $(csu-objpfx)$(real-static-start-installed-name)) \
+ $(+preinit) \
+ $(+prectorT)
++link-static-before-libc = \
+ -o $@ \
+ $(+link-static-before-inputs) \
+ $(filter-out \
+ $(addprefix $(csu-objpfx),start.o $(start-installed-name)) \
+ $(+preinit) \
+ $(link-extra-libs-static) \
+ $(common-objpfx)libc% \
+ $(+postinit), \
+ $^) \
+ $(link-extra-libs-static)
++link-static-after-libc = \
+ $(+postctorT) \
+ $(+postinit)
define +link-static
$(CC) $(+link-static-before-libc) $(link-extra-flags) $(link-libc-static) \
$(+link-static-after-libc)
@@ -494,29 +527,51 @@ endif
ifeq (yes,$(build-pie-default))
+link = $(+link-pie)
+link-tests = $(+link-pie-tests)
-+link-tests-before-inputs = $(+link-pie-before-inputs) $(rtld-tests-LDFLAGS)
-+link-tests-after-inputs = $(link-libc-tests) $(+link-pie-after-libc)
++link-tests-before-inputs = \
+ $(+link-pie-before-inputs) \
+ $(rtld-tests-LDFLAGS)
++link-tests-after-inputs = \
+ $(link-libc-tests) \
+ $(+link-pie-after-libc)
+link-printers-tests = $(+link-pie-printers-tests)
else # not build-pie-default
-+link-before-inputs = -nostdlib -nostartfiles $(no-pie-ldflag) \
- $(sysdep-LDFLAGS) $(LDFLAGS) $(LDFLAGS-$(@F)) \
- $(relro-LDFLAGS) $(hashstyle-LDFLAGS) \
- $(firstword $(CRT-$(@F)) $(csu-objpfx)$(start-installed-name)) \
- $(+preinit) $(+prector)
-+link-before-libc = -o $@ $(+link-before-inputs) \
- $(filter-out $(addprefix $(csu-objpfx),start.o \
- $(start-installed-name)) \
- $(+preinit) $(link-extra-libs) \
- $(common-objpfx)libc% $(+postinit),$^) \
- $(link-extra-libs)
-+link-after-libc = $(+postctor) $(+postinit)
++link-before-inputs = \
+ -nostdlib \
+ -nostartfiles \
+ $(no-pie-ldflag) \
+ $(sysdep-LDFLAGS) \
+ $(LDFLAGS) \
+ $(LDFLAGS-$(@F)) \
+ $(relro-LDFLAGS) \
+ $(hashstyle-LDFLAGS) \
+ $(firstword $(CRT-$(@F)) $(csu-objpfx)$(start-installed-name)) \
+ $(+preinit) \
+ $(+prector)
++link-before-libc = \
+ -o $@ \
+ $(+link-before-inputs) \
+ $(filter-out \
+ $(addprefix $(csu-objpfx),start.o $(start-installed-name)) \
+ $(+preinit) \
+ $(link-extra-libs) \
+ $(common-objpfx)libc% \
+ $(+postinit), \
+ $^) \
+ $(link-extra-libs)
++link-after-libc = \
+ $(+postctor) \
+ $(+postinit)
define +link
$(CC) $(link-libc-rpath-link) $(+link-before-libc) $(rtld-LDFLAGS) \
$(link-extra-flags) $(link-libc) $(+link-after-libc)
$(call after-link,$@)
endef
-+link-tests-before-inputs = $(+link-before-inputs) $(rtld-tests-LDFLAGS)
-+link-tests-after-inputs = $(link-libc-tests) $(+link-after-libc)
++link-tests-before-inputs = \
+ $(+link-before-inputs) \
+ $(rtld-tests-LDFLAGS)
++link-tests-after-inputs = \
+ $(link-libc-tests) \
+ $(+link-after-libc)
define +link-tests
$(CC) $(+link-before-libc) $(rtld-tests-LDFLAGS) $(link-libc-tests) \
$(+link-after-libc)
@@ -532,7 +587,9 @@ else # build-static
+link = $(+link-static)
+link-tests = $(+link-static-tests)
+link-tests-before-inputs = $(+link-static-before-inputs)
-+link-tests-after-inputs = $(link-libc-static-tests) $(+link-static-after-libc)
++link-tests-after-inputs = \
+ $(link-libc-static-tests) \
+ $(+link-static-after-libc)
+link-printers-tests = $(+link-static-tests)
endif # build-shared
endif # +link
@@ -549,7 +606,11 @@ endif # +link
# when compiling the tests, which will throw an error if some special macros
# (such as __OPTIMIZE__ and IS_IN_build) aren't defined. To avoid this, we
# tell gcc to define IS_IN_build.
-CFLAGS-printers-tests := -O0 -ggdb3 -DIS_IN_build $(no-fortify-source)
+CFLAGS-printers-tests := \
+ -O0 \
+ -ggdb3 \
+ -DIS_IN_build \
+ $(no-fortify-source)
ifeq (yes,$(build-shared))
# These indicate whether to link using the built ld.so or the installed one.
@@ -595,26 +656,55 @@ link-libc-tests-rpath-link = $(link-libc-rpath-link)
link-test-modules-rpath-link =
endif # build-hardcoded-path-in-tests
-link-libc-between-gnulib = $(common-objpfx)libc.so$(libc.so-version) \
- $(common-objpfx)$(patsubst %,$(libtype.oS),c) \
- -Wl,--as-needed $(elf-objpfx)ld.so \
- -Wl,--no-as-needed
-link-libc = $(link-libc-between-gnulib) $(gnulib)
+link-libc-between-gnulib = \
+ $(common-objpfx)libc.so$(libc.so-version) \
+ $(common-objpfx)$(patsubst %,$(libtype.oS),c) \
+ -Wl,--as-needed \
+ $(elf-objpfx)ld.so \
+ -Wl,--no-as-needed
+link-libc = \
+ $(link-libc-between-gnulib) \
+ $(gnulib)
-link-libc-tests-after-rpath-link = $(gnulib-tests) $(link-libc-between-gnulib) $(gnulib-tests)
-link-libc-tests = $(link-libc-tests-rpath-link) \
- $(link-libc-tests-after-rpath-link)
+link-libc-tests-after-rpath-link = \
+ $(gnulib-tests) \
+ $(link-libc-between-gnulib) \
+ $(gnulib-tests)
+link-libc-tests = \
+ $(link-libc-tests-rpath-link) \
+ $(link-libc-tests-after-rpath-link)
# Pretty printer test programs always require rpath instead of rpath-link.
-link-libc-printers-tests = $(link-libc-rpath) \
- $(link-libc-tests-after-rpath-link)
+link-libc-printers-tests = \
+ $(link-libc-rpath) \
+ $(link-libc-tests-after-rpath-link)
# This is how to find at build-time things that will be installed there.
-rpath-dirs = math elf dlfcn nss nis rt resolv mathvec support
+rpath-dirs = \
+ math \
+ elf \
+ dlfcn \
+ nss \
+ nis \
+ rt \
+ resolv \
+ mathvec \
+ support
rpath-link = \
-$(common-objdir):$(subst $(empty) ,:,$(patsubst ../$(subdir),.,$(rpath-dirs:%=$(common-objpfx)%)))
+ $(common-objdir):$(subst $(empty) ,:, \
+ $(patsubst ../$(subdir),.,$(rpath-dirs:%=$(common-objpfx)%)))
else # build-static
-link-libc = $(common-objpfx)libc.a $(otherlibs) $(gnulib) $(common-objpfx)libc.a $(gnulib)
-link-libc-tests = $(common-objpfx)libc.a $(otherlibs) $(gnulib-tests) $(common-objpfx)libc.a $(gnulib-tests)
+link-libc = \
+ $(common-objpfx)libc.a \
+ $(otherlibs) \
+ $(gnulib) \
+ $(common-objpfx)libc.a \
+ $(gnulib)
+link-libc-tests = \
+ $(common-objpfx)libc.a \
+ $(otherlibs) \
+ $(gnulib-tests) \
+ $(common-objpfx)libc.a \
+ $(gnulib-tests)
endif # build-shared
endif # link-libc
@@ -638,8 +728,16 @@ link-extra-libs-static = $(link-extra-libs)
endif
# The static libraries.
-link-libc-static = -Wl,--start-group $(common-objpfx)libc.a $(static-gnulib) -Wl,--end-group
-link-libc-static-tests = -Wl,--start-group $(common-objpfx)libc.a $(static-gnulib-tests) -Wl,--end-group
+link-libc-static = \
+ -Wl,--start-group \
+ $(common-objpfx)libc.a \
+ $(static-gnulib) \
+ -Wl,--end-group
+link-libc-static-tests = \
+ -Wl,--start-group \
+ $(common-objpfx)libc.a \
+ $(static-gnulib-tests) \
+ -Wl,--end-group
# How to link against libgcc. Some libgcc functions, such as those
# for "long long" arithmetic or software floating point, can always be
@@ -681,20 +779,36 @@ ifneq ($(have-cc-with-libunwind),yes)
else
libunwind = -lunwind
endif
-libgcc_eh := -Wl,--as-needed -lgcc_s $(libunwind) -Wl,--no-as-needed
+libgcc_eh := \
+ -Wl,--as-needed \
+ -lgcc_s \
+ $(libunwind) \
+ -Wl,--no-as-needed
gnulib-arch =
-gnulib = -lgcc $(gnulib-arch)
-gnulib-tests := -lgcc $(libgcc_eh)
+gnulib = \
+ -lgcc \
+ $(gnulib-arch)
+gnulib-tests := \
+ -lgcc \
+ $(libgcc_eh)
static-gnulib-arch =
# By default, elf/static-stubs.o, instead of -lgcc_eh, is used to
# statically link programs. When --disable-shared is used, we use
# -lgcc_eh since elf/static-stubs.o isn't sufficient.
ifeq (yes,$(build-shared))
-static-gnulib = -lgcc $(static-gnulib-arch)
+static-gnulib = \
+ -lgcc \
+ $(static-gnulib-arch)
else
-static-gnulib = -lgcc -lgcc_eh $(static-gnulib-arch)
+static-gnulib = \
+ -lgcc \
+ -lgcc_eh \
+ $(static-gnulib-arch)
endif
-static-gnulib-tests := -lgcc -lgcc_eh $(libunwind)
+static-gnulib-tests := \
+ -lgcc \
+ -lgcc_eh \
+ $(libunwind)
libc.so-gnulib := -lgcc
endif
+preinit = $(addprefix $(csu-objpfx),crti.o)
@@ -725,12 +839,17 @@ endif
# Likewise, but the name of the program is preceded by
# <variable>=<value> assignments for environment variables.
ifndef test-wrapper-env
-test-wrapper-env = $(test-wrapper) env
+test-wrapper-env = \
+ $(test-wrapper) \
+ env
endif
# Likewise, but the program's environment will be empty except for any
# explicit <variable>=<value> assignments preceding the program name.
ifndef test-wrapper-env-only
-test-wrapper-env-only = $(test-wrapper) env -i
+test-wrapper-env-only = \
+ $(test-wrapper) \
+ env \
+ -i
endif
# Whether to run test programs built for the library's host system.
@@ -751,15 +870,17 @@ endif
# How to run a program we just linked with our library.
# The program binary is assumed to be $(word 2,$^).
built-program-file = $(dir $(word 2,$^))$(notdir $(word 2,$^))
-rtld-prefix = $(elf-objpfx)$(rtld-installed-name) \
- --library-path \
- $(rpath-link)$(patsubst %,:%,$(sysdep-library-path))
+rtld-prefix = \
+ $(elf-objpfx)$(rtld-installed-name) \
+ --library-path \
+ $(rpath-link)$(patsubst %, :%, $(sysdep-library-path))
ifeq (yes,$(build-shared))
comma = ,
sysdep-library-path = \
-$(subst $(empty) ,:,$(strip $(patsubst -Wl$(comma)-rpath-link=%, %, \
- $(filter -Wl$(comma)-rpath-link=%, \
- $(sysdep-LDFLAGS)))))
+ $(subst $(empty) ,:, \
+ $(strip $(patsubst \
+ -Wl$(comma)-rpath-link=%, %, \
+ $(filter -Wl$(comma)-rpath-link=%, $(sysdep-LDFLAGS)))))
# $(run-via-rtld-prefix) is a command that, when prepended to the name
# of a program built with the newly built library, produces a command
# that, executed on the host for which the library is built, runs that
@@ -773,8 +894,10 @@ run-via-rtld-prefix =
endif
# $(run-program-env) is the default environment variable settings to
# use when running a program built with the newly built library.
-run-program-env = GCONV_PATH=$(common-objpfx)iconvdata \
- LOCPATH=$(common-objpfx)localedata LC_ALL=C
+run-program-env = \
+ GCONV_PATH=$(common-objpfx)iconvdata \
+ LOCPATH=$(common-objpfx)localedata \
+ LC_ALL=C
# $(run-program-prefix) is a command that, when prepended to the name
# of a program built with the newly built library, produces a command
# that, executed on the build system on which "make" is run, runs that
@@ -783,8 +906,10 @@ run-program-env = GCONV_PATH=$(common-objpfx)iconvdata \
# before and after a list of environment variables.
run-program-prefix-before-env = $(test-wrapper-env)
run-program-prefix-after-env = $(run-via-rtld-prefix)
-run-program-prefix = $(run-program-prefix-before-env) $(run-program-env) \
- $(run-program-prefix-after-env)
+run-program-prefix = \
+ $(run-program-prefix-before-env) \
+ $(run-program-env) \
+ $(run-program-prefix-after-env)
# $(built-program-cmd) is a command that, executed on the build system
# on which "make" is run, runs the newly built program that is the
# second dependency of the makefile target in which
@@ -792,14 +917,20 @@ run-program-prefix = $(run-program-prefix-before-env) $(run-program-env) \
# $(built-program-cmd-after-env) are similar, before and after a list
# of environment variables.
built-program-cmd-before-env = $(test-wrapper-env)
-built-program-cmd-after-env = $(run-via-rtld-prefix) $(built-program-file)
-built-program-cmd = $(built-program-cmd-before-env) $(run-program-env) \
- $(built-program-cmd-after-env)
+built-program-cmd-after-env = \
+ $(run-via-rtld-prefix) \
+ $(built-program-file)
+built-program-cmd = \
+ $(built-program-cmd-before-env) \
+ $(run-program-env) \
+ $(built-program-cmd-after-env)
# $(host-built-program-cmd) is a command that, executed on the host
# for which the library is built, runs the newly built program that is
# the second dependency of the makefile target in which
# $(host-built-program-cmd) is used.
-host-built-program-cmd = $(run-via-rtld-prefix) $(built-program-file)
+host-built-program-cmd = \
+ $(run-via-rtld-prefix) \
+ $(built-program-file)
# $(ld-library-path) is the common content to be set in LD_LIBRARY_PATH
# for running static binaries that may load dynamic objects.
ld-library-path = $(objpfx):$(common-objpfx)$(addprefix :,$(sysdep-ld-library-path))
@@ -838,12 +969,16 @@ ifeq (yes,$(build-hardcoded-path-in-tests))
test-via-rtld-prefix =
test-program-prefix-before-env = $(test-wrapper-env)
test-program-prefix-after-env =
-test-program-prefix = $(test-program-prefix-before-env) $(run-program-env) \
- $(test-program-prefix-after-env)
+test-program-prefix = \
+ $(test-program-prefix-before-env) \
+ $(run-program-env) \
+ $(test-program-prefix-after-env)
test-program-cmd-before-env = $(test-wrapper-env)
test-program-cmd-after-env = $(built-program-file)
-test-program-cmd = $(test-program-cmd-before-env) $(run-program-env) \
- $(test-program-cmd-after-env)
+test-program-cmd = \
+ $(test-program-cmd-before-env) \
+ $(run-program-env) \
+ $(test-program-cmd-after-env)
host-test-program-cmd = $(built-program-file)
else
test-via-rtld-prefix = $(run-via-rtld-prefix)
@@ -858,15 +993,32 @@ endif
# Extra flags to pass to GCC.
ifeq ($(all-warnings),yes)
-+gccwarn := -Wall -Wwrite-strings -Wcast-qual -Wbad-function-cast -Wmissing-noreturn -Wmissing-prototypes -Wmissing-declarations -Wcomment -Wcomments -Wtrigraphs -Wsign-compare -Wfloat-equal -Wmultichar
++gccwarn := \
+ -Wall \
+ -Wwrite-strings \
+ -Wcast-qual \
+ -Wbad-function-cast \
+ -Wmissing-noreturn \
+ -Wmissing-prototypes \
+ -Wmissing-declarations \
+ -Wcomment \
+ -Wcomments \
+ -Wtrigraphs \
+ -Wsign-compare \
+ -Wfloat-equal \
+ -Wmultichar
else
-+gccwarn := -Wall -Wwrite-strings
++gccwarn := \
+ -Wall \
+ -Wwrite-strings
endif
+gccwarn += -Wundef
ifeq ($(enable-werror),yes)
+gccwarn += -Werror
endif
-+gccwarn-c = -Wstrict-prototypes -Wold-style-definition
++gccwarn-c = \
+ -Wstrict-prototypes \
+ -Wold-style-definition
# We do not depend on the address of constants in different files to be
# actually different, so allow the compiler to merge them all.
@@ -883,11 +1035,23 @@ endif
+extra-math-flags = $(if $(filter libm,$(in-module)),-fno-math-errno,-fmath-errno)
# Use 64 bit time_t support for installed programs
-installed-modules = nonlib nscd ldconfig locale_programs \
- iconvprogs libnss_files libnss_compat libnss_db libnss_hesiod \
- libutil libpcprofile libnsl
-+extra-time-flags = $(if $(filter $(installed-modules), \
- $(in-module)),-D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64)
+installed-modules = \
+ nonlib \
+ nscd \
+ ldconfig \
+ locale_programs \
+ iconvprogs \
+ libnss_files \
+ libnss_compat \
+ libnss_db \
+ libnss_hesiod \
+ libutil \
+ libpcprofile \
+ libnsl
++extra-time-flags = \
+ $(if $(filter $(installed-modules), $(in-module)), \
+ -D_TIME_BITS=64 \
+ -D_FILE_OFFSET_BITS=64)
# We might want to compile with some stack-protection flag.
ifneq ($(stack-protector),)
@@ -968,8 +1132,13 @@ endif # $(+cflags) == ""
# and other constructs do not work for common symbols (and would
# otherwise require specifying __attribute__ ((nocommon)) on a
# case-by-case basis).
-+cflags += $(cflags-cpu) $(+gccwarn) $(+merge-constants) $(+math-flags) \
- $(+stack-protector) -fno-common
++cflags += \
+ $(cflags-cpu) \
+ $(+gccwarn) \
+ $(+merge-constants) \
+ $(+math-flags) \
+ $(+stack-protector) \
+ -fno-common
+gcc-nowarn := -w
# We must filter out elf because the early bootstrap of the dynamic loader
@@ -996,19 +1165,37 @@ endif
# include files (including ones given in angle brackets) in the parent
# library source directory, in the include directory, and in the
# current directory.
-+includes = -I$(..)include $(if $(subdir),$(objpfx:%/=-I%)) \
- $(+sysdep-includes) $(includes) \
- $(patsubst %/,-I%,$(..)) $(libio-include) -I. $(sysincludes)
++includes = \
+ -I$(..)include \
+ $(if $(subdir),$(objpfx:%/=-I%)) \
+ $(+sysdep-includes) \
+ $(includes) \
+ $(patsubst %/,-I%,$(..)) \
+ $(libio-include) \
+ -I. \
+ $(sysincludes)
# Since libio has several internal header files, we use a -I instead
# of many little headers in the include directory.
libio-include = -I$(..)libio
# List of non-library modules that we build.
-built-modules = iconvprogs iconvdata ldconfig libmemusage \
- libpcprofile librpcsvc locale-programs \
- memusagestat nonlib nscd extramodules libnldbl libsupport \
- testsuite testsuite-internal
+built-modules = \
+ iconvprogs \
+ iconvdata \
+ ldconfig \
+ libmemusage \
+ libpcprofile \
+ librpcsvc \
+ locale-programs \
+ memusagestat \
+ nonlib \
+ nscd \
+ extramodules \
+ libnldbl \
+ libsupport \
+ testsuite \
+ testsuite-internal
in-module = $(subst -,_,$(firstword $(libof-$(basename $(@F))) \
$(libof-$(<F)) \
@@ -1016,11 +1203,14 @@ in-module = $(subst -,_,$(firstword $(libof-$(basename $(@F))) \
libc))
# Build ld.so, libc.so and libpthread.so with -ftls-model=initial-exec
-tls-model = $(if $(filter libpthread rtld \
- libc,$(in-module)),-ftls-model=initial-exec,)
+tls-model = \
+ $(if $(filter libpthread rtld libc,$(in-module)), \
+ -ftls-model=initial-exec,)
-module-cppflags-real = -include $(common-objpfx)libc-modules.h \
- -DMODULE_NAME=$(in-module)
+module-cppflags-real = \
+ -include \
+ $(common-objpfx)libc-modules.h \
+ -DMODULE_NAME=$(in-module)
# We don't need libc-modules.h and the MODULE_NAME definition for .v.i
# files. These targets don't (and will likely never need to) use the IS_IN
@@ -1033,27 +1223,49 @@ module-cppflags = $(if $(filter %.mk.i %.v.i,$(@F)),,$(module-cppflags-real))
# Note that we can't use -std=* in CPPFLAGS, because it overrides
# the implicit -lang-asm and breaks cpp behavior for .S files--notably
# it causes cpp to stop predefining __ASSEMBLER__.
-CPPFLAGS = $(config-extra-cppflags) $(CPPFLAGS-config) \
- $($(subdir)-CPPFLAGS) \
- $(+includes) $(defines) $(module-cppflags) \
- -include $(..)include/libc-symbols.h $(sysdep-CPPFLAGS) \
- $(CPPFLAGS-$(suffix $@)) \
- $(foreach lib,$(libof-$(basename $(@F))) \
- $(libof-$(<F)) $(libof-$(@F)),$(CPPFLAGS-$(lib))) \
- $(CPPFLAGS-$(<F)) $(CPPFLAGS-$(@F)) $(CPPFLAGS-$(basename $(@F))) \
- -DTOP_NAMESPACE=glibc
+CPPFLAGS = \
+ $(config-extra-cppflags) \
+ $(CPPFLAGS-config) \
+ $($(subdir)-CPPFLAGS) \
+ $(+includes) \
+ $(defines) \
+ $(module-cppflags) \
+ -include $(..)include/libc-symbols.h \
+ $(sysdep-CPPFLAGS) \
+ $(CPPFLAGS-$(suffix $@)) \
+ $(foreach lib, \
+ $(libof-$(basename $(@F))) $(libof-$(<F)) $(libof-$(@F)), \
+ $(CPPFLAGS-$(lib))) \
+ $(CPPFLAGS-$(<F)) \
+ $(CPPFLAGS-$(@F)) \
+ $(CPPFLAGS-$(basename $(@F))) \
+ -DTOP_NAMESPACE=glibc
-override CFLAGS = -std=gnu11 -fgnu89-inline $(config-extra-cflags) \
- $(filter-out %frame-pointer,$(+cflags)) $(+gccwarn-c) \
- $(+extra-math-flags) $(+extra-time-flags) \
- $(sysdep-CFLAGS) $(CFLAGS-$(suffix $@)) $(CFLAGS-$(<F)) \
- $(CFLAGS-$(@F)) $(tls-model) \
- $(foreach lib,$(libof-$(basename $(@F))) \
- $(libof-$(<F)) $(libof-$(@F)),$(CFLAGS-$(lib)))
+override CFLAGS = \
+ -std=gnu11 \
+ -fgnu89-inline \
+ $(config-extra-cflags) \
+ $(filter-out %frame-pointer,$(+cflags)) \
+ $(+gccwarn-c) \
+ $(+extra-math-flags) \
+ $(+extra-time-flags) \
+ $(sysdep-CFLAGS) \
+ $(CFLAGS-$(suffix $@)) \
+ $(CFLAGS-$(<F)) \
+ $(CFLAGS-$(@F)) \
+ $(tls-model) \
+ $(foreach lib, \
+ $(libof-$(basename $(@F))) $(libof-$(<F)) $(libof-$(@F)), \
+ $(CFLAGS-$(lib)))
# Use our copies of cstdlib and cmath.
-override CXXFLAGS = -I$(common-objpfx) $(c++-sysincludes) \
- $(filter-out %frame-pointer,$(+cflags)) $(sysdep-CFLAGS) \
- $(CFLAGS-$(suffix $@)) $(CFLAGS-$(<F)) $(CFLAGS-$(@F))
+override CXXFLAGS = \
+ -I$(common-objpfx) \
+ $(c++-sysincludes) \
+ $(filter-out %frame-pointer,$(+cflags)) \
+ $(sysdep-CFLAGS) \
+ $(CFLAGS-$(suffix $@)) \
+ $(CFLAGS-$(<F)) \
+ $(CFLAGS-$(@F))
# If everything is compiled with -fPIC (implicitly) we must tell this by
# defining the PIC symbol.
@@ -1067,11 +1279,16 @@ endif
# to pass different flags for each flavor.
libtypes = $(foreach o,$(object-suffixes-for-libc),$(libtype$o))
# .op may be added to all-object-suffixes below.
-all-object-suffixes := .o .os .oS
+all-object-suffixes := \
+ .o \
+ .os \
+ .oS
object-suffixes :=
CPPFLAGS-.o = $(pic-default)
# libc.a must be compiled with -fPIE/-fpie for static PIE.
-CFLAGS-.o = $(filter %frame-pointer,$(+cflags)) $(pie-default)
+CFLAGS-.o = \
+ $(filter %frame-pointer,$(+cflags)) \
+ $(pie-default)
CFLAGS-.o += $(call elide-fortify-source,.o,$(routines_no_fortify))
CFLAGS-.o += $(call elide-fortify-source,_chk.o,$(routines_no_fortify))
libtype.o := lib%.a
@@ -1080,9 +1297,13 @@ ifeq (yes,$(build-shared))
# Under --enable-shared, we will build a shared library of PIC objects.
# The PIC object files are named foo.os.
object-suffixes += .os
-pic-cppflags = -DPIC -DSHARED
+pic-cppflags = \
+ -DPIC \
+ -DSHARED
CPPFLAGS-.os = $(pic-cppflags)
-CFLAGS-.os = $(filter %frame-pointer,$(+cflags)) $(pic-ccflag)
+CFLAGS-.os = \
+ $(filter %frame-pointer,$(+cflags)) \
+ $(pic-ccflag)
CFLAGS-.os += $(call elide-fortify-source,.os,$(routines_no_fortify))
CFLAGS-.os += $(call elide-fortify-source,_chk.os,$(routines_no_fortify))
libtype.os := lib%_pic.a
@@ -1101,9 +1322,13 @@ ifeq (yes,$(build-profile))
# The profiled object files are named foo.op.
all-object-suffixes += .op
object-suffixes += .op
-CPPFLAGS-.op = -DPROF $(pic-default)
+CPPFLAGS-.op = \
+ -DPROF \
+ $(pic-default)
# libc_p.a must be compiled with -fPIE/-fpie for static PIE.
-CFLAGS-.op = -pg $(pie-default)
+CFLAGS-.op = \
+ -pg \
+ $(pie-default)
CFLAGS-.op += $(call elide-fortify-source,.op,$(routines_no_fortify))
CFLAGS-.op += $(call elide-fortify-source,_chk.op,$(routines_no_fortify))
libtype.op = lib%_p.a
@@ -1122,8 +1347,14 @@ object-suffixes-for-libc += .oS
# Must build the routines as PIC, though, because they can end up in (users')
# shared objects. We don't want to use CFLAGS-os because users may, for
# example, make that processor-specific.
-CFLAGS-.oS = $(CFLAGS-.o) $(PIC-ccflag) $(extra-nonshared-cflags)
-CPPFLAGS-.oS = $(CPPFLAGS-.o) -DPIC -DLIBC_NONSHARED=1
+CFLAGS-.oS = \
+ $(CFLAGS-.o) \
+ $(PIC-ccflag) \
+ $(extra-nonshared-cflags)
+CPPFLAGS-.oS = \
+ $(CPPFLAGS-.o) \
+ -DPIC \
+ -DLIBC_NONSHARED=1
libtype.oS = lib%_nonshared.a
endif
@@ -1131,7 +1362,10 @@ endif
ifndef ASFLAGS
ASFLAGS := $(filter -g% -fdebug-prefix-map=%,$(CFLAGS))
endif
-override ASFLAGS += -Werror=undef $(ASFLAGS-config) $(asflags-cpu)
+override ASFLAGS += \
+ -Werror=undef \
+ $(ASFLAGS-config) \
+ $(asflags-cpu)
ifndef BUILD_CC
BUILD_CC = $(CC)
@@ -1208,11 +1442,16 @@ $(common-objpfx)soversions.mk: $(common-objpfx)soversions.i $(..)Makeconfig
endif
endif
-postclean-generated += soversions.mk soversions.i \
- shlib-versions.v shlib-versions.v.i
+postclean-generated += \
+ soversions.mk \
+ soversions.i \
+ shlib-versions.v \
+ shlib-versions.v.i
before-compile += $(common-objpfx)libc-modules.h
-common-generated += libc-modules.h libc-modules.stmp
+common-generated += \
+ libc-modules.h \
+ libc-modules.stmp
ifeq ($(soversions.mk-done),t)
# Generate a header with macro definitions for use with the IS_IN macro.
# These are the possible values for the MODULE_NAME macro defined when building
@@ -1230,7 +1469,9 @@ endif
# Build the tunables list header early since it could be used by any module in
# glibc.
before-compile += $(common-objpfx)dl-tunable-list.h
-common-generated += dl-tunable-list.h dl-tunable-list.stmp
+common-generated += \
+ dl-tunable-list.h \
+ dl-tunable-list.stmp
$(common-objpfx)dl-tunable-list.h: $(common-objpfx)dl-tunable-list.stmp; @:
$(common-objpfx)dl-tunable-list.stmp: \
@@ -1258,8 +1499,14 @@ ifeq ($(build-shared),yes)
-include $(common-objpfx)Versions.mk
$(addprefix $(common-objpfx),$(version-maps)): $(common-objpfx)sysd-versions
common-generated += $(version-maps)
-postclean-generated += sysd-versions Versions.all abi-versions.h \
- Versions.def Versions.v.i Versions.v Versions.mk
+postclean-generated += \
+ sysd-versions \
+ Versions.all \
+ abi-versions.h \
+ Versions.def \
+ Versions.v.i \
+ Versions.v \
+ Versions.mk
ifndef avoid-generated
ifneq ($(sysd-versions-subdirs),$(sorted-subdirs) $(config-sysdirs))
@@ -1355,12 +1602,52 @@ endif
# This is a partial list of subdirectories containing the library source.
# The order is more or less arbitrary. The sorting step will take care of the
# dependencies and generate sorted-subdirs dynamically.
-all-subdirs = csu assert ctype locale intl catgets math setjmp signal \
- stdlib stdio-common libio malloc string wcsmbs time dirent \
- grp pwd posix io termios resource misc socket sysvipc gmon \
- gnulib iconv iconvdata wctype manual shadow gshadow po argp \
- localedata timezone rt conform debug mathvec support \
- dlfcn elf
+all-subdirs = \
+ csu \
+ assert \
+ ctype \
+ locale \
+ intl \
+ catgets \
+ math \
+ setjmp \
+ signal \
+ stdlib \
+ stdio-common \
+ libio \
+ malloc \
+ string \
+ wcsmbs \
+ time \
+ dirent \
+ grp \
+ pwd \
+ posix \
+ io \
+ termios \
+ resource \
+ misc \
+ socket \
+ sysvipc \
+ gmon \
+ gnulib \
+ iconv \
+ iconvdata \
+ wctype \
+ manual \
+ shadow \
+ gshadow \
+ po \
+ argp \
+ localedata \
+ timezone \
+ rt \
+ conform \
+ debug \
+ mathvec \
+ support \
+ dlfcn \
+ elf
ifeq ($(build-crypt),yes)
all-subdirs += crypt
@@ -1372,11 +1659,12 @@ ifndef avoid-generated
# depend on Depend files. But if you just added a Depend file to an
# existing directory not in all-subdirs, then sysd-sorted needs to
# be regenerated, so it depends on existing $(sorted-subdirs:=/Depend) files.
-all-Depend-files := $(wildcard $(sort \
- $(foreach dir,$(all-subdirs), \
- $(firstword $($(dir)-srcdir) \
- $(..)$(dir))/Depend) \
- $(sorted-subdirs:=/Depend)))
+all-Depend-files := \
+ $(wildcard $(sort \
+ $(foreach dir,$(all-subdirs), \
+ $(firstword $($(dir)-srcdir) \
+ $(..)$(dir))/Depend) \
+ $(sorted-subdirs:=/Depend)))
$(common-objpfx)sysd-sorted: $(..)scripts/gen-sorted.awk \
$(common-objpfx)config.make $(..)Makeconfig \
$(wildcard $(sysdirs:=/Subdirs)) \
@@ -1393,7 +1681,11 @@ endif
# emitted into sysd-rules. A sysdeps Makeconfig fragment can
# add its own special object file prefix to this list with e.g. foo-%:%
# to have foo-*.? compiled from *.? using $(foo-CPPFLAGS).
-sysd-rules-patterns := %:% rtld-%:rtld-% rtld-%:% m_%:s_%
+sysd-rules-patterns := \
+ %:% \
+ rtld-%:rtld-% \
+ rtld-%:% \
+ m_%:s_%
# Let sysdeps/ subdirs contain a Makeconfig fragment for us to include here.
sysdep-makeconfigs := $(wildcard $(+sysdep_dirs:=/Makeconfig))
@@ -1434,10 +1726,13 @@ test-xfail-name = $(strip $(patsubst %.out, %, $(patsubst $(objpfx)%, %, $@)))
# Command to output a test status line (such as PASS: test-name). If
# test-xfail-$(test-xfail-name) has a nonempty value, the status will be
# XPASS or XFAIL rather than PASS or FAIL.
-evaluate-test = $(..)scripts/evaluate-test.sh $(test-name) $$? \
- $(if $(test-xfail-$(test-xfail-name)),true,false) \
- $(if $(stop-on-test-failure),true,false) \
- > $(common-objpfx)$(test-name).test-result
+evaluate-test = \
+ $(..)scripts/evaluate-test.sh \
+ $(test-name) \
+ $$? \
+ $(if $(test-xfail-$(test-xfail-name)),true,false) \
+ $(if $(stop-on-test-failure),true,false) \
+ > $(common-objpfx)$(test-name).test-result
endif # Makeconfig not yet included
After this change, patches will be more clear about what they change, as they won't need to reflow lines. Cc: Adhemerval Zanella Netto <adhemerval.zanella@linaro.org> Signed-off-by: Alejandro Colomar <alx@kernel.org> --- Makeconfig | 617 +++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 456 insertions(+), 161 deletions(-)