-# Copyright (C) 1991-1999,2000 Free Software Foundation, Inc.
+# Copyright (C) 1991-2000,01,02, 03 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
# The GNU C Library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Library General Public License as
-# published by the Free Software Foundation; either version 2 of the
-# License, or (at your option) any later version.
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
# The GNU C Library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Library General Public License for more details.
+# Lesser General Public License for more details.
-# You should have received a copy of the GNU Library General Public
-# License along with the GNU C Library; see the file COPYING.LIB. If not,
-# write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-# Boston, MA 02111-1307, USA.
+# 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.
#
# Makefile configuration options for the GNU C library.
endif
# Complete path to sysdep dirs.
-export full-config-sysdirs := $(addprefix $(..),$(config-sysdirs))
+export full_config_sysdirs := $(addprefix $(..),$(config-sysdirs))
# Run config.status to update config.make and config.h. We don't show the
# dependence of config.h to Make, because it is only touched when it
# Find all the sysdeps configure fragments, to make sure we re-run
# configure when any of them changes.
$(common-objpfx)config.status: $(..)version.h $(..)configure \
- $(foreach dir,$(full-config-sysdirs),\
+ $(foreach dir,$(full_config_sysdirs),\
$(wildcard \
$(dir)/Implies) \
$(patsubst %.in,%,\
####
-# Set this to either `stdio' or `libio', to compile in either GNU stdio
-# or GNU libio.
-ifndef stdio
-stdio = stdio
-endif
-
# Common prefix for machine-independent installation directories.
ifeq ($(origin prefix),undefined) # ifndef would override explicit empty value.
prefix = /usr/local
# Where to install the header files.
ifndef includedir
-includedir = $(exec_prefix)/include
+includedir = $(prefix)/include
endif
inst_includedir = $(install_root)$(includedir)
ifndef INSTALL_DATA
INSTALL_DATA = $(INSTALL) -m 644
endif
+ifndef INSTALL_SCRIPT
+INSTALL_SCRIPT = $(INSTALL)
+endif
ifndef INSTALL_PROGRAM
INSTALL_PROGRAM = $(INSTALL)
endif
# Default flags to pass the C compiler.
ifndef default_cflags
+ifeq ($(release),stable)
+default_cflags := -g -O2
+else
default_cflags := -g -O
endif
+endif
# Flags to pass the C compiler when assembling preprocessed assembly code
# (`.S' files). On some systems the assembler doesn't understand the `#' line
static-start-installed-name = $(start-installed-name)
endif
+ifeq (yesyesyes,$(build-shared)$(elf)$(have-z-combreloc))
+combreloc-LDFLAGS = -Wl,-z,combreloc
+LDFLAGS.so += $(combreloc-LDFLAGS)
+LDFLAGS-rtld += $(combreloc-LDFLAGS)
+endif
+
# Command for linking programs with the C library.
ifndef +link
+link = $(CC) -nostdlib -nostartfiles -o $@ \
$(sysdep-LDFLAGS) $(config-LDFLAGS) $(LDFLAGS) $(LDFLAGS-$(@F)) \
+ $(combreloc-LDFLAGS) \
$(addprefix $(csu-objpfx),$(start-installed-name)) \
$(+preinit) $(+prector) \
$(filter-out $(addprefix $(csu-objpfx),start.o \
$(common-objpfx)libc% $(+postinit),$^) \
$(link-extra-libs-static) $(link-libc-static) $(+postctor) $(+postinit)
endif
+# Command for statically linking bounded-pointer programs with the C library.
+ifndef +link-bounded
++link-bounded = $(CC) -nostdlib -nostartfiles -static -fbounded-pointers -o $@ \
+ $(sysdep-LDFLAGS) $(LDFLAGS) \
+ $(addprefix $(csu-objpfx),b$(static-start-installed-name)) \
+ $(+preinit) $(+prector) \
+ $(filter-out $(addprefix $(csu-objpfx),start.ob \
+ $(start-installed-name))\
+ $(+preinit) $(link-extra-libs-bounded) \
+ $(common-objpfx)libc% $(+postinit),$^) \
+ $(link-extra-libs-bounded) $(link-libc-bounded) $(+postctor) $(+postinit)
+endif
ifndef config-LDFLAGS
-ifeq (yes,$(build-shared))
+ifeq (yesyes,$(build-shared)$(elf))
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.
$(common-objpfx)$(patsubst %,$(libtype.oS),c) $(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
+else
+ifneq (,$(filter aix aix%,$(config-os)))
+link-libc = $(common-objpfx)libc.a \
+ $(common-objpfx)$(patsubst %,$(libtype.oS),c) $(gnulib)
+rpath-dirs = math dlfcn nss nis rt resolv crypt
+endif
+endif
rpath-link = \
$(common-objdir):$(subst $(empty) ,:,$(patsubst ../$(subdir),.,$(rpath-dirs:%=$(common-objpfx)%)))
elfobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)elf)
endif
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
+else
+ifneq (,$(filter aix aix%,$(config-os)))
+LDFLAGS-rpath-ORIGIN =
+LDFLAGS-soname-fname =
+LDFLAGS-rdynamic = -Wl,-bdynamic
+LDFLAGS-Bsymbolic = -Wl,-bsymbolic
+endif
+endif
+
# Choose the default search path for the dynamic linker based on
# where we will install libraries.
ifneq ($(libdir),$(slibdir))
link-extra-libs-static = $(link-extra-libs)
endif
endif
+link-libc-bounded = $(common-objpfx)libc_b.a $(gnulib) $(common-objpfx)libc_b.a
+link-extra-libs-bounded = $(foreach lib,$(LDLIBS-$(@F:%-bp=%)),$(common-objpfx)$(lib)_b.a)
ifndef gnulib
gnulib := -lgcc
# 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,$^))
-ifneq (yes,$(build-shared))
-built-program-cmd = $(built-program-file)
-else
+ifeq (yesyes,$(build-shared)$(elf))
comma = ,
sysdep-library-path = \
$(subst $(empty) ,:,$(strip $(patsubst -Wl$(comma)-rpath-link=%, %,\
$(filter -Wl$(comma)-rpath-link=%,\
$(sysdep-LDFLAGS)))))
-define built-program-cmd
-$(elf-objpfx)$(rtld-installed-name) \
- --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
- $(built-program-file)
-endef
+run-program-prefix = $(if $(filter $(notdir $(built-program-file)),\
+ $(tests-static)),, \
+ $(elf-objpfx)$(rtld-installed-name) \
+ --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)))
+else
+run-program-prefix =
endif
+# Never use $(run-program-prefix) for the statically-linked %-bp test programs
+built-program-cmd = $(patsubst %,$(run-program-prefix),\
+ $(filter-out %-bp,$(built-program-file))) \
+ $(built-program-file)
ifndef LD
LD := ld -X
endif
# Extra flags to pass to GCC.
+ifeq ($(all-warnings),yes)
++gccwarn := -Wall -Wwrite-strings -Winline -Wstrict-prototypes -Wcast-qual -Wbad-function-cast -Wmissing-noreturn -Wmissing-prototypes -Wmissing-declarations -Wcomment -Wcomments -Wtrigraphs -Wsign-compare -Wfloat-equal -Wmultichar
+else
+gccwarn := -Wall -Wwrite-strings -Winline -Wstrict-prototypes
+endif
-# This is the program that generates makefile
-# dependencies from C source files.
+# 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.
ifndef +mkdep
-+mkdep = $(CC) -M
++mkdep = $(CC) -M -MP
endif
# The program that makes Emacs-style TAGS files.
-ETAGS := etags -T
+ETAGS := etags
# The `m4' macro processor; this is used by sysdeps/sparc/Makefile (and
# perhaps others) to preprocess assembly code in some cases.
# `+sysdep-includes' will be defined by Makerules.
+includes = -I$(..)include -I. \
$(patsubst %/,-I%,$(objpfx)) $(patsubst %/,-I%,$(..)) \
- $($(stdio)-include) $(includes) \
- $(+sysdep-includes) $(last-includes) $(sysincludes)
+ $(libio-include) $(includes) \
+ $(+sysdep-includes) $(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
# These are the variables that the implicit compilation rules use.
+# 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) \
-include $(..)include/libc-symbols.h $(sysdep-CPPFLAGS) \
- $(CPPFLAGS-$(suffix $@)) $(CPPFLAGS-$(<F)) $(CPPFLAGS-$(@F))
-override CFLAGS = $(filter-out %frame-pointer,$(+cflags)) $(sysdep-CFLAGS) \
+ $(CPPFLAGS-$(suffix $@)) \
+ $(foreach lib,$(libof-$(basename $(@F))) \
+ $(libof-$(<F)) $(libof-$(@F)),$(CPPFLAGS-$(lib))) \
+ $(CPPFLAGS-$(<F)) $(CPPFLAGS-$(@F)) $(CPPFLAGS-$(basename $(@F)))
+override CFLAGS = -std=gnu99 \
+ $(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
# Under --enable-shared, we will build a shared library of PIC objects.
# The PIC object files are named foo.os.
object-suffixes += .os
-CPPFLAGS-.os = -DPIC
+CPPFLAGS-.os = -DPIC -DSHARED
CFLAGS-.os = $(filter %frame-pointer,$(+cflags)) $(pic-ccflag)
libtype.os := lib%_pic.a
# This can be changed by a sysdep makefile
libtype.op = lib%_p.a
endif
ifeq (yes,$(build-omitfp))
-# Under --enable-omitfp, we build an the library optimized without
+# 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
CFLAGS-.os += -g0 -O99 -fomit-frame-pointer -D__USE_STRING_INLINES
libtype.og = lib%_g.a
endif
+
+bppfx = BP-
ifeq (yes,$(build-bounded))
# Under --enable-bounded, we build the library with `-fbounded-pointers -g'
# to runtime bounds checking. The bounded-pointer objects are named foo.ob.
+# We disable sibling-call optimizations so that stack traces will be complete
+# and thus aid debugging, since after all, BPs are a debugging tool.
object-suffixes += .ob
-CPPFLAGS-.ob = -DBOUNDED_POINTERS $(pic-default)
-CFLAGS-.ob = -g -fbounded-pointers
+CPPFLAGS-.ob = -fbounded-pointers $(pic-default)
+CFLAGS-.ob = -g -O2 -fno-optimize-sibling-calls -fno-strict-aliasing
libtype.ob = lib%_b.a
endif
# 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)
-CPPFLAGS-.oS = $(CPPFLAGS-.o) -DPIC
+CPPFLAGS-.oS = $(CPPFLAGS-.o) -DPIC -DLIBC_NONSHARED=1
libtype.oS = lib%_nonshared.a
endif
+# The assembler can generate debug information too.
+ifndef ASFLAGS
+ifeq ($(have-cpp-asm-debuginfo),yes)
+ASFLAGS := $(filter -g%,$(CFLAGS))
+endif
+endif
+gnu-stabs = $(shell echo>&2 '*** BARF ON ME')
ifeq (yes, $(build-shared))
+# This is a pair of implicit rules to preprocess a file with # comments,
+# %ifdef et al, based on config.h settings or other %include'd files.
+# We use chained rules instead of a pipeline here so that we can properly
+# check the exit status of cpp rather than using its bad output when there
+# is a preprocessing error. Another rule should depend on the output file
+# `FOO.v', and along with that `FOO.v.i' should be given dependencies
+# listing both its input files, and any header files that it may reference
+# (but no commands).
+%.v.i: $(common-objpfx)config.h
+ sed '/^[ ]*#/d;s/^[ ]*%/#/' $(filter-out FORCE %.h,$^) \
+ | $(CC) -E -undef $(CPPFLAGS) \
+ -DASSEMBLER -x assembler-with-cpp - \
+ > $@T
+ mv -f $@T $@
+%.v: %.v.i
+ sed '/^[ ]*#/d;/^[ ]*$$/d' $< > $@T
+ mv -f $@T $@
+
# 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.
ifeq ($(sysd-sorted-done),t)
-include $(common-objpfx)soversions.mk
ifndef avoid-generated
-$(common-objpfx)soversions.i: $(..)shlib-versions $(..)Makeconfig \
- $(wildcard $(patsubst %, $(..)%/shlib-versions,\
- $(add-ons) \
- $(subdirs))) \
- $(common-objpfx)config.make
- sed -e 's/#.*$$//;s/^[ ]*%/#/' \
- $(filter-out $(..)Makeconfig $(common-objpfx)config.make,$^) \
- | $(CC) -E -undef -include $(common-objpfx)config.h -x c - \
- | while read conf version setname; do \
- test -n "$$version" && \
- test `expr '$(config-machine)-$(config-vendor)-$(config-os)' \
- : "$$conf"` != 0 || continue; \
+$(common-objpfx)shlib-versions.v.i: \
+ $(..)shlib-versions $(wildcard $(patsubst %, $(..)%/shlib-versions,\
+ $(add-ons) \
+ $(subdirs)))
+$(common-objpfx)soversions.i: $(common-objpfx)shlib-versions.v
+ default_setname='$(filter-out %_default,$(oldest-abi:%=GLIBC_%))'; \
+ while read conf version setname; do \
+ test -n "$$version" && \
+ test `expr '$(config-machine)-$(config-vendor)-$(config-os)' \
+ : "$$conf"` != 0 || continue; \
+ if test "x$$version" = xDEFAULT; then \
+ default_setname="$$setname"; \
+ else \
+ $(abi-default_setname) \
lib=`echo $$version | sed 's/=.*$$//'`; \
- number=`echo $$version | sed "s/^.*=//"`; \
- echo $$lib $$number $$setname; \
- done > $@T; exit 0
+ if eval test -z "\$${versioned_$${lib}}"; then \
+ eval versioned_$${lib}=yes; \
+ number=`echo $$version | sed "s/^.*=//"`; \
+ echo $$lib $$number $${setname:-$${default_setname}}; \
+ fi; \
+ fi; \
+ done < $< > $@T; exit 0
mv -f $@T $@
$(common-objpfx)soversions.mk: $(common-objpfx)soversions.i
- while read lib number setname; do \
- case $$number in \
- [0-9]*) echo "$$lib.so-version=.$$number"; \
- echo "all-sonames+=$$lib.so\$$($$lib.so-version)";;\
- *) echo "$$lib.so-version=$$number"; \
- echo "all-sonames+=\$$($$lib.so-version)";;\
- esac; \
- done < $< > $@T; exit 0
+ (while read lib number setname; do \
+ 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 "all-sonames+=$$lib=\$$($$lib.so-version)";;\
+ esac; \
+ done; \
+ echo soversions.mk-done = t;) < $< > $@T; exit 0
mv -f $@T $@
endif
endif
-postclean-generated += soversions.mk
+postclean-generated += soversions.mk soversions.i \
+ shlib-versions.v shlib-versions.v.i
# Generate the header containing the names of all shared libraries.
# We use a stamp file to avoid uncessary recompilations.
before-compile += $(common-objpfx)gnu/lib-names.h
+ifeq ($(soversions.mk-done),t)
$(common-objpfx)gnu/lib-names.h: $(common-objpfx)gnu/lib-names.stmp; @:
+ifneq (,$(findstring aix,$(config-os)))
+$(common-objpfx)gnu/lib-names.stmp: $(..)sysdeps/unix/sysv/aix/gnu/lib-names.h
+ $(make-target-directory)
+ @rm -f ${@:stmp=T} $@
+ @cp $(..)sysdeps/unix/sysv/aix/gnu/lib-names.h $(common-objpfx)gnu
+ touch $@
+else
$(common-objpfx)gnu/lib-names.stmp: $(common-objpfx)soversions.mk
$(make-target-directory)
@rm -f ${@:stmp=T} $@
echo; \
(libs='$(all-sonames)';\
for l in $$libs; do \
- upname=`echo $$l | sed 's/[.]so.*//' | \
+ name=`echo $$l | sed 's/.*=//'`; \
+ upname=`echo $$l | sed 's/=.*//' | \
tr 'abcdefghijklmnopqrstuvwxyz-' \
'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'`; \
- echo "#define $${upname}_SO \"$$l\""; \
+ upname2=`echo $$name | sed 's/[.]so.*//' | \
+ tr 'abcdefghijklmnopqrstuvwxyz-' \
+ 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'`; \
+ echo "#define $${upname}_SO \"$$name\""; \
+ if test $$upname != $$upname2; then \
+ echo "#define $${upname2}_SO \"$$name\""; \
+ fi; \
done;) | sort; \
echo; \
echo '#endif /* gnu/lib-names.h */';) > ${@:stmp=T}
$(move-if-change) ${@:stmp=T} ${@:stmp=h}
touch $@
+endif
+endif
common-generated += gnu/lib-names.h gnu/lib-names.stmp
endif # build-shared
-ifneq (,$(findstring linuxthreads,$(add-ons)))
-shared-thread-library = $(common-objpfx)linuxthreads/libpthread.so
-static-thread-library = $(common-objpfx)linuxthreads/libpthread.a
-have-thread-library = yes
-rpath-dirs += linuxthreads
-endif
ifeq ($(elf),yes)
dlfcn = dlfcn
libdl = $(common-objpfx)dlfcn/libdl.a
endif
else
-# No ELF - no libdl, at least for now.
+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
+else
+# No ELF, no AIX - no libdl, at least for now.
dlfcn =
libdl =
endif
+endif
# These are the subdirectories containing the library source. The order
# is more or less arbitrary. The sorting step will take care of the
# dependencies. Only the $(binfmt-subdir) should always be kept at the
# end of the list.
all-subdirs = csu assert ctype locale intl catgets math setjmp signal \
- stdlib stdio-common $(stdio) malloc string wcsmbs time dirent \
+ 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 po argp \
- crypt $(add-ons) nss localedata timezone rt debug \
+ crypt $(add-ons) nss localedata timezone rt conform debug \
$(sysdep-subdirs) $(dlfcn) $(binfmt-subdir)
all-subdirs := $(filter-out $(sysdep-inhibit-subdirs),$(all-subdirs))
mv -f $@-tmp $@
endif
+# Let sysdeps/ subdirs contain a Makeconfig fragment for us to include here.
+sysdep-makeconfigs := $(wildcard $(patsubst %,$(..)%/Makeconfig,\
+ $(config-sysdirs) $(add-ons)))
+
+ifneq (,$(sysdep-makeconfigs))
+include $(sysdep-makeconfigs)
+endif
+
+
endif # Makeconfig not yet included
+
+# Local Variables:
+# mode: makefile
+# End: