-# Copyright (C) 1991-2003,2004,2005,2006,2007,2008,2009,2010,2011
+# Copyright (C) 1991-2003,2004,2005,2006,2007,2008,2009,2010,2011,2012
# Free Software Foundation, Inc.
# This file is part of the GNU C Library.
# Lesser General Public License for more details.
# You should have received a copy of the GNU Lesser General Public
-# License along with the GNU C Library; if not, write to the Free
-# Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-# 02111-1307 USA.
+# License along with the GNU C Library; if not, see
+# <http://www.gnu.org/licenses/>.
#
# Makefile configuration options for the GNU C library.
# We have a special subdir for each binary format.
# For now, only ELF is fully supported.
-ifeq ($(elf),yes)
binfmt-subdir = elf
-else
-# This is probably better than nothing.
-binfmt-subdir = aout
-endif
# Complete path to sysdep dirs.
# `configure' writes a definition of `config-sysdirs' in `config.make'.
endif
inst_vardbdir = $(install_root)$(vardbdir)
-# What timezone should be the installed default (e.g., US/Eastern).
-# Run `make -C time echo-zonenames' to see a list of available zone names.
-# The local timezone can be changed with `zic -l TIMEZONE' at any time.
-ifndef localtime
-localtime = Factory
-endif
-
# Where to install the "localtime" timezone file; this is the file whose
# contents $(localtime) specifies. If this is a relative pathname, it is
# relative to $(zonedir). It is a good idea to put this somewhere
# localizing the configuration data elsewhere.
ifndef localtime-file
localtime-file = $(sysconfdir)/localtime
-inst_localtime-file = $(install_root)$(localtime-file)
endif
# What to use for leap second specifications in compiling the default
asm-CPPFLAGS =
endif
-# ELF always supports init/fini sections
-ifeq ($(elf),yes)
-have-initfini = yes
-endif
-
-ifeq ($(have-as-needed),yes)
as-needed := -Wl,--as-needed
no-as-needed := -Wl,--no-as-needed
-else
-as-needed :=
-no-as-needed :=
-endif
# Must be supported by the linker.
no-whole-archive = -Wl,--no-whole-archive
whole-archive = -Wl,--whole-archive
# Installed name of the startup code.
-ifneq ($(have-initfini),yes)
-# When not having init/fini, there is just one startfile, called crt0.o.
-start-installed-name = crt0.o
-else
-# On systems having init/fini, crt0.o is called crt1.o, and there are
-# some additional bizarre files.
+# The ELF convention is that the startfile is called crt1.o
start-installed-name = crt1.o
-endif
# On systems that do not need a special startfile for statically linked
# binaries, simply set it to the normal name.
ifndef static-start-installed-name
static-start-installed-name = $(start-installed-name)
endif
-ifeq (yesyesyes,$(build-shared)$(elf)$(have-z-combreloc))
+ifeq (yesyes,$(build-shared)$(have-z-combreloc))
combreloc-LDFLAGS = -Wl,-z,combreloc
LDFLAGS.so += $(combreloc-LDFLAGS)
LDFLAGS-rtld += $(combreloc-LDFLAGS)
$(link-extra-libs-bounded) $(link-libc-bounded) $(+postctor) $(+postinit)
endif
ifndef config-LDFLAGS
-ifeq (yesyes,$(build-shared)$(elf))
+ifeq (yes,$(build-shared))
config-LDFLAGS = -Wl,-dynamic-linker=$(slibdir)/$(rtld-installed-name)
endif
endif
ifndef link-libc
ifeq (yes,$(build-shared))
-ifeq ($(elf),yes)
# We need the versioned name of libc.so in the deps of $(others) et al
# so that the symlink to libc.so is created before anything tries to
# run the linked programs.
$(as-needed) $(common-objpfx)elf/ld.so $(no-as-needed) $(gnulib)
# This is how to find at build-time things that will be installed there.
rpath-dirs = math elf dlfcn nss nis rt resolv crypt
-endif
rpath-link = \
$(common-objdir):$(subst $(empty) ,:,$(patsubst ../$(subdir),.,$(rpath-dirs:%=$(common-objpfx)%)))
elfobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)elf)
endif
# Differences in the linkers on the various platforms.
-ifeq ($(elf),yes)
LDFLAGS-rpath-ORIGIN = -Wl,-rpath,'$$ORIGIN'
LDFLAGS-soname-fname = -Wl,-soname,$(@F)
LDFLAGS-rdynamic = -rdynamic
LDFLAGS-Bsymbolic = -Bsymbolic
-endif
# Choose the default search path for the dynamic linker based on
# where we will install libraries.
endif
# The static libraries.
-ifeq (yes,$(build-static))
link-libc-static = -Wl,--start-group $(common-objpfx)libc.a $(static-gnulib) -Wl,--end-group
-else
-ifeq (yes,$(build-shared))
-# We can try to link the programs with lib*_pic.a...
-link-libc-static = $(static-gnulib) $(common-objpfx)libc_pic.a
-endif
-endif
link-libc-bounded = $(common-objpfx)libc_b.a $(gnulib) $(common-objpfx)libc_b.a
ifndef gnulib
else
libunwind = -lunwind
endif
-ifneq ($(have-as-needed),yes)
- libgcc_eh := -lgcc_eh $(libunwind)
-else
- libgcc_eh := -Wl,--as-needed -lgcc_s$(libgcc_s_suffix) $(libunwind) -Wl,--no-as-needed
-endif
+libgcc_eh := -Wl,--as-needed -lgcc_s $(libunwind) -Wl,--no-as-needed
gnulib := -lgcc $(libgcc_eh)
static-gnulib := -lgcc -lgcc_eh $(libunwind)
libc.so-gnulib := -lgcc
endif
-ifeq ($(elf),yes)
+preinit = $(addprefix $(csu-objpfx),crti.o)
+postinit = $(addprefix $(csu-objpfx),crtn.o)
+prector = `$(CC) $(sysdep-LDFLAGS) --print-file-name=crtbegin.o`
+prectorS = `$(CC) $(sysdep-LDFLAGS) --print-file-name=crtbeginS.o`
+postctorS = `$(CC) $(sysdep-LDFLAGS) --print-file-name=crtendS.o`
+interp = $(addprefix $(elf-objpfx),interp.os)
-endif
csu-objpfx = $(common-objpfx)csu/
elf-objpfx = $(common-objpfx)elf/
# 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,$^))
-ifeq (yesyes,$(build-shared)$(elf))
+ifeq (yes,$(build-shared))
comma = ,
sysdep-library-path = \
$(subst $(empty) ,:,$(strip $(patsubst -Wl$(comma)-rpath-link=%, %,\
# actually different, so allow the compiler to merge them all.
+merge-constants = -fmerge-all-constants
+# We have to assume that glibc functions are called in any rounding
+# mode and also change the rounding mode in a few functions. So,
+# disable any optimization that assume default rounding mode.
++math-flags = -frounding-math
+
# This is the program that generates makefile dependencies from C source files.
# The -MP flag tells GCC >= 3.2 (which we now require) to produce dummy
# targets for headers so that removed headers don't break the build.
+cflags := $(default_cflags)
endif # $(+cflags) == ""
-+cflags += $(cflags-cpu) $(+gccwarn) $(+merge-constants)
++cflags += $(cflags-cpu) $(+gccwarn) $(+merge-constants) $(+math-flags)
+gcc-nowarn := -w
# Don't duplicate options if we inherited variables from the parent.
# 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 = $($(subdir)-CPPFLAGS) $(+includes) $(defines) \
+CPPFLAGS = $(CPPUNDEFS) $(CPPFLAGS-config) $($(subdir)-CPPFLAGS) \
+ $(+includes) $(defines) \
-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)))
-override CFLAGS = -std=gnu99 $(gnu89-inline-CFLAGS) \
+override CFLAGS = -std=gnu99 $(gnu89-inline-CFLAGS) $(config-extra-cflags) \
$(filter-out %frame-pointer,$(+cflags)) $(+gccwarn-c) \
$(sysdep-CFLAGS) $(CFLAGS-$(suffix $@)) $(CFLAGS-$(<F)) \
$(CFLAGS-$(@F)) \
object-suffixes :=
CPPFLAGS-.o = $(pic-default)
CFLAGS-.o = $(filter %frame-pointer,$(+cflags))
-ifeq (yes,$(build-static))
libtype.o := lib%.a
object-suffixes += .o
-endif
ifeq (yes,$(build-shared))
# Under --enable-shared, we will build a shared library of PIC objects.
# The PIC object files are named foo.os.
CFLAGS-.op = -pg
libtype.op = lib%_p.a
endif
-ifeq (yes,$(build-omitfp))
-# Under --enable-omitfp, we build the library optimized without
-# debugging information using -fomit-frame-pointer, and build an extra
-# library with debugging information. The debuggable objects are named foo.og.
-object-suffixes += .og
-CPPFLAGS-.og = $(pic-default)
-CFLAGS-.og = -g
-CFLAGS-.o = $(filter %frame-pointer,$(+cflags)) -g0 -O99 -fomit-frame-pointer -D__USE_STRING_INLINES
-CFLAGS-.os += -g0 -O99 -fomit-frame-pointer -D__USE_STRING_INLINES
-libtype.og = lib%_g.a
-endif
+
+# Convenience variable for when we want to treat shared-library cases
+# differently from the rest.
+object-suffixes-noshared := $(filter-out .os,$(object-suffixes))
bppfx = BP-
ifeq (yes,$(build-bounded))
sed '/^[ ]*#/d;/^[ ]*$$/d' $< > $@T
mv -f $@T $@
+# To generate a header to support more than one ABI for different
+# architecture variants, the CPU/Makefile defines abi-variants to be a
+# list of names for those variants (e.g. 32 64), and, for each variant,
+# defines abi-$(variant)-condition to be the condition for those options
+# to use in a C #if condition. abi-includes may be defined to a list of
+# headers to include in the generated header, if the default does not
+# suffice. default-abi is defined to be the ABI for the current glibc
+# build.
+
+ifndef abi-includes
+abi-includes := bits/wordsize.h
+endif
+
# Process the shlib-versions file, which tells us what shared library
# version numbers to use when we install shared objects on this system.
# We need to wait until $(subdirs) is complete.
-f $^ > $@T
mv -f $@T $@
$(common-objpfx)soversions.mk: $(common-objpfx)soversions.i $(..)Makeconfig
- (seen_DEFAULT=0; seen_WORDSIZE32=0; seen_WORDSIZE64=0; \
- while read which lib number setname; do \
+ (while read which lib number setname; do \
eval seen_$$which=1; \
test x"$$which" != xABI || echo abi-name = "$$lib"; \
test x"$$which" = xDEFAULT || continue; \
case $$number in \
[0-9]*) echo "$$lib.so-version=.$$number"; \
echo "all-sonames+=$$lib=$$lib.so\$$($$lib.so-version)";;\
- *) echo "$$lib.so-version=$$number"; \
+ *) echo "$$lib.so-version=\$$(if \$$(abi-$(default-abi)-$$lib-soname),\$$(abi-$(default-abi)-$$lib-soname),$$number)"; \
echo "all-sonames+=$$lib=\$$($$lib.so-version)";;\
esac; \
done; \
- case "$$seen_DEFAULT$$seen_WORDSIZE32$$seen_WORDSIZE64" in \
- 100) echo biarch = no;; \
- 101) echo biarch = 32;; \
- ?1?) echo biarch = 64;; \
- *) echo >&2 BUG; exit 2;; \
- esac; \
echo soversions.mk-done = t;) < $< > $@T; exit 0
mv -f $@T $@
endif
$(common-objpfx)gnu/lib-names.stmp: $(..)scripts/lib-names.awk \
$(common-objpfx)soversions.i
$(make-target-directory)
- @rm -f ${@:stmp=T} $@
- LC_ALL=C $(AWK) -f $^ > ${@:stmp=T}
+ { \
+ echo '/* This file is automatically generated.';\
+ echo ' It defines macros to allow user program to find the shared'; \
+ echo ' library files which come as part of GNU libc. */'; \
+ echo '#ifndef __GNU_LIB_NAMES_H'; \
+ echo '#define __GNU_LIB_NAMES_H 1'; \
+ echo ''; \
+ $(if $(abi-includes), \
+ $(foreach h,$(abi-includes), echo '#include <$(h)>';) \
+ echo '';) \
+ $(if $(abi-variants), \
+ $(foreach v,$(abi-variants),\
+ $(if $(abi-$(v)-condition),\
+ echo '#if $(abi-$(v)-condition)'; \
+ ($(foreach s,$(all-sonames), \
+ $(if $(abi-$(v)-$(firstword $(subst =, ,$(s)))-soname),\
+ echo $(firstword $(subst =, ,$(s)))=$(abi-$(v)-$(firstword $(subst =, ,$(s)))-soname);, \
+ echo $(s);))) \
+ | LC_ALL=C $(AWK) -v multi=1 -f $(firstword $^) | LC_ALL=C sort;) \
+ $(if $(abi-$(v)-condition),echo '#endif';)), \
+ ($(foreach s,$(all-sonames), echo $(s);)) \
+ | LC_ALL=C $(AWK) -f $(firstword $^) | LC_ALL=C sort;) \
+ echo ''; \
+ echo '#endif /* gnu/lib-names.h */'; \
+ } > ${@:stmp=T}
$(move-if-change) ${@:stmp=T} ${@:stmp=h}
touch $@
endif
endif # build-shared
-ifeq ($(elf),yes)
dlfcn = dlfcn
ifeq ($(build-shared),yes)
libdl = $(common-objpfx)dlfcn/libdl.so$(libdl.so-version)
else
libdl = $(common-objpfx)dlfcn/libdl.a
endif
-else
-ifneq (,$(findstring aix,$(config-os)))
+
ifeq ($(build-shared),yes)
-dlfcn = dlfcn
-libdl = $(common-objpfx)dlfcn/libdl.so$(libdl.so-version)
-else
-# No libdl without shared libs on AIX
-dlfcn =
-libdl =
-endif
+libm = $(common-objpfx)math/libm.so$(libm.so-version)
else
-# No ELF, no AIX - no libdl, at least for now.
-dlfcn =
-libdl =
-endif
+libm = $(common-objpfx)math/libm.a
endif
# These are the subdirectories containing the library source. The order