]> sourceware.org Git - glibc.git/blobdiff - Makeconfig
* io/tst-fchownat.c: Correctly handle _POSIX_CHOWN_RESTRICTED
[glibc.git] / Makeconfig
index 26884f82d2fb4a9fdd4506f746e5d6394da57b5a..d269936f323001871a19b15b6d8d37c6a59c334c 100644 (file)
@@ -1,20 +1,21 @@
-# Copyright (C) 1991-2000, 2001 Free Software Foundation, Inc.
+# Copyright (C) 1991-2003,2004,2005,2006,2007,2008
+#      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.
@@ -83,6 +84,12 @@ export sysdep_dir := $(sysdep_dir)
 # Get the values defined by options to `configure'.
 include $(common-objpfx)config.make
 
+# What flags to give to sources which call user provided callbacks
+uses-callbacks = $(exceptions)
+
+# What flags to give to tests which test stack alignment
+stack-align-test-flags =
+
 # We have a special subdir for each binary format.
 # For now, only ELF is fully supported.
 ifeq ($(elf),yes)
@@ -93,7 +100,21 @@ binfmt-subdir = aout
 endif
 
 # Complete path to sysdep dirs.
-export full_config_sysdirs := $(addprefix $(..),$(config-sysdirs))
+# `configure' writes a definition of `config-sysdirs' in `config.make'.
+sysdirs := $(foreach D,$(config-sysdirs),$(firstword $(filter /%,$D) $(..)$D))
+
+# Add-ons that contribute sysdeps trees get added to the include list
+# after sysdeps/generic.  This makes #include <sysdeps/...> work right
+# to find specific add-on files without assuming the add-on directory name.
+# It also means that headers can go into an add-on's base directory
+# instead of the add-on needing a sysdeps/generic of its own.
+sysdeps-srcdirs := $(foreach add-on,$(sysdeps-add-ons),\
+                            $(firstword $(filter /%,$(add-on)) \
+                                        $(..)$(add-on)))
++sysdep_dirs = $(sysdirs) $(sysdeps-srcdirs)
+ifdef objdir
++sysdep_dirs := $(objdir) $(+sysdep_dirs)
+endif
 
 # 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
@@ -104,15 +125,19 @@ $(common-objpfx)config.make: $(common-objpfx)config.status \
                             $(..)config.make.in $(..)config.h.in
        cd $(<D); $(SHELL) $(<F)
 
-# Find all the sysdeps configure fragments, to make sure we re-run
-# configure when any of them changes.
+# Find all the add-on and 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),\
-                                        $(wildcard \
-                                          $(dir)/Implies) \
+                              $(foreach dir,$(sysdirs),\
+                                        $(wildcard $(dir)/Implies) \
                                         $(patsubst %.in,%,\
                                                    $(firstword $(wildcard \
- $(addprefix $(dir)/,configure configure.in)))))
+ $(addprefix $(dir)/,configure configure.in))))) \
+                              $(patsubst %.in,%,\
+                                         $(foreach add-on,$(add-ons),\
+                                                   $(firstword $(wildcard \
+ $(addprefix $(firstword $(filter /%,$(add-on)) $(..)$(add-on))/,\
+            configure configure.in)))))
        @cd $(@D); if test -f $(@F); then exec $(SHELL) $(@F) --recheck; else \
         echo The GNU C library has not been configured. >&2; \
         echo Run \`configure\' to configure it before building. >&2; \
@@ -139,12 +164,6 @@ endif
 ####
 
 
-# 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
@@ -188,7 +207,7 @@ endif
 
 # Where to install the header files.
 ifndef includedir
-includedir = $(exec_prefix)/include
+includedir = $(prefix)/include
 endif
 inst_includedir = $(install_root)$(includedir)
 
@@ -322,6 +341,9 @@ endif
 ifndef INSTALL_DATA
 INSTALL_DATA = $(INSTALL) -m 644
 endif
+ifndef INSTALL_SCRIPT
+INSTALL_SCRIPT = $(INSTALL)
+endif
 ifndef INSTALL_PROGRAM
 INSTALL_PROGRAM = $(INSTALL)
 endif
@@ -380,10 +402,30 @@ ifndef static-start-installed-name
 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
+
+relro-LDFLAGS = -Wl,-z,relro
+LDFLAGS.so += $(relro-LDFLAGS)
+LDFLAGS-rtld += $(relro-LDFLAGS)
+
+ifeq (yes,$(have-hash-style))
+# For the time being we unconditionally use 'both'.  At some time we
+# should declare statically linked code as 'out of luck' and compile
+# with --hash-style=gnu only.
+hashstyle-LDFLAGS = -Wl,--hash-style=both
+LDFLAGS.so += $(hashstyle-LDFLAGS)
+LDFLAGS-rtld += $(hashstyle-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) $(relro-LDFLAGS) $(hashstyle-LDFLAGS) \
              $(addprefix $(csu-objpfx),$(start-installed-name)) \
              $(+preinit) $(+prector) \
              $(filter-out $(addprefix $(csu-objpfx),start.o \
@@ -395,7 +437,7 @@ endif
 # Command for statically linking programs with the C library.
 ifndef +link-static
 +link-static = $(CC) -nostdlib -nostartfiles -static -o $@ \
-             $(sysdep-LDFLAGS) $(LDFLAGS)  \
+             $(sysdep-LDFLAGS) $(LDFLAGS) $(LDFLAGS-$(@F))  \
              $(addprefix $(csu-objpfx),$(static-start-installed-name)) \
              $(+preinit) $(+prector) \
              $(filter-out $(addprefix $(csu-objpfx),start.o \
@@ -417,12 +459,13 @@ ifndef +link-bounded
              $(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.
@@ -431,6 +474,7 @@ link-libc = -Wl,-rpath-link=$(rpath-link) \
            $(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
+endif
 rpath-link = \
 $(common-objdir):$(subst $(empty) ,:,$(patsubst ../$(subdir),.,$(rpath-dirs:%=$(common-objpfx)%)))
 elfobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)elf)
@@ -441,6 +485,14 @@ link-libc = $(common-objpfx)libc.a $(otherlibs) $(gnulib) $(common-objpfx)libc.a
 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
+endif
+
 # Choose the default search path for the dynamic linker based on
 # where we will install libraries.
 ifneq ($(libdir),$(slibdir))
@@ -450,35 +502,36 @@ default-rpath = $(libdir)
 endif
 
 ifndef link-extra-libs
-ifeq (yes,$(build-shared))
-ifneq ($(common-objpfx),$(objpfx))
-link-extra-libs = $(foreach lib,$(LDLIBS-$(@F)),\
-       $(wildcard $(common-objpfx)$(lib).so$($(notdir $(lib)).so-version) \
-                  $(objpfx)$(lib).so$($(notdir $(lib)).so-version)))
-else
-link-extra-libs = $(foreach lib,$(LDLIBS-$(@F)),$(common-objpfx)$(lib).so$($(notdir $(lib)).so-version))
-endif
-else
-link-extra-libs = $(foreach lib,$(LDLIBS-$(@F)),$(common-objpfx)$(lib).a)
-endif
+link-extra-libs = $(LDLIBS-$(@F))
+link-extra-libs-static = $(link-extra-libs)
+link-extra-libs-bounded = $(link-extra-libs)
 endif
 
 # The static libraries.
 ifeq (yes,$(build-static))
-link-libc-static = $(common-objpfx)libc.a $(gnulib) $(common-objpfx)libc.a
-link-extra-libs-static = $(foreach lib,$(LDLIBS-$(@F)),$(common-objpfx)$(lib).a)
+link-libc-static = $(common-objpfx)libc.a $(static-gnulib) $(common-objpfx)libc.a
 else
 ifeq (yes,$(build-shared))
 # We can try to link the programs with lib*_pic.a...
-link-libc-static = $(gnulib) $(common-objpfx)libc_pic.a
-link-extra-libs-static = $(link-extra-libs)
+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
-link-extra-libs-bounded = $(foreach lib,$(LDLIBS-$(@F:%-bp=%)),$(common-objpfx)$(lib)_b.a)
 
 ifndef gnulib
-gnulib := -lgcc
+ifneq ($(have-cc-with-libunwind),yes)
+  libunwind =
+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
+gnulib := -lgcc $(libgcc_eh)
+static-gnulib := -lgcc -lgcc_eh $(libunwind)
+libc.so-gnulib := -lgcc
 endif
 ifeq ($(elf),yes)
 +preinit = $(addprefix $(csu-objpfx),crti.o)
@@ -493,13 +546,14 @@ 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 (yes,$(build-shared))
+ifeq (yesyes,$(build-shared)$(elf))
 comma = ,
 sysdep-library-path = \
 $(subst $(empty) ,:,$(strip $(patsubst -Wl$(comma)-rpath-link=%, %,\
                                       $(filter -Wl$(comma)-rpath-link=%,\
                                                $(sysdep-LDFLAGS)))))
-run-program-prefix = $(if $(findstring $(notdir $(built-program-file)), $(tests-static)),, \
+run-program-prefix = $(if $(filter $(notdir $(built-program-file)),\
+                                  $(tests-static) $(xtests-static)),, \
                          $(elf-objpfx)$(rtld-installed-name) \
                          --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)))
 else
@@ -520,20 +574,31 @@ 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
++gccwarn := -Wall -Wwrite-strings -Winline -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
++gccwarn := -Wall -Wwrite-strings -Winline
 endif
++gccwarn-c = -Wstrict-prototypes
+
+# We do not depend on the address of constants in different files to be
+# actually different, so allow the compiler to merge them all.
++merge-constants = -fmerge-all-constants
 
-# 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
 
+# The `xgettext' program for producing .pot files from sources.
+ifndef XGETTEXT
+XGETTEXT = xgettext
+endif
+
 # The `m4' macro processor; this is used by sysdeps/sparc/Makefile (and
 # perhaps others) to preprocess assembly code in some cases.
 M4 = m4
@@ -578,32 +643,43 @@ ifeq      "$(strip $(+cflags))" ""
 +cflags        := $(default_cflags)
 endif  # $(+cflags) == ""
 
-+cflags := $(+cflags) $(+gccwarn)
++cflags += $(addprefix -mcpu=,$(with-cpu)) $(+gccwarn) $(+merge-constants)
 +gcc-nowarn := -w
 
 # Don't duplicate options if we inherited variables from the parent.
 +cflags        := $(sort $(+cflags))
 
 
-# These are flags given to the C compiler to tell it to look for include
-# files (including ones given in angle brackets) in the current directory,
-# in the parent library source directory and in the include directory.
-# `+sysdep-includes' will be defined by Makerules.
-+includes = -I$(..)include -I. \
-           $(patsubst %/,-I%,$(objpfx)) $(patsubst %/,-I%,$(..)) \
-           $($(stdio)-include) $(includes) \
-           $(+sysdep-includes) $(last-includes) $(sysincludes)
+# These are flags given to the C compiler to tell it to look for
+# include files (including ones given in angle brackets) in the parent
+# library source directory, in the include directory, and in the
+# current directory.
++sysdep-includes = $(addprefix -I,$(+sysdep_dirs))
++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
 
 # 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) \
-                 $(CFLAGS-$(suffix $@)) $(CFLAGS-$(<F)) $(CFLAGS-$(@F))
+          $(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) \
+                 $(filter-out %frame-pointer,$(+cflags)) $(+gccwarn-c) \
+                 $(sysdep-CFLAGS) $(CFLAGS-$(suffix $@)) $(CFLAGS-$(<F)) \
+                 $(CFLAGS-$(@F))
+override CXXFLAGS = $(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.
@@ -633,6 +709,8 @@ CFLAGS-.os = $(filter %frame-pointer,$(+cflags)) $(pic-ccflag)
 libtype.os := lib%_pic.a
 # This can be changed by a sysdep makefile
 pic-ccflag = -fPIC
+# This one should always stay like this unless there is a very good reason.
+PIC-ccflag = -fPIC
 endif
 ifeq (yes,$(build-profile))
 # Under --enable-profile, we will build a static library of profiled objects.
@@ -675,13 +753,20 @@ 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)
-CPPFLAGS-.oS = $(CPPFLAGS-.o) -DPIC
+CFLAGS-.oS = $(CFLAGS-.o) $(PIC-ccflag)
+CPPFLAGS-.oS = $(CPPFLAGS-.o) -DPIC -DLIBC_NONSHARED=1
 libtype.oS = lib%_nonshared.a
 endif
 
-
-+gnu-stabs = $(shell echo>&2 '*** BARF ON ME')
+# The assembler can generate debug information too.
+ifndef ASFLAGS
+ifeq ($(have-cpp-asm-debuginfo),yes)
+ASFLAGS := $(filter -g%,$(CFLAGS))
+else
+ASFLAGS :=
+endif
+endif
+ASFLAGS += $(ASFLAGS-config)
 
 ifndef BUILD_CC
 BUILD_CC = $(CC)
@@ -689,24 +774,29 @@ endif
 
 move-if-change = $(SHELL) $(..)scripts/move-if-change
 \f
--include $(common-objpfx)sysd-dirs
-
-ifeq ($(sysd-dirs-done),t)
 -include $(common-objpfx)sysd-sorted
 subdirs = $(sorted-subdirs)
-endif
+subdir-srcdirs = $(foreach dir,$(subdirs),\
+                          $(firstword $($(dir)-srcdir) $(..)$(dir)))
 
 ifeq (yes, $(build-shared))
 
-# Commands to put in a pipeline to preprocess a file with # comments
-# %ifdef et al based on config.h settings or other %include'd files.
-define preprocess-versions
-sed '/^[       ]*#/d;s/^[      ]*%/#/' \
-| $(CC) -E -undef -I$(common-objdir) -I$(..)include \
-                 -include $(common-objpfx)config.h \
-                 -x assembler-with-cpp - \
-| sed '/^[     ]*#/d;/^[       ]*$$/d'
-endef
+# 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) -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.
@@ -714,31 +804,29 @@ endef
 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
-       cat $(filter-out $(..)Makeconfig $(common-objpfx)config.make,$^) \
-       | $(preprocess-versions) \
-       | 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 \
-             lib=`echo $$version | sed 's/=.*$$//'`; \
-             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
+# This lets add-ons give more-specific matches that override defaults
+# in the top-level file.
+$(common-objpfx)shlib-versions.v.i: \
+       $(wildcard $(+sysdep_dirs:=/shlib-versions) \
+                  $(subdir-srcdirs:=/shlib-versions)) \
+       $(..)shlib-versions
+
+soversions-default-setname = $(patsubst %, %,\
+                                       $(filter-out %_default,\
+                                                    $(oldest-abi:%=GLIBC_%)))
+$(common-objpfx)soversions.i: $(..)scripts/soversions.awk \
+                             $(common-objpfx)shlib-versions.v
+       $(AWK) -v default_setname='$(soversions-default-setname)' \
+              -v cpu='$(config-machine)' \
+              -v vendor='$(config-vendor)' \
+              -v os='$(config-os)' \
+              -f $^ > $@T
        mv -f $@T $@
-$(common-objpfx)soversions.mk: $(common-objpfx)soversions.i
-       (while read lib number setname; do \
+$(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 \
+          eval seen_$$which=1; \
+          test x"$$which" = xDEFAULT || continue; \
           case $$number in \
             [0-9]*) echo "$$lib.so-version=.$$number"; \
                     echo "all-sonames+=$$lib=$$lib.so\$$($$lib.so-version)";;\
@@ -746,43 +834,30 @@ $(common-objpfx)soversions.mk: $(common-objpfx)soversions.i
                     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
 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.
+# We use a stamp file to avoid unnecessary 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; @:
-$(common-objpfx)gnu/lib-names.stmp: $(common-objpfx)soversions.mk
+$(common-objpfx)gnu/lib-names.stmp: $(..)scripts/lib-names.awk \
+                                   $(common-objpfx)soversions.i
        $(make-target-directory)
        @rm -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; \
-        (libs='$(all-sonames)';\
-         for l in $$libs; do \
-           name=`echo $$l | sed 's/.*=//'`; \
-           upname=`echo $$l | sed 's/=.*//' | \
-                   tr 'abcdefghijklmnopqrstuvwxyz-' \
-                      'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'`; \
-           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}
+       LC_ALL=C $(AWK) -f $^ > ${@:stmp=T}
        $(move-if-change) ${@:stmp=T} ${@:stmp=h}
        touch $@
 endif
@@ -815,70 +890,66 @@ else
 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.
+# dependencies.
 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 conform debug     \
-             $(sysdep-subdirs) $(dlfcn) $(binfmt-subdir)
-all-subdirs := $(filter-out $(sysdep-inhibit-subdirs),$(all-subdirs))
-
-# The mach and hurd subdirectories have many generated header files which
-# much of the rest of the library depends on, so it is best to build them
-# first (and mach before hurd, at that).  The before-compile additions in
-# sysdeps/{mach,hurd}/Makefile should make it reliably work for these files
-# not to exist when making in other directories, but it will be slower that
-# way with more somewhat expensive `make' invocations.
-subdirs        := $(filter mach,$(subdirs)) $(filter hurd,$(subdirs)) \
-          $(filter-out mach hurd,$(subdirs))
+             crypt nss localedata timezone rt conform debug                \
+             $(add-on-subdirs) $(dlfcn) $(binfmt-subdir)
 
 ifndef avoid-generated
-all-Subdirs-files = $(wildcard $(config-sysdirs:%=$(..)%/Subdirs))
-$(common-objpfx)sysd-dirs: $(common-objpfx)config.make $(all-Subdirs-files)
-       $(AWK) 'BEGIN { subdirs = ""; inhibit = "" };                   \
-               /^#/ { next };                                          \
-               /^[^-]/ { subdirs = subdirs " " $$0 };                  \
-               /^-/ { inhibit = inhibit " " substr($$0, 2) };          \
-               END { printf "sysdep-subdirs =%s\n", subdirs;           \
-                     printf "sysdep-inhibit-subdirs =%s\n", inhibit;   \
-                     print "sysd-dirs-done = t" }'                     \
-              $(patsubst $<,/dev/null,$^) > $@-tmp
-       mv -f $@-tmp $@
-
-all-Depend-files = $(wildcard $(..)*/Depend)
-$(common-objpfx)sysd-sorted: $(..)scripts/gen-sorted.awk $(all-Depend-files) \
-                            $(common-objpfx)sysd-dirs $(..)Makeconfig
-       { { dirs='$(patsubst $(..)%/Depend,$(..)%,$(filter %/Depend,$^))';\
-           for d in $$dirs; do                                           \
-             while read on; do                                           \
-               echo "depend $$d $$on";                                   \
-             done < $$d/Depend;                                          \
-           done;                                                         \
-           for f in $(all-subdirs); do                                   \
-             echo $$f;                                                   \
-           done;                                                         \
-         } | $(AWK) -f $< &&                                             \
-         echo sysd-sorted-done = t;                                      \
-       } > $@-tmp
+all-Depend-files := $(wildcard $(foreach dir,$(all-subdirs),\
+                                        $(firstword $($(dir)-srcdir) \
+                                                    $(..)$(dir))/Depend))
+$(common-objpfx)sysd-sorted: $(..)scripts/gen-sorted.awk \
+                            $(common-objpfx)config.make $(..)Makeconfig \
+                            $(wildcard $(sysdirs:=/Subdirs)) \
+                            $(all-Depend-files)
+       $(AWK) -f $< \
+              -v subdirs='$(all-subdirs)' \
+              -v srcpfx='$(..)' \
+              $(filter %/Subdirs %/Depend,$^) > $@-tmp
        mv -f $@-tmp $@
+$(all-Depend-files): ;
 endif
 
-# Let sysdeps/ subdirs contain a Makeconfig fragment for us to include here.
-sysdep-makeconfigs := $(wildcard $(patsubst %,$(..)%/Makeconfig,\
-                                           $(config-sysdirs) $(add-ons)))
+# This gives partial TARGET:SOURCE pattern pairs to have rules
+# 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-%:% m_%:s_%
 
+# Let sysdeps/ subdirs contain a Makeconfig fragment for us to include here.
+sysdep-makeconfigs := $(wildcard $(+sysdep_dirs:=/Makeconfig))
 ifneq (,$(sysdep-makeconfigs))
 include $(sysdep-makeconfigs)
 endif
 
+# Compute just the target patterns.  Makeconfig has set sysd-rules-patterns.
+sysd-rules-targets := $(foreach p,$(sysd-rules-patterns),\
+                               $(firstword $(subst :, ,$p)))
 
 endif # Makeconfig not yet included
+
+# Local Variables:
+# mode: makefile
+# End:
This page took 0.045567 seconds and 5 git commands to generate.