-# Copyright (C) 1991-1999,2000,01,02 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 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
-# 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.
-
-#
-# Common rules for making the GNU C library. This file is included
-# by the top-level Makefile and by all subdirectory makefiles
-# (through Rules).
-#
-ifneq (,)
-This makefile requires GNU Make.
-endif
-
-REQUIRED_MAKE_VERSION = 3.74
-REAL_MAKE_VERSION = $(firstword $(MAKE_VERSION))
-
-ifneq ($(REQUIRED_MAKE_VERSION), \
- $(firstword $(sort $(REAL_MAKE_VERSION) $(REQUIRED_MAKE_VERSION))))
-Wrong GNU Make version. See above for the version needed.
-endif
-
-
-ifdef subdir
-.. := ../
-endif # subdir
-
-# If `sources' was defined by the parent makefile, undefine it so
-# we will later get it from wildcard search in this directory.
-ifneq "$(findstring env,$(origin sources))" ""
-sources :=
-endif
-
-oPATH := $(PATH)
-PATH := this definition should take precedence over $(oPATH)
-ifeq ($(PATH),$(oPATH))
-You must not use the -e flag when building the GNU C library.
-else
-PATH := $(oPATH)
-endif
-\f
-ifndef +included-Makeconfig
-include $(..)Makeconfig
-endif
-
-# `configure' writes a definition of `config-sysdirs' in `config.make'.
-sysdirs = $(strip $(full_config_sysdirs))
-
-+sysdir_pfx = $(common-objpfx)
-
-export sysdirs := $(sysdirs)
-
-+sysdep_dirs := $(full_config_sysdirs)
-ifdef objdir
-+sysdep_dirs := $(objdir) $(+sysdep_dirs)
-endif
-
-# Add -I switches to get the right sysdep directories.
-# `+includes' in Makeconfig references $(+sysdep-includes).
-+sysdep-includes := $(addprefix -I,$(+sysdep_dirs))
-
-# This variable is used in ``include $(o-iterator)'' after defining
-# $(o-iterator-doit) to produce some desired rule using $o for the object
-# suffix, and setting $(object-suffixes-left) to $(object-suffixes); a copy
-# is produced for each object suffix in use.
-o-iterator = $(patsubst %,$(..)o-iterator.mk,$(object-suffixes-left))
-\f
-# Include any system-specific makefiles.
-
-# This is here so things in sysdep Makefiles can easily depend on foo.h as
-# appropriate and not worry about where foo.h comes from, which may be
-# system dependent and not known by that Makefile.
-vpath %.h $(subst $(empty) ,:,$(strip $(common-objpfx) $(objpfx) \
- $(+sysdep_dirs) $(..)))
-
-# The same is true for RPC source files.
-vpath %.x $(subst $(empty) ,:,$(strip $(common-objpfx) $(objpfx) \
- $(+sysdep_dirs) $(..)))
-
-# Some sysdep makefiles use this to distinguish being included here from
-# being included individually by a subdir makefile (hurd/Makefile needs this).
-in-Makerules := yes
-
-sysdep-makefiles := $(wildcard $(full_config_sysdirs:=/Makefile))
-ifneq (,$(sysdep-makefiles))
-include $(sysdep-makefiles)
-endif
-
-
-# Reorder before-compile so that mach things come first, and hurd things
-# second, before all else. The mach and hurd subdirectories have many
-# generated header files which the much of rest of the library depends on,
-# so it is best to build them first (and mach before hurd, at that).
-before-compile := $(filter $(common-objpfx)mach% $(common-objpfx)hurd%,\
- $(before-compile)) \
- $(filter-out $(common-objpfx)mach% $(common-objpfx)hurd%,\
- $(before-compile))
-
-# Even before that, we need abi-versions.h which is generated right here.
-ifeq ($(versioning),yes)
-ifndef avoid-generated
-before-compile := $(common-objpfx)abi-versions.h $(before-compile)
-$(common-objpfx)abi-versions.h: $(..)scripts/abi-versions.awk \
- $(common-objpfx)Versions.all
- LC_ALL=C $(AWK) -v oldest_abi=$(oldest-abi) -f $^ > $@T
- mv -f $@T $@
-
-$(common-objpfx)%.latest: $(common-objpfx)abi-versions.h
- sed -n '/ VERSION_$*_/{s/^.*_\([A-Z0-9_]*\).*$$/\1/;h;};$${g;p;}' \
- $(common-objpfx)abi-versions.h > $@T
- mv -f $@T $@
-endif # avoid-generated
-endif # $(versioning) = yes
-
-# When we have no deps pass doing it, then make sure the subdirectory
-# for object files gets created.
-ifdef no_deps
-ifdef objpfx
-before-compile += $(objpfx).
-$(objpfx).:
- $(make-target-directory)
-endif
-endif
-
-# Remove existing files from `before-compile'. Things are added there when
-# they must exist for dependency generation to work right, but once they
-# exist there is no further need for every single file to depend on them,
-# and those gratuitous dependencies result in many gratuitous
-# recompilations.
-before-compile := $(filter-out $(wildcard $(before-compile)),$(before-compile))
-
-# Don't let any before-compile file be an intermediate and get removed.
-ifdef before-compile
-$(before-compile):
-endif
-
-# If a makefile needs to do something conditional on something that
-# can only be figured out from headers, write a FOO.make.c input
-# file that uses cpp contructs and contains @@@ LINE @@@ for each LINE
-# to emit in the generated makefile, and use -include $(common-objpfx)FOO.make.
-$(common-objpfx)%.make: $(..)%.make.c $(..)Makerules
- rm -f $@T $@.dT
- (echo '# Generated from $*.make.c by Makerules.'; \
- SUNPRO_DEPENDENCIES='$@.dT $$(common-objpfx)$*.make' \
- $(CC) $(CFLAGS) $(CPPFLAGS) -E $< \
- | sed -n '/@@@/{s/@@@[ ]*\(.*\)@@@/\1/;s/[ ]*$$//p;}'; \
- echo 'common-generated += $(@F)'; \
- cat $@.dT; rm -f $@.dT) > $@T
- mv -f $@T $@
-\f
-# Generate an ordered list of implicit rules which find the source files in
-# each sysdep directory. The old method was to use vpath to search all the
-# sysdep directories. However, that had the problem that a .S file in a
-# later directory would be chosen over a .c file in an earlier directory,
-# which does not preserve the desired sysdeps ordering behavior.
-
-# When making the list of .d files to include, we can't know which ones
-# have source in .s files, and thus do not in fact need a .d file.
-# So we must define rules to make .d files for .s files.
-define make-dummy-dep
-$(addprefix ln $(common-objpfx)dummy.d ,$(filter-out $(wildcard $@),$@))
-endef
-$(common-objpfx)dummy.d:
- echo '# .s files cannot contain includes, so they need no deps.' > $@
-
-# It matters that this set of rules, for compiling from sources in
-# the current directory (the $srcdir/$subdir) come before the
-# generated sysdep rules in included from sysd-rules below. When
-# compiling in the source tree, generated sources go into the current
-# directory, and those should be chosen before any sources in sysdeps.
-define o-iterator-doit
-$(objpfx)%$o: %.S $(before-compile); $$(compile-command.S)
-endef
-object-suffixes-left := $(all-object-suffixes)
-include $(o-iterator)
-$(objpfx)%.d: %.S $(before-compile); $(+make-deps)
-
-define o-iterator-doit
-$(objpfx)%$o: %.s $(before-compile); $$(compile-command.s)
-endef
-object-suffixes-left := $(all-object-suffixes)
-include $(o-iterator)
-$(objpfx)%.d: %.s $(common-objpfx)dummy.d; $(make-dummy-dep)
-
-define o-iterator-doit
-$(objpfx)%$o: %.c $(before-compile); $$(compile-command.c)
-endef
-object-suffixes-left := $(all-object-suffixes)
-include $(o-iterator)
-$(objpfx)%.d: %.c $(before-compile); $(+make-deps)
-
-# Omit the objpfx rules when building in the source tree, because
-# objpfx is empty and so these rules just override the ones above.
-ifdef objpfx
-# Define first rules to find the source files in $(objpfx).
-# Generated source files will end up there.
-define o-iterator-doit
-$(objpfx)%$o: $(objpfx)%.S $(before-compile); $$(compile-command.S)
-endef
-object-suffixes-left := $(all-object-suffixes)
-include $(o-iterator)
-$(objpfx)%.d: $(objpfx)%.S $(before-compile); $(+make-deps)
-
-define o-iterator-doit
-$(objpfx)%$o: $(objpfx)%.s $(before-compile); $$(compile-command.s)
-endef
-object-suffixes-left := $(all-object-suffixes)
-include $(o-iterator)
-$(objpfx)%.d: $(objpfx)%.s $(common-objpfx)dummy.d; $(make-dummy-dep)
-
-define o-iterator-doit
-$(objpfx)%$o: $(objpfx)%.c $(before-compile); $$(compile-command.c)
-endef
-object-suffixes-left := $(all-object-suffixes)
-include $(o-iterator)
-$(objpfx)%.d: $(objpfx)%.c $(before-compile); $(+make-deps)
-endif
-
-# System-dependent makefiles can put in `inhibit-sysdep-asm' wildcard
-# patterns matching sysdep directories whose assembly source files should
-# be suppressed.
-ifdef inhibit-sysdep-asm
-define open-check-inhibit-asm
-case $$sysdir in $(subst $(empty) ,|,$(inhibit-sysdep-asm))) : ;; *)
-endef
-close-check-inhibit-asm = ;; esac ;
-endif
-
--include $(+sysdir_pfx)sysd-rules
-ifneq ($(sysd-rules-sysdirs),$(config-sysdirs))
-# The value of $(+sysdep_dirs) the sysd-rules was computed for
-# differs from the one we are using now. So force a rebuild of sysd-rules.
-sysd-rules-force = FORCE
-FORCE:
-endif
-$(+sysdir_pfx)sysd-rules: $(+sysdir_pfx)config.make $(..)Makerules \
- $(wildcard $(foreach dir,$(sysdirs),\
- $(dir)/Makefile))\
- $(sysd-rules-force)
- -@rm -f $@T
- (echo 'sysd-rules-sysdirs := $(config-sysdirs)'; \
- for dir in $(config-sysdirs:%='$$(..)%'); do \
- for o in $(all-object-suffixes); do \
- $(open-check-inhibit-asm) \
- echo "\$$(objpfx)%$$o: $$dir/%.S \$$(before-compile); \
- \$$(compile-command.S)"; \
- echo "\$$(objpfx)%$$o: $$dir/%.s \$$(before-compile); \
- \$$(compile-command.s)"; \
- echo "\$$(objpfx)rtld-%$$o: $$dir/%.S \$$(before-compile); \
- \$$(compile-command.S)"; \
- echo "\$$(objpfx)rtld-%$$o: $$dir/%.s \$$(before-compile); \
- \$$(compile-command.s)"; \
- $(close-check-inhibit-asm) \
- echo "\$$(objpfx)%$$o: $$dir/%.c \$$(before-compile); \
- \$$(compile-command.c)"; \
- echo "\$$(objpfx)rtld-%$$o: $$dir/%.c \$$(before-compile); \
- \$$(compile-command.c)"; \
- done; \
- $(open-check-inhibit-asm) \
- echo "\$$(objpfx)%.d: $$dir/%.s \$$(common-objpfx)dummy.d; \
- \$$(make-dummy-dep)"; \
- echo "\$$(objpfx)rtld-%.d: $$dir/%.s \$$(common-objpfx)dummy.d; \
- \$$(make-dummy-dep)"; \
- echo "\$$(objpfx)%.d: $$dir/%.S \$$(before-compile); \
- \$$(+make-deps)"; \
- echo "\$$(objpfx)rtld-%.d: $$dir/%.S \$$(before-compile); \
- \$$(+make-deps)"; \
- $(close-check-inhibit-asm) \
- echo "\$$(objpfx)%.d: $$dir/%.c \$$(before-compile); \
- \$$(+make-deps)"; \
- echo "\$$(objpfx)rtld-%.d: $$dir/%.c \$$(before-compile); \
- \$$(+make-deps)"; \
- echo "\$$(objpfx)m_%.S: $$dir/s_%.S; \$$(+make-include-of-dep)"; \
- echo "\$$(objpfx)m_%.c: $$dir/s_%.c; \$$(+make-include-of-dep)"; \
- done; \
- echo 'sysd-rules-done = t') > $@T
- mv -f $@T $@
-
-ifndef sysd-rules-done
-# Don't do deps until this exists, because it provides rules to make the deps.
-no_deps=t
-endif
-
-# This is used by the m_%.[Sc] pattern rules in sysd-rules.
-define +make-include-of-dep
-echo '#include <$<>' > $@T
-mv -f $@T $@
-endef
-
-# Generate version maps, but wait until sysdep-subdirs is known
-ifeq ($(sysd-sorted-done),t)
-ifeq ($(versioning),yes)
--include $(common-objpfx)sysd-versions
-$(addprefix $(common-objpfx),$(version-maps)): $(common-objpfx)sysd-versions
-common-generated += $(version-maps)
-postclean-generated += sysd-versions Versions.all abi-versions.h \
- Versions.def.v.i Versions.def.v Versions.v.i Versions.v
-
-ifndef avoid-generated
-ifneq ($(sysd-versions-subdirs),$(all-subdirs) $(config-sysdirs))
-sysd-versions-force = FORCE
-FORCE:
-endif
-# See %.v/%.v.i implicit rules in Makeconfig.
-$(common-objpfx)Versions.def.v.i: $(..)Versions.def \
- $(wildcard $(add-ons:%=$(..)%/Versions.def))
-$(common-objpfx)Versions.all: $(..)scripts/firstversions.awk \
- $(common-objpfx)soversions.i \
- $(common-objpfx)Versions.def.v
- { while read lib version setname; do \
- test -z "$$setname" || echo "$$lib : $$setname"; \
- done < $(word 2,$^); \
- cat $(word 3,$^); \
- } | LC_ALL=C $(AWK) -f $< > $@T
- mv -f $@T $@
-# See %.v/%.v.i implicit rules in Makeconfig.
-$(common-objpfx)Versions.v.i: $(wildcard $(all-subdirs:%=$(..)%/Versions)) \
- $(wildcard $(sysdirs:%=%/Versions)) \
- $(common-objpfx)abi-versions.h \
- $(sysd-versions-force)
-$(common-objpfx)sysd-versions: $(common-objpfx)Versions.all \
- $(common-objpfx)Versions.v \
- $(..)scripts/versions.awk
- ( echo 'sysd-versions-subdirs = $(all-subdirs) $(config-sysdirs)' ; \
- cat $(word 2,$^) \
- | LC_ALL=C $(AWK) -v buildroot=$(common-objpfx) -v defsfile=$< \
- -v move_if_change='$(move-if-change)' \
- -f $(word 3,$^); \
- ) > $@T
- mv -f $@T $@
-endif # avoid-generated
-endif # $(versioning) = yes
-endif # sysd-sorted-done
-
-
-ifndef compile-command.S
-compile-command.S = $(compile.S) $(OUTPUT_OPTION)
-endif
-ifndef compile-command.s
-compile-command.s = $(COMPILE.s) $< $(OUTPUT_OPTION)
-endif
-ifndef compile-command.c
-compile-command.c = $(compile.c) $(OUTPUT_OPTION)
-endif
-
-# GCC can grok options after the file name, and it looks nicer that way.
-compile.c = $(CC) $< -c $(CFLAGS) $(CPPFLAGS)
-compile.S = \
- $(CC) $< -c $(CPPFLAGS) -DASSEMBLER $(asm-CPPFLAGS) $(ASFLAGS-$(suffix $@))
-COMPILE.S = \
- $(CC) -c $(CPPFLAGS) -DASSEMBLER $(asm-CPPFLAGS) $(ASFLAGS-$(suffix $@))
-COMPILE.s = $(filter-out -pipe,$(CC)) -c $(ASFLAGS)
-
-# If we want to generate MD5 checksums for the sources do this now.
-ifeq ($(md5),yes)
-generate-md5 = ; rm -f $(@:.d=.md5); \
-$(CC) -E $< $(CFLAGS) $(CPPFLAGS) $($(<:$*.%=%)-CPPFLAGS) | \
-sed '/^\#/d;/^[[:space:]]*$$/d' | md5sum > $(@:.d=.md5)
-else
-generate-md5 =
-endif
-
-# We need this for the output to go in the right place. It will default to
-# empty if make was configured to work with a cc that can't grok -c and -o
-# together. You can't compile the C library with such a compiler.
-OUTPUT_OPTION = -o $@
-
-# We need the $(CFLAGS) to be in there to have the right predefines during
-# the dependency run for C sources. But having it for assembly sources can
-# get the wrong predefines.
-S-CPPFLAGS = $(asm-CPPFLAGS)
-define +make-deps
-$(make-target-directory)
-$(+mkdep) $< $(if $(filter %.c,$<),$(CFLAGS)) \
- $(CPPFLAGS) $($(<:$*.%=%)-CPPFLAGS) | sed \
--e 's,$(subst .,\.,$*)\.o,$(foreach o,$(all-object-suffixes),$(@:.d=$o)) $@,' \
-$(sed-remove-objpfx) > $(@:.d=.T)
-mv -f $(@:.d=.T) $@ $(generate-md5)
-endef
-ifneq (,$(objpfx))
-# Continuation lines here are dangerous because they introduce spaces!
-define sed-remove-objpfx
--e 's@ $(subst .,\.,$(subst @,\@,$(common-objpfx)))@ $$(common-objpfx)@g' \
--e 's@^$(subst .,\.,$(subst @,\@,$(common-objpfx)))@$$(common-objpfx)@g'
-endef
-endif
-\f
-# Modify the list of routines we build for different targets
-
-ifeq (yesyes,$(build-shared)$(elf))
-ifndef libc.so-version
-# Undefine this because it can't work when we libc.so is unversioned.
-static-only-routines =
-endif
-endif
-
-# Bounded pointer thunks are only built for *.ob
-elide-bp-thunks = $(addprefix $(bppfx),$(bp-thunks))
-
-elide-routines.oS += $(filter-out $(static-only-routines),\
- $(routines) $(aux) $(sysdep_routines)) \
- $(elide-bp-thunks)
-elide-routines.os += $(static-only-routines) $(elide-bp-thunks)
-
-# If we have versioned code we don't need the old versions in any of the
-# static libraries.
-elide-routines.o += $(shared-only-routines) $(elide-bp-thunks)
-elide-routines.op += $(shared-only-routines) $(elide-bp-thunks)
-elide-routines.og += $(shared-only-routines) $(elide-bp-thunks)
-elide-routines.ob += $(shared-only-routines)
-\f
-# Shared library building.
-
-ifeq (yes,$(build-shared))
-
-# Reference map file only when versioning is selected and a map file name
-# is given.
-ifeq ($(versioning),yes)
-map-file = $(firstword $($(@F:.so=-map)) \
- $(addprefix $(common-objpfx), \
- $(filter $(@F:.so=.map),$(version-maps))))
-load-map-file = $(map-file:%=-Wl,--version-script=%)
-endif
-
-# Pattern rule to build a shared object from an archive of PIC objects.
-# This must come after the installation rules so Make doesn't try to
-# build shared libraries in place from the installed *_pic.a files.
-# $(LDLIBS-%.so) may contain -l switches to generate run-time dependencies
-# on other shared objects.
-lib%.so: lib%_pic.a $(+preinit) $(+postinit) $(+interp)
-ifneq (,$(findstring aix,$(config-os)))
- (echo '#!'; \
- dump -g $< | sed '1,6d' | cut -f2 | sort | uniq) > $(<:a=exp)
-endif
- $(build-shlib)
-
-ifeq ($(elf),yes)
-define build-shlib-helper
-$(LINK.o) -shared $(static-libgcc) -Wl,-O1 $(sysdep-LDFLAGS) $(config-LDFLAGS) \
- $(extra-B-$(@F:lib%.so=%).so) -B$(csu-objpfx) \
- $(extra-B-$(@F:lib%.so=%).so) $(load-map-file) \
- -Wl,-soname=lib$(libprefix)$(@F:lib%.so=%).so$($(@F)-version) \
- $(LDFLAGS.so) $(LDFLAGS-$(@F:lib%.so=%).so) \
- -L$(subst :, -L,$(rpath-link)) -Wl,-rpath-link=$(rpath-link)
-endef
-else
-ifneq (,$(findstring aix,$(config-os)))
-define build-shlib-helper
-$(LINK.o) -Wl,-G,-bM:SRE,-bnoentry,-bE:$(<:a=exp) \
- $(sysdep-LDFLAGS) $(config-LDFLAGS) $(extra-B-$(@F:lib%.so=%).so) \
- $(extra-B-$(@F:lib%.so=%).so) $(load-map-file) \
- $(LDFLAGS.so) $(LDFLAGS-$(@F:lib%.so=%).so) \
- -L$(subst :, -L,$(rpath-link))
-endef
-else
-endif
-endif
-
-ifeq (yes,$(elf))
-# binutils only position loadable notes into the first page for binaries,
-# not for shared objects
-define build-shlib
-$(build-shlib-helper) \
- -o $@.new $(csu-objpfx)abi-note.o -Wl,--verbose \
- $(LDLIBS-$(@F:lib%.so=%).so) 2>&1 | \
- sed -e '/^=========/,/^=========/!d;/^=========/d' \
- -e 's/^.*\.hash[ ]*:.*$$/ .note.ABI-tag : { *(.note.ABI-tag) } &/' \
- $(LDSEDCMD-$(@F:lib%.so=%).so) > $@.lds
-rm -f $@.new
-$(build-shlib-helper) -o $@ -T $@.lds \
- $(csu-objpfx)abi-note.o $(build-shlib-objlist)
-rm -f $@.lds
-endef
-else
-ifneq (,$(findstring aix,$(config-os)))
-define build-shlib
-$(build-shlib-helper) \
- -o $@ \
- $(filter-out $(map-file) $(+preinit) $(+postinit),$^) \
- $(no-whole-archive) $(LDLIBS-$(@F:lib%.so=%).so)
-endef
-define build-shlib
-$(build-shlib-helper) \
- $(build-shlib-objlist)
-endef
-endif
-endif
-
-ifneq (,$(findstring aix,$(config-os)))
-define build-module-helper
-$(LINK.o) -Wl,-G -Wl,-bM:SRE -Wl,-bnoentry -Wl,-bexpall \
- $(sysdep-LDFLAGS) $(config-LDFLAGS) \
- $(load-map-file) \
- $(LDFLAGS.so) $(LDFLAGS-$(@F:%.so=%).so) \
- -L$(subst :, -L,$(rpath-link)) -Wl,-L=$(rpath-link)
-endef
-else
-define build-module-helper
-$(LINK.o) -shared $(static-libgcc) $(sysdep-LDFLAGS) $(config-LDFLAGS) \
- -B$(csu-objpfx) $(load-map-file) \
- $(LDFLAGS.so) $(LDFLAGS-$(@F:%.so=%).so) \
- -L$(subst :, -L,$(rpath-link)) -Wl,-rpath-link=$(rpath-link)
-endef
-endif
-
-# This macro is similar to build-shlib but it does not define a soname
-# and it does not depend on the destination name to start with `lib'.
-ifeq (yes,$(elf))
-# binutils only position loadable notes into the first page for binaries,
-# not for shared objects
-define build-module
-$(build-module-helper) \
- -o $@.new $(csu-objpfx)abi-note.o -Wl,--verbose \
- $(LDLIBS-$(@F:lib%.so=%).so) 2>&1 | \
- sed -e '/^=========/,/^=========/!d;/^=========/d' \
- -e 's/^.*\.hash[ ]*:.*$$/ .note.ABI-tag : { *(.note.ABI-tag) } &/' \
- > $@.lds
-rm -f $@.new
-$(build-module-helper) -o $@ -T $@.lds \
- $(csu-objpfx)abi-note.o $(build-module-objlist)
-rm -f $@.lds
-endef
-else
-ifneq (,$(findstring aix,$(config-os)))
-define build-module
-$(build-module-helper) \
- -o $@ \
- $(filter-out $(map-file) $(+preinit) $(+postinit),$^) \
- $(no-whole-archive) $(LDLIBS-$(@F:%.so=%).so)
-endef
-else
-define build-module
-define build-module
-$(build-module-helper) \
- -o $@ \
- $(build-module-objlist)
-endef
-endif
-endif
-
-build-module-helper-objlist = \
- $(patsubst %_pic.a,$(whole-archive) %_pic.a $(no-whole-archive),\
- $(filter-out $(map-file) $(+preinit) $(+postinit),$^))
-whole-archive := -Wl,--whole-archive
-
-build-module-objlist = $(build-module-helper-objlist) $(LDLIBS-$(@F:%.so=%).so)
-build-shlib-objlist = $(build-module-helper-objlist) \
- $(LDLIBS-$(@F:lib%.so=%).so)
-
-# Don't try to use -lc when making libc.so itself.
-# Also omits crti.o and crtn.o, which we do not want
-# since we define our own `.init' section specially.
-LDFLAGS-c.so = -nostdlib -nostartfiles
-# But we still want to link libc.so against $(gnulib).
-LDLIBS-c.so += $(gnulib)
-# Give libc.so an entry point and make it directly runnable itself.
-LDFLAGS-c.so += -e __libc_main
-# Force the backward compatibility EH functions to be linked.
-LDFLAGS-c.so += -u __register_frame
-# Pre-link the objects of libc_pic.a so that we can locally resolve
-# COMMON symbols before we link against ld.so. This is because ld.so
-# contains some of libc_pic.a already, which will prevent the COMMONs
-# from being allocated in libc.so, which introduces evil dependencies
-# between libc.so and ld.so, which can make it impossible to upgrade.
-ifeq ($(elf),yes)
-$(common-objpfx)libc_pic.os: $(common-objpfx)libc_pic.a
- $(LINK.o) -nostdlib -nostartfiles -r -o $@ \
- $(LDFLAGS-c_pic.os) -Wl,-d -Wl,--whole-archive $^
-LDSEDCMD-c.so = -e 's/^.*\*(\.dynbss).*$$/& __start___libc_freeres_ptrs = .; *(__libc_freeres_ptrs) __stop___libc_freeres_ptrs = .;/'
-# Use our own special initializer and finalizer files for libc.so.
-$(common-objpfx)libc.so: $(elfobjdir)/soinit.os \
- $(common-objpfx)libc_pic.os \
- $(elfobjdir)/sofini.os \
- $(elfobjdir)/interp.os $(elfobjdir)/ld.so
- $(build-shlib)
-ifeq ($(versioning),yes)
-$(common-objpfx)libc.so: $(common-objpfx)libc.map
-endif
-common-generated += libc.so libc_pic.os
-ifdef libc.so-version
-$(common-objpfx)libc.so$(libc.so-version): $(common-objpfx)libc.so
- $(make-link)
-common-generated += libc.so$(libc.so-version)
-endif
-endif
-else
-ifneq (,$(findstring aix,$(config-os)))
-$(common-objpfx)libc.so: $(common-objpfx)libc_pic.a
- @rm -f $@
- (echo '#!'; \
- dump -g $^ | sed '1,6d' | cut -f2 | sort | uniq) > $(^:a=exp)
- sed '/__mulh/d;/__mull/d;/__divss/d;/__divus/d;/__quoss/d;/__quous/d' \
- /lib/syscalls.exp > $(common-objpfx)syscalls.exp
- $(LINK.o) -G -bM:SRE -bnoentry -bE:$(^:a=exp) \
- -bE:$(common-objpfx)syscalls.exp \
- -bI:$(common-objpfx)syscalls.exp \
- -L$(common-objpfx) -o $@ $^
-# AIX runtime ld wants libc.so to be libc.a(shr.o) hardwired
- cp $@ $(common-objpfx)shr.o
- $(AR) $(ARFLAGS) $(common-objpfx)libc.a $(common-objpfx)shr.o
-endif
-endif
-\f
-# Figure out the source filenames in this directory.
-
-override sources := $(addsuffix .c,\
- $(filter-out $(elided-routines),\
- $(routines) $(aux) \
- $(sysdep_routines)))
-sysdep_routines := $(sysdep_routines)
-
-headers := $(headers) $(sysdep_headers)
-
-# This is the list of all object files, gotten by
-# replacing every ".c" in `sources' with a ".o".
-# We also add bounded-pointer thunks, which are later
-# elided for all suffixes except for `.ob'.
-override objects := $(addprefix $(objpfx),$(sources:.c=.o) \
- $(patsubst %,$(bppfx)%.o,\
- $(filter $(routines) $(sysdep_routines),$(bp-thunks))))
-
-
-# The makefile may define $(extra-libs) with `libfoo libbar'
-# to build libfoo.a et al from the modules listed in $(libfoo-routines).
-ifdef extra-libs
-# extra-lib.mk is included once for each extra lib to define rules
-# to build it, and to add its objects to the various variables.
-# During its evaluation, $(lib) is set to the name of the library.
-extra-libs-left := $(extra-libs)
-include $(patsubst %,$(..)extra-lib.mk,$(extra-libs))
-endif
-\f
-+depfiles := $(sources:.c=.d) \
- $(patsubst %.o,%.d,$(filter %.o,$(extra-objs:.os=.o))) \
- $(addsuffix .d,$(tests) $(xtests) $(test-srcs))
-ifeq ($(build-programs),yes)
-+depfiles += $(addsuffix .d,$(others) $(sysdep-others))
-endif
-+depfiles := $(addprefix $(objpfx),\
- $(filter-out $(addsuffix .d,$(omit-deps)),\
- $(+depfiles)))
-
-ifdef +depfiles
-ifneq ($(no_deps),t)
--include $(+depfiles)
-endif
-endif
-\f\f
-# Maximize efficiency by minimizing the number of rules.
-.SUFFIXES: # Clear the suffix list. We don't use suffix rules.
-# Don't define any builtin rules.
-MAKEFLAGS := $(MAKEFLAGS)r
-
-# Generic rule for making directories.
-%/:
-# mkdir isn't smart enough to strip a trailing /.
- mkdir $(@:%/=%)
-\f
-# Make sure that object files are not removed
-# when they are intermediates between sources and library members.
-.PRECIOUS: $(addprefix $(objpfx)%,$(all-object-suffixes))
-
-# Make sure that the parent library archive is never removed.
-.PRECIOUS: $(foreach l,$(libtypes),$(patsubst %,$(common-objpfx)$l,c))
-\f
-# Use the verbose option of ar and tar when not running silently.
-ifeq "$(findstring s,$(MAKEFLAGS))" "" # if not -s
-verbose := v
-else # -s
-verbose :=
-endif # not -s
-
-ARFLAGS := r$(verbose)
-CREATE_ARFLAGS := cru$(verbose)
-\f
-# This makes all the object files in the parent library archive.
-
-.PHONY: lib lib-noranlib
-lib: lib-noranlib $(foreach l,$(libtypes),$(patsubst %,$(common-objpfx)$l,c))
-lib-noranlib: libobjs
-
-# For object-suffix $o, the list of objects with that suffix.
-# Makefiles can define `elide-routines.so = foo' to leave foo.so out.
-o-objects = $(patsubst %.o,%$o,$(filter-out $(patsubst %,$(objpfx)%.o,\
- $(elide-routines$o)),\
- $(objects))) \
- $(addprefix $(objpfx),$(o-objects$o))
-
-others: $(addprefix $(objpfx),$(install-lib))
-
-ifndef objects
-
-# Create the stamp$o files to keep the parent makefile happy.
-subdir_lib: $(foreach o,$(object-suffixes-for-libc),$(objpfx)stamp$o)
-$(foreach o,$(object-suffixes-for-libc),$(objpfx)stamp$o):
- $(make-target-directory)
- rm -f $@; > $@
-else
-
-# Define explicit rules to update each $(objpfx)stamp.SUFFIX
-# timestamp file; these rules (one explicit rule is generated for each
-# object suffix) write a list of objects to update in the stamp file.
-# The parent will then actually add them all to the archive in the
-# archive rule, below.
-define o-iterator-doit
-$(objpfx)stamp$o: $(o-objects); $$(do-stamp)
-endef
-define do-stamp
-echo '$(patsubst $(objpfx)%,$(addsuffix /,$(subdir))%,$^)' > $@T
-mv -f $@T $@
-endef
-object-suffixes-left := $(object-suffixes-for-libc)
-include $(o-iterator)
-
-endif
-
-# Now define explicit rules to build the library archives; these depend
-# on the stamp files built above.
-define o-iterator-doit
-$(common-objpfx)$(patsubst %,$(libtype$o),c): \
- $(subdirs-stamp-o) $(common-objpfx)stamp$o; $$(do-makelib)
-endef
-define do-makelib
-cd $(common-objdir) && \
-$(AR) $(CREATE_ARFLAGS) $(@F) `cat $(patsubst $(common-objpfx)%,%,$^)`
-$(RANLIB) $@
-endef
-subdirs-stamps := $(foreach d,$(subdirs),$(common-objpfx)$d/stamp%)
-subdirs-stamp-o = $(subst %,$o,$(subdirs-stamps))
-ifndef subdir
-$(subdirs-stamps): subdir_lib;
-endif
-object-suffixes-left = $(object-suffixes-for-libc)
-include $(o-iterator)
-
-
-# This makes all the object files.
-.PHONY: objects objs libobjs extra-objs
-objects objs: libobjs extra-objs
-libobjs: $(foreach o,$(object-suffixes-for-libc),$(objpfx)stamp$o)
-extra-objs: $(addprefix $(objpfx),$(extra-objs))
-
-# Canned sequence for building an extra library archive.
-define build-extra-lib
-$(patsubst %/,cd % &&,$(objpfx)) \
-$(AR) $(CREATE_ARFLAGS) $(@:$(objpfx)%=%) \
- $(patsubst $(objpfx)%,%,$^)
-$(RANLIB) $@
-endef
-\f
-# Installation.
-
-.PHONY: force-install
-force-install:
-
-# $(install-lib) are installed from the object directory into $(libdir);
-# files in $(install-lib) matching `lib%.a' are ranlib'd after installation
-# unless they also appear in $(non-lib.a). $(install-data) are installed
-# as they are into $(datadir). $(headers) are installed as they are in
-# $(includedir). $(install-bin), $(install-bin-script) and $(install-sbin)
-# are installed from the object directory into $(bindir), $(bindir) and
-# $(sbindir), respectively. $(install-others) are absolute path names of
-# files to install; rules to install them are defined elsewhere.
-
-# The simple library name to install libc.a under.
-# This could be defined by a sysdep Makefile.
-ifndef libc-name
-libc-name := c
-endif
-
-define do-install
-$(make-target-directory)
-$(INSTALL_DATA) $< $@
-endef
-
-# Make the target directory if it doesn't exist, using the `mkinstalldirs'
-# script that does `mkdir -p' even if `mkdir' doesn't support that flag.
-define make-target-directory
-$(addprefix $(..)./scripts/mkinstalldirs ,\
- $(filter-out $(wildcard $(@D:%/=%)),$(@D:%/=%)))
-endef
-
-# Any directory (parent or subdir) should install libc.a; this way
-# "make install" in a subdir is guaranteed to install everything it changes.
-installed-libcs := $(foreach o,$(filter-out .os,$(object-suffixes-for-libc)),\
- $(inst_libdir)/$(patsubst %,$(libtype$o),\
- $(libprefix)$(libc-name)))
-install: $(installed-libcs)
-$(installed-libcs): $(inst_libdir)/lib$(libprefix)%: lib $(+force)
- $(make-target-directory)
- $(INSTALL_DATA) $(common-objpfx)lib$(*:$(libc-name)%=c%) $@
-# Running ranlib after installing makes the __.SYMDEF time stamp up to
-# date, which avoids messages from some linkers.
- $(RANLIB) $@
-
-define do-install-program
-$(make-target-directory)
-$(INSTALL_PROGRAM) $< $@.new
-mv -f $@.new $@
-endef
-
-define do-install-script
-$(make-target-directory)
-$(INSTALL_SCRIPT) $< $@.new
-mv -f $@.new $@
-endef
-
-install-lib.so := $(filter %.so,$(install-lib:%_pic.a=%.so))
-install-lib := $(filter-out %.so %_pic.a,$(install-lib))
-
-ifeq (yes,$(build-shared))
-# Find which .so's have versions.
-versioned := $(strip $(foreach so,$(install-lib.so),\
- $(patsubst %,$(so),$($(so)-version))))
-
-install-lib.so-versioned := $(filter $(versioned), $(install-lib.so))
-install-lib.so-unversioned := $(filter-out $(versioned), $(install-lib.so))
-
-install-lib-nosubdir: $(install-lib.so-versioned:%=$(inst_libdir)/%) \
- $(install-lib.so-unversioned:%=$(inst_slibdir)/%)
-
-# Install all the unversioned shared libraries.
-$(install-lib.so-unversioned:%=$(inst_slibdir)/%): $(inst_slibdir)/%.so: \
- $(objpfx)%.so $(+force)
- $(do-install-program)
-
-ifneq ($(findstring -s,$(LN_S)),)
-define make-link
-rm -f $@.new
-$(SHELL) $(..)scripts/rellns-sh $< $@.new
-mv -f $@.new $@
-endef
-else
-# If we have no symbolic links don't bother with rellns-sh.
-define make-link
-rm -f $@.new
-$(LN_S) $< $@.new
-mv -f $@.new $@
-endef
-endif
-
-ifeq (yes,$(build-shared))
-ifeq (no,$(cross-compiling))
-symbolic-link-prog := $(common-objpfx)elf/sln
-symbolic-link-list := $(common-objpfx)elf/symlink.list
-define make-shlib-link
-echo $(<F) $@ >> $(symbolic-link-list)
-endef
-else # cross-compiling
-# We need a definition that can be used by elf/Makefile's install rules.
-symbolic-link-prog = $(LN_S)
-endif
-endif
-ifndef make-shlib-link
-define make-shlib-link
-rm -f $@
-$(LN_S) $(<F) $@
-endef
-endif
-
-ifdef libc.so-version
-# For a library specified to be version N, install three files:
-# libc.so -> libc.so.N (e.g. libc.so.6)
-# libc.so.6 -> libc-VERSION.so (e.g. libc-1.10.so)
-
-$(inst_slibdir)/libc.so$(libc.so-version): $(inst_slibdir)/libc-$(version).so \
- $(+force)
- $(make-shlib-link)
-$(inst_slibdir)/libc-$(version).so: $(common-objpfx)libc.so $(+force)
- $(do-install-program)
-install: $(inst_slibdir)/libc.so$(libc.so-version)
-
-ifndef subdir
-# What we install as libc.so for programs to link against is in fact a
-# link script. It contains references for the various libraries we need.
-# The libc.so object is not complete since some functions are only defined
-# in libc_nonshared.a.
-# We need to use absolute paths since otherwise local copies (if they exist)
-# of the files are taken by the linker.
-install: $(inst_libdir)/libc.so
-$(inst_libdir)/libc.so: $(common-objpfx)libc.so$(libc.so-version) \
- $(inst_libdir)/$(patsubst %,$(libtype.oS),\
- $(libprefix)$(libc-name)) \
- $(+force)
- (echo '/* GNU ld script';\
- echo ' Use the shared library, but some functions are only in';\
- echo ' the static library, so try that secondarily. */';\
- echo 'GROUP ( $(slibdir)/libc.so$(libc.so-version)' \
- '$(libdir)/$(patsubst %,$(libtype.oS),$(libprefix)$(libc-name))'\
- ')' \
- ) > $@.new
- mv -f $@.new $@
-
-endif
-
-else
-install: $(inst_slibdir)/libc.so
-$(inst_slibdir)/libc.so: $(common-objpfx)libc.so $(+force)
- $(do-install-program)
-endif
-
-ifneq (,$(versioned))
-# Produce three sets of rules as above for all the smaller versioned libraries.
-
-define o-iterator-doit
-$(inst_libdir)/$o: $(inst_slibdir)/$o$($o-version) $(+force); $$(make-link)
-endef
-object-suffixes-left := $(versioned)
-include $(o-iterator)
-
-# Make symlinks in the build directory, because the versioned names might
-# be referenced by a DT_NEEDED in another library.
-define o-iterator-doit
-$(objpfx)$o$($o-version): $(objpfx)$o; $$(make-link)
-endef
-object-suffixes-left := $(versioned)
-include $(o-iterator)
-
-generated += $(foreach o,$(versioned),$o$($o-version))
-
-ifeq (,$($(subdir)-version))
-define o-iterator-doit
-$(inst_slibdir)/$o$($o-version): $(inst_slibdir)/$(o:.so=)-$(version).so \
- $(+force);
- $$(make-shlib-link)
-endef
-object-suffixes-left := $(versioned)
-include $(o-iterator)
-
-define o-iterator-doit
-$(inst_slibdir)/$(o:.so=)-$(version).so: $(objpfx)$o $(+force);
- $$(do-install-program)
-endef
-object-suffixes-left := $(versioned)
-include $(o-iterator)
-else
-define o-iterator-doit
-$(inst_slibdir)/$o$($o-version): \
- $(inst_slibdir)/$(o:.so=)-$($(subdir)-version).so $(+force);
- $$(make-shlib-link)
-endef
-object-suffixes-left := $(versioned)
-include $(o-iterator)
-
-define o-iterator-doit
-$(inst_slibdir)/$(o:.so=)-$($(subdir)-version).so: $(objpfx)$o $(+force);
- $$(do-install-program)
-endef
-object-suffixes-left := $(versioned)
-include $(o-iterator)
-endif
-endif
-
-define do-install-so
-$(do-install-program)
-$(patsubst %,ln -s -f $(@F) $(@D)/$(patsubst %$*.so,%,$(<F))$(libprefix)$*.so,\
- $(filter-out %.so,$@))
-endef
-
-so-versions := $(sort $(foreach so,$(install-lib.so),.so$($(so)-version)))
-$(foreach v,$(so-versions),\
- $(inst_slibdir)/lib$(libprefix)%$v): $(common-objpfx)lib%.so \
- $(+force)
- $(do-install-so)
-$(foreach v,$(so-versions),\
- $(inst_slibdir)/$(libprefix)%$v): $(common-objpfx)%.so $(+force)
- $(do-install-so)
-endif
-
-ifdef install-bin
-$(addprefix $(inst_bindir)/,$(install-bin)): \
- $(inst_bindir)/%: $(objpfx)% $(+force)
- $(do-install-program)
-endif
-ifdef install-bin-script
-$(addprefix $(inst_bindir)/,$(install-bin-script)): \
- $(inst_bindir)/%: $(objpfx)% $(+force)
- $(do-install-script)
-endif
-ifdef install-rootsbin
-$(addprefix $(inst_rootsbindir)/,$(install-rootsbin)): \
- $(inst_rootsbindir)/%: $(objpfx)% $(+force)
- $(do-install-program)
-endif
-ifdef install-sbin
-$(addprefix $(inst_sbindir)/,$(install-sbin)): \
- $(inst_sbindir)/%: $(objpfx)% $(+force)
- $(do-install-program)
-endif
-ifdef install-lib
-install-lib.a := $(filter lib%.a,$(install-lib))
-install-lib-non.a := $(filter-out lib%.a,$(install-lib))
-ifdef install-lib-non.a
-$(addprefix $(inst_libdir)/$(libprefix),$(install-lib-non.a)): \
- $(inst_libdir)/$(libprefix)%: $(objpfx)% $(+force)
- $(do-install)
-endif
-ifdef install-lib.a
-$(install-lib.a:lib%.a=$(inst_libdir)/lib$(libprefix)%.a): \
- $(inst_libdir)/lib$(libprefix)%.a: $(objpfx)lib%.a $(+force)
- $(do-install)
- $(patsubst %,$(RANLIB) $@,$(filter-out $(non-lib.a),$(<F)))
-endif
-endif
-ifdef install-data
-$(addprefix $(inst_datadir)/,$(install-data)): $(inst_datadir)/%: % $(+force)
- $(do-install)
-endif
-headers := $(strip $(headers))
-ifdef headers
-$(addprefix $(inst_includedir)/,$(headers)): $(inst_includedir)/%: % $(+force)
- $(do-install)
-endif # headers
-
-.PHONY: install-bin-nosubdir install-bin-script-nosubdir \
- install-rootsbin-nosubdir install-sbin-nosubdir install-lib-nosubdir \
- install-data-nosubdir install-headers-nosubdir
-install-bin-nosubdir: $(addprefix $(inst_bindir)/,$(install-bin))
-install-bin-script-nosubdir: $(addprefix $(inst_bindir)/,$(install-bin-script))
-install-rootsbin-nosubdir: \
- $(addprefix $(inst_rootsbindir)/,$(install-rootsbin))
-install-sbin-nosubdir: $(addprefix $(inst_sbindir)/,$(install-sbin))
-install-lib-nosubdir: $(addprefix $(inst_libdir)/,\
- $(patsubst lib%.a,lib$(libprefix)%.a,$(install-lib.a)) \
- $(addprefix $(libprefix),$(install-lib-non.a)))
-install-data-nosubdir: $(addprefix $(inst_datadir)/,$(install-data))
-install-headers-nosubdir: $(addprefix $(inst_includedir)/,$(headers))
-install-others-nosubdir: $(install-others)
-
-# We need all the `-nosubdir' targets so that `install' in the parent
-# doesn't depend on several things which each iterate over the subdirs.
-# This rule makes `install-FOO' always use `install-FOO-nosubdir' as a
-# subroutine. Then in the parent `install-FOO' also causes subdir makes.
-install-%:: install-%-nosubdir ;
-
-.PHONY: install install-no-libc.a-nosubdir
-ifeq ($(build-programs),yes)
-install-no-libc.a-nosubdir: install-headers-nosubdir install-data-nosubdir\
- install-bin-nosubdir install-bin-script-nosubdir \
- install-lib-nosubdir install-others-nosubdir \
- install-rootsbin-nosubdir install-sbin-nosubdir
-else
-install-no-libc.a-nosubdir: install-headers-nosubdir install-data-nosubdir\
- install-lib-nosubdir install-others-nosubdir
-endif
-install: install-no-libc.a-nosubdir
-\f
-# Command to compile $< in $(objdir) using the native libraries.
-define native-compile
-$(make-target-directory)
-$(patsubst %/,cd % &&,$(objpfx)) \
-$(BUILD_CC) $($(basename $(<F))-CFLAGS) $(ALL_BUILD_CFLAGS) \
- $(firstword $(filter /%,$< $(shell pwd)/$<)) -o $(@F)
-endef
-
-# Command to compile $< in $(common-objdir) using the native libraries.
-# We must cd to $(objdir) anyway so that $(..)config.h is valid.
-define common-objdir-compile
-$(patsubst %/,cd % &&,$(objpfx)) \
-$(BUILD_CC) $($(basename $(<F))-CFLAGS) $(ALL_BUILD_CFLAGS) \
- $(firstword $(filter /%,$< $(shell pwd)/$<)) -o $(..)$(@F)
-endef
-
-# We always want to use configuration definitions.
-# Note that this is only used for commands running in $(objpfx).
-ALL_BUILD_CFLAGS = $(BUILD_CFLAGS) -include $(..)config.h
-
-# Support the GNU standard name for this target.
-.PHONY: check
-check: tests
-# Special target to run tests which cannot be run unconditionally.
-# Maintainers should use this target.
-.PHONY: xcheck
-xcheck: xtests
-
-all-nonlib = $(strip $(tests) $(xtests) $(test-srcs) $(test-extras) $(others))
-ifneq (,$(all-nonlib))
-cpp-srcs-left = $(all-nonlib:=.c)
-lib := nonlib
-include $(patsubst %,$(..)cppflags-iterator.mk,$(all-nonlib))
-endif
-
-# The include magic above causes those files to use this variable for flags.
-CPPFLAGS-nonlib = -DNOT_IN_libc=1
-
-
-ifeq ($(versioning),yes)
-# Generate normalized lists of symbols, versions, and data sizes.
-# This is handy for checking against existing library binaries.
-
-%.symlist: $(..)scripts/abilist.awk %.dynsym
- $(AWK) -f $^ > $@T
- mv -f $@T $@
-
-%.dynsym: %.so
- $(OBJDUMP) --dynamic-syms $< > $@T
- mv -f $@T $@
-
-tests: $(patsubst %.so,$(objpfx)%.symlist,$(install-lib.so-versioned))
-generated += $(install-lib.so-versioned:.so=.symlist)
-
-ifeq ($(subdir),elf)
-tests: $(common-objpfx)libc.symlist
-common-generated += libc.symlist
-endif
-endif
-\f
-.PHONY: TAGS
-TAGS: $(objpfx)distinfo $(..)MakeTAGS
- $(MAKE) $(addprefix -f ,$^) $@
-
-$(..)po/%.pot: $(objpfx)distinfo $(..)MakeTAGS FORCE
- $(MAKE) $(addprefix -f ,$(filter-out FORCE,$^)) $@
-FORCE:
-
-
-.PHONY: echo-headers
-echo-headers:
- @echo $(headers)
-
-\f
-# Common cleaning targets.
-
-.PHONY: common-mostlyclean common-clean mostlyclean clean do-tests-clean
-clean: common-clean
-mostlyclean: common-mostlyclean
-
-do-tests-clean:
- -rm -f $(addprefix $(objpfx),$(addsuffix .out,$(tests) $(xtests) \
- $(test-srcs)) \
- $(addsuffix -bp.out,$(tests) $(xtests) \
- $(test-srcs)))
-
-# Remove the object files.
-common-mostlyclean:
- -rm -f $(addprefix $(objpfx),$(tests) $(xtests) $(test-srcs) \
- $(others) $(sysdep-others) stubs \
- $(addsuffix .o,$(tests) $(xtests) \
- $(test-srcs) $(others) \
- $(sysdep-others)) \
- $(addsuffix -bp,$(tests) $(xtests) \
- $(test-srcs)) \
- $(addsuffix .out,$(tests) $(xtests) \
- $(test-srcs)) \
- $(addsuffix -bp.out,$(tests) $(xtests) \
- $(test-srcs)))
- -rm -f $(addprefix $(objpfx),$(extra-objs) $(install-lib) \
- $(install-lib.so) \
- $(install-lib.so:%.so=%_pic.a))
- -rm -f core
- -rm -f $(objpfx)rtld-*.os
- $(rmobjs)
-define rmobjs
-$(foreach o,$(object-suffixes-for-libc),
--rm -f $(objpfx)stamp$o $(o-objects))
-endef
-
-# Also remove the dependencies and generated source files.
-common-clean: common-mostlyclean
- -rm -f $(addprefix $(objpfx),$(generated)) $(+depfiles)
- -rm -f $(objpfx)rtld-*.d
- -rm -fr $(addprefix $(objpfx),$(generated-dirs))
- -rm -f $(addprefix $(common-objpfx),$(common-generated))
- -rm -f $(objpfx)distinfo
-\f
-# Produce a file `stubs' which contains `#define __stub_FUNCTION'
-# for each function which is a stub. We grovel over all the .d files
-# looking for references to <stub-tag.h>. Then we grovel over each
-# referenced source file to see what stub function it defines.
-
-ifdef objpfx
-.PHONY: stubs # The parent Makefile calls this target.
-stubs: $(objpfx)stubs
-endif
-s = $(sysdep_dir)/generic
-$(objpfx)stubs: $(+depfiles)
-# Use /dev/null since `...` might expand to empty.
- (s=`cd $s && $(PWD_P)`; \
- $(patsubst %/,cd % &&,$(objpfx)) \
- sed -n 's/^stub_warning *(\([^)]*\).*$$/#define __stub_\1/p' \
- `sed -n -e '\@ $s/[^ ]*\.c@{; s@^.* $s/\([^ ]*\.c\).*$$@'"$$s"'/\1@; h; }' \
- -e '/stub-tag\.h/{; g; p; }' \
- $(patsubst $(objpfx)%,%,$^) /dev/null` \
- /dev/null) > $@T
- mv -f $@T $@
-\f
-# Make the distribution tar file.
-
-.PHONY: dist
-dist: $(objpfx)distinfo $(..)Make-dist
- $(MAKE) -f $< -f $(word 2,$^) $(Make-dist-args)
-
-# Avoid depending on source files found in sysdeps dirs,
-# because the references affect implicit rule selection.
-dist: $(filter-out %.c %.S %.s,$(distribute))
-
-# We used to simply export all these variables, but that frequently made the
-# environment get too large. Instead, we write all the information into
-# a generated makefile fragment `distinfo', and then include it with -f in
-# the sub-make that makes the distribution (above).
-$(objpfx)distinfo: Makefile $(..)Makerules \
- $(wildcard $(foreach dir,$(sysdirs),$(dir)/Makefile))
- $(make-target-directory)
- $(distinfo-vars)
- mv -f $@.new $@
-.PHONY: subdir_distinfo
-subdir_distinfo: $(objpfx)distinfo
-
-define distinfo-vars
-rm -f $@.new
-echo > $@.new 'subdir := $(subdir)'
-$(foreach var,subdir-dirs sources elided-routines sysdep_routines \
- headers sysdep_headers distribute dont_distribute generated \
- others tests xtests test-srcs extra-libs versioned \
- $(extra-libs:%=%-routines) \
- $(addprefix install-,lib lib.so data bin bin-script sbin others),
-echo >> $@.new '$(subdir)-$(var) := $($(var))'
-echo >> $@.new '$(var) = $$($(subdir)-$(var))')
-endef
-\f
-ifneq (,$(strip $(gpl2lgpl)))
-ifneq (,$(wildcard $(..)gpl2lgpl.sed))
-# Snarf from the master source and frob the copying notice.
-$(gpl2lgpl): %: $(..)gpl2lgpl.sed /home/gd/gnu/lib/%
- sed -f $^ > $@-tmp
-# So I don't edit them by mistake.
- chmod a-w $@-tmp
- mv -f $@-tmp $@
-ifeq ($(with-cvs),yes)
- test ! -d CVS || cvs $(CVSOPTS) commit -m'Updated from $^' $@
-endif
-endif
-endif
-
-# Local Variables:
-# mode: makefile
-# End:
+# Copyright (C) 1991-1999,2000,01,02 Free Software Foundation, Inc.\r
+# This file is part of the GNU C Library.\r
+\r
+# The GNU C Library is free software; you can redistribute it and/or\r
+# modify it under the terms of the GNU Lesser General Public\r
+# License as published by the Free Software Foundation; either\r
+# version 2.1 of the License, or (at your option) any later version.\r
+\r
+# The GNU C Library is distributed in the hope that it will be useful,\r
+# but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\r
+# Lesser General Public License for more details.\r
+\r
+# You should have received a copy of the GNU Lesser General Public\r
+# License along with the GNU C Library; if not, write to the Free\r
+# Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA\r
+# 02111-1307 USA.\r
+\r
+#\r
+# Common rules for making the GNU C library. This file is included\r
+# by the top-level Makefile and by all subdirectory makefiles\r
+# (through Rules).\r
+#\r
+ifneq (,)\r
+This makefile requires GNU Make.\r
+endif\r
+\r
+REQUIRED_MAKE_VERSION = 3.74\r
+REAL_MAKE_VERSION = $(firstword $(MAKE_VERSION))\r
+\r
+ifneq ($(REQUIRED_MAKE_VERSION), \\r
+ $(firstword $(sort $(REAL_MAKE_VERSION) $(REQUIRED_MAKE_VERSION))))\r
+Wrong GNU Make version. See above for the version needed.\r
+endif\r
+\r
+\r
+ifdef subdir\r
+.. := ../\r
+endif # subdir\r
+\r
+# If `sources' was defined by the parent makefile, undefine it so\r
+# we will later get it from wildcard search in this directory.\r
+ifneq "$(findstring env,$(origin sources))" ""\r
+sources :=\r
+endif\r
+\r
+oPATH := $(PATH)\r
+PATH := this definition should take precedence over $(oPATH)\r
+ifeq ($(PATH),$(oPATH))\r
+You must not use the -e flag when building the GNU C library.\r
+else\r
+PATH := $(oPATH)\r
+endif\r
+\f\r
+ifndef +included-Makeconfig\r
+include $(..)Makeconfig\r
+endif\r
+\r
+# `configure' writes a definition of `config-sysdirs' in `config.make'.\r
+sysdirs = $(strip $(full_config_sysdirs))\r
+\r
++sysdir_pfx = $(common-objpfx)\r
+\r
+export sysdirs := $(sysdirs)\r
+\r
++sysdep_dirs := $(full_config_sysdirs)\r
+ifdef objdir\r
++sysdep_dirs := $(objdir) $(+sysdep_dirs)\r
+endif\r
+\r
+# Add -I switches to get the right sysdep directories.\r
+# `+includes' in Makeconfig references $(+sysdep-includes).\r
++sysdep-includes := $(addprefix -I,$(+sysdep_dirs))\r
+\r
+# This variable is used in ``include $(o-iterator)'' after defining\r
+# $(o-iterator-doit) to produce some desired rule using $o for the object\r
+# suffix, and setting $(object-suffixes-left) to $(object-suffixes); a copy\r
+# is produced for each object suffix in use.\r
+o-iterator = $(patsubst %,$(..)o-iterator.mk,$(object-suffixes-left))\r
+\f\r
+# Include any system-specific makefiles.\r
+\r
+# This is here so things in sysdep Makefiles can easily depend on foo.h as\r
+# appropriate and not worry about where foo.h comes from, which may be\r
+# system dependent and not known by that Makefile.\r
+vpath %.h $(subst $(empty) ,:,$(strip $(common-objpfx) $(objpfx) \\r
+ $(+sysdep_dirs) $(..)))\r
+\r
+# The same is true for RPC source files.\r
+vpath %.x $(subst $(empty) ,:,$(strip $(common-objpfx) $(objpfx) \\r
+ $(+sysdep_dirs) $(..)))\r
+\r
+# Some sysdep makefiles use this to distinguish being included here from\r
+# being included individually by a subdir makefile (hurd/Makefile needs this).\r
+in-Makerules := yes\r
+\r
+sysdep-makefiles := $(wildcard $(full_config_sysdirs:=/Makefile))\r
+ifneq (,$(sysdep-makefiles))\r
+include $(sysdep-makefiles)\r
+endif\r
+\r
+\r
+# Reorder before-compile so that mach things come first, and hurd things\r
+# second, before all else. The mach and hurd subdirectories have many\r
+# generated header files which the much of rest of the library depends on,\r
+# so it is best to build them first (and mach before hurd, at that).\r
+before-compile := $(filter $(common-objpfx)mach% $(common-objpfx)hurd%,\\r
+ $(before-compile)) \\r
+ $(filter-out $(common-objpfx)mach% $(common-objpfx)hurd%,\\r
+ $(before-compile))\r
+\r
+# Even before that, we need abi-versions.h which is generated right here.\r
+ifeq ($(versioning),yes)\r
+ifndef avoid-generated\r
+before-compile := $(common-objpfx)abi-versions.h $(before-compile)\r
+$(common-objpfx)abi-versions.h: $(..)scripts/abi-versions.awk \\r
+ $(common-objpfx)Versions.all\r
+ LC_ALL=C $(AWK) -v oldest_abi=$(oldest-abi) -f $^ > $@T\r
+ mv -f $@T $@\r
+\r
+$(common-objpfx)%.latest: $(common-objpfx)abi-versions.h\r
+ sed -n '/ VERSION_$*_/{s/^.*_\([A-Z0-9_]*\).*$$/\1/;h;};$${g;p;}' \\r
+ $(common-objpfx)abi-versions.h > $@T\r
+ mv -f $@T $@\r
+endif # avoid-generated\r
+endif # $(versioning) = yes\r
+\r
+# When we have no deps pass doing it, then make sure the subdirectory\r
+# for object files gets created.\r
+ifdef no_deps\r
+ifdef objpfx\r
+before-compile += $(objpfx).\r
+$(objpfx).:\r
+ $(make-target-directory)\r
+endif\r
+endif\r
+\r
+# Remove existing files from `before-compile'. Things are added there when\r
+# they must exist for dependency generation to work right, but once they\r
+# exist there is no further need for every single file to depend on them,\r
+# and those gratuitous dependencies result in many gratuitous\r
+# recompilations.\r
+before-compile := $(filter-out $(wildcard $(before-compile)),$(before-compile))\r
+\r
+# Don't let any before-compile file be an intermediate and get removed.\r
+ifdef before-compile\r
+$(before-compile):\r
+endif\r
+\r
+# If a makefile needs to do something conditional on something that\r
+# can only be figured out from headers, write a FOO.make.c input\r
+# file that uses cpp contructs and contains @@@ LINE @@@ for each LINE\r
+# to emit in the generated makefile, and use -include $(common-objpfx)FOO.make.\r
+$(common-objpfx)%.make: $(..)%.make.c $(..)Makerules\r
+ rm -f $@T $@.dT\r
+ (echo '# Generated from $*.make.c by Makerules.'; \\r
+ SUNPRO_DEPENDENCIES='$@.dT $$(common-objpfx)$*.make' \\r
+ $(CC) $(CFLAGS) $(CPPFLAGS) -E $< \\r
+ | sed -n '/@@@/{s/@@@[ ]*\(.*\)@@@/\1/;s/[ ]*$$//p;}'; \\r
+ echo 'common-generated += $(@F)'; \\r
+ cat $@.dT; rm -f $@.dT) > $@T\r
+ mv -f $@T $@\r
+\f\r
+# Generate an ordered list of implicit rules which find the source files in\r
+# each sysdep directory. The old method was to use vpath to search all the\r
+# sysdep directories. However, that had the problem that a .S file in a\r
+# later directory would be chosen over a .c file in an earlier directory,\r
+# which does not preserve the desired sysdeps ordering behavior.\r
+\r
+# When making the list of .d files to include, we can't know which ones\r
+# have source in .s files, and thus do not in fact need a .d file.\r
+# So we must define rules to make .d files for .s files.\r
+define make-dummy-dep\r
+$(addprefix ln $(common-objpfx)dummy.d ,$(filter-out $(wildcard $@),$@))\r
+endef\r
+$(common-objpfx)dummy.d:\r
+ echo '# .s files cannot contain includes, so they need no deps.' > $@\r
+\r
+# It matters that this set of rules, for compiling from sources in\r
+# the current directory (the $srcdir/$subdir) come before the\r
+# generated sysdep rules in included from sysd-rules below. When\r
+# compiling in the source tree, generated sources go into the current\r
+# directory, and those should be chosen before any sources in sysdeps.\r
+define o-iterator-doit\r
+$(objpfx)%$o: %.S $(before-compile); $$(compile-command.S)\r
+endef\r
+object-suffixes-left := $(all-object-suffixes)\r
+include $(o-iterator)\r
+$(objpfx)%.d: %.S $(before-compile); $(+make-deps)\r
+\r
+define o-iterator-doit\r
+$(objpfx)%$o: %.s $(before-compile); $$(compile-command.s)\r
+endef\r
+object-suffixes-left := $(all-object-suffixes)\r
+include $(o-iterator)\r
+$(objpfx)%.d: %.s $(common-objpfx)dummy.d; $(make-dummy-dep)\r
+\r
+define o-iterator-doit\r
+$(objpfx)%$o: %.c $(before-compile); $$(compile-command.c)\r
+endef\r
+object-suffixes-left := $(all-object-suffixes)\r
+include $(o-iterator)\r
+$(objpfx)%.d: %.c $(before-compile); $(+make-deps)\r
+\r
+# Omit the objpfx rules when building in the source tree, because\r
+# objpfx is empty and so these rules just override the ones above.\r
+ifdef objpfx\r
+# Define first rules to find the source files in $(objpfx).\r
+# Generated source files will end up there.\r
+define o-iterator-doit\r
+$(objpfx)%$o: $(objpfx)%.S $(before-compile); $$(compile-command.S)\r
+endef\r
+object-suffixes-left := $(all-object-suffixes)\r
+include $(o-iterator)\r
+$(objpfx)%.d: $(objpfx)%.S $(before-compile); $(+make-deps)\r
+\r
+define o-iterator-doit\r
+$(objpfx)%$o: $(objpfx)%.s $(before-compile); $$(compile-command.s)\r
+endef\r
+object-suffixes-left := $(all-object-suffixes)\r
+include $(o-iterator)\r
+$(objpfx)%.d: $(objpfx)%.s $(common-objpfx)dummy.d; $(make-dummy-dep)\r
+\r
+define o-iterator-doit\r
+$(objpfx)%$o: $(objpfx)%.c $(before-compile); $$(compile-command.c)\r
+endef\r
+object-suffixes-left := $(all-object-suffixes)\r
+include $(o-iterator)\r
+$(objpfx)%.d: $(objpfx)%.c $(before-compile); $(+make-deps)\r
+endif\r
+\r
+# System-dependent makefiles can put in `inhibit-sysdep-asm' wildcard\r
+# patterns matching sysdep directories whose assembly source files should\r
+# be suppressed.\r
+ifdef inhibit-sysdep-asm\r
+define open-check-inhibit-asm\r
+case $$sysdir in $(subst $(empty) ,|,$(inhibit-sysdep-asm))) : ;; *)\r
+endef\r
+close-check-inhibit-asm = ;; esac ;\r
+endif\r
+\r
+-include $(+sysdir_pfx)sysd-rules\r
+ifneq ($(sysd-rules-sysdirs),$(config-sysdirs))\r
+# The value of $(+sysdep_dirs) the sysd-rules was computed for\r
+# differs from the one we are using now. So force a rebuild of sysd-rules.\r
+sysd-rules-force = FORCE\r
+FORCE:\r
+endif\r
+$(+sysdir_pfx)sysd-rules: $(+sysdir_pfx)config.make $(..)Makerules \\r
+ $(wildcard $(foreach dir,$(sysdirs),\\r
+ $(dir)/Makefile))\\r
+ $(sysd-rules-force)\r
+ -@rm -f $@T\r
+ (echo 'sysd-rules-sysdirs := $(config-sysdirs)'; \\r
+ for dir in $(config-sysdirs:%='$$(..)%'); do \\r
+ for o in $(all-object-suffixes); do \\r
+ $(open-check-inhibit-asm) \\r
+ echo "\$$(objpfx)%$$o: $$dir/%.S \$$(before-compile); \\r
+ \$$(compile-command.S)"; \\r
+ echo "\$$(objpfx)%$$o: $$dir/%.s \$$(before-compile); \\r
+ \$$(compile-command.s)"; \\r
+ echo "\$$(objpfx)rtld-%$$o: $$dir/%.S \$$(before-compile); \\r
+ \$$(compile-command.S)"; \\r
+ echo "\$$(objpfx)rtld-%$$o: $$dir/%.s \$$(before-compile); \\r
+ \$$(compile-command.s)"; \\r
+ $(close-check-inhibit-asm) \\r
+ echo "\$$(objpfx)%$$o: $$dir/%.c \$$(before-compile); \\r
+ \$$(compile-command.c)"; \\r
+ echo "\$$(objpfx)rtld-%$$o: $$dir/%.c \$$(before-compile); \\r
+ \$$(compile-command.c)"; \\r
+ done; \\r
+ $(open-check-inhibit-asm) \\r
+ echo "\$$(objpfx)%.d: $$dir/%.s \$$(common-objpfx)dummy.d; \\r
+ \$$(make-dummy-dep)"; \\r
+ echo "\$$(objpfx)rtld-%.d: $$dir/%.s \$$(common-objpfx)dummy.d; \\r
+ \$$(make-dummy-dep)"; \\r
+ echo "\$$(objpfx)%.d: $$dir/%.S \$$(before-compile); \\r
+ \$$(+make-deps)"; \\r
+ echo "\$$(objpfx)rtld-%.d: $$dir/%.S \$$(before-compile); \\r
+ \$$(+make-deps)"; \\r
+ $(close-check-inhibit-asm) \\r
+ echo "\$$(objpfx)%.d: $$dir/%.c \$$(before-compile); \\r
+ \$$(+make-deps)"; \\r
+ echo "\$$(objpfx)rtld-%.d: $$dir/%.c \$$(before-compile); \\r
+ \$$(+make-deps)"; \\r
+ echo "\$$(objpfx)m_%.S: $$dir/s_%.S; \$$(+make-include-of-dep)"; \\r
+ echo "\$$(objpfx)m_%.c: $$dir/s_%.c; \$$(+make-include-of-dep)"; \\r
+ done; \\r
+ echo 'sysd-rules-done = t') > $@T\r
+ mv -f $@T $@\r
+\r
+ifndef sysd-rules-done\r
+# Don't do deps until this exists, because it provides rules to make the deps.\r
+no_deps=t\r
+endif\r
+\r
+# This is used by the m_%.[Sc] pattern rules in sysd-rules.\r
+define +make-include-of-dep\r
+echo '#include <$<>' > $@T\r
+mv -f $@T $@\r
+endef\r
+\r
+# Generate version maps, but wait until sysdep-subdirs is known\r
+ifeq ($(sysd-sorted-done),t)\r
+ifeq ($(versioning),yes)\r
+-include $(common-objpfx)sysd-versions\r
+$(addprefix $(common-objpfx),$(version-maps)): $(common-objpfx)sysd-versions\r
+common-generated += $(version-maps)\r
+postclean-generated += sysd-versions Versions.all abi-versions.h \\r
+ Versions.def.v.i Versions.def.v Versions.v.i Versions.v\r
+\r
+ifndef avoid-generated\r
+ifneq ($(sysd-versions-subdirs),$(all-subdirs) $(config-sysdirs))\r
+sysd-versions-force = FORCE\r
+FORCE:\r
+endif\r
+# See %.v/%.v.i implicit rules in Makeconfig.\r
+$(common-objpfx)Versions.def.v.i: $(..)Versions.def \\r
+ $(wildcard $(add-ons:%=$(..)%/Versions.def))\r
+$(common-objpfx)Versions.all: $(..)scripts/firstversions.awk \\r
+ $(common-objpfx)soversions.i \\r
+ $(common-objpfx)Versions.def.v\r
+ { while read lib version setname; do \\r
+ test -z "$$setname" || echo "$$lib : $$setname"; \\r
+ done < $(word 2,$^); \\r
+ cat $(word 3,$^); \\r
+ } | LC_ALL=C $(AWK) -f $< > $@T\r
+ mv -f $@T $@\r
+# See %.v/%.v.i implicit rules in Makeconfig.\r
+$(common-objpfx)Versions.v.i: $(wildcard $(all-subdirs:%=$(..)%/Versions)) \\r
+ $(wildcard $(sysdirs:%=%/Versions)) \\r
+ $(common-objpfx)abi-versions.h \\r
+ $(sysd-versions-force)\r
+$(common-objpfx)sysd-versions: $(common-objpfx)Versions.all \\r
+ $(common-objpfx)Versions.v \\r
+ $(..)scripts/versions.awk\r
+ ( echo 'sysd-versions-subdirs = $(all-subdirs) $(config-sysdirs)' ; \\r
+ cat $(word 2,$^) \\r
+ | LC_ALL=C $(AWK) -v buildroot=$(common-objpfx) -v defsfile=$< \\r
+ -v move_if_change='$(move-if-change)' \\r
+ -f $(word 3,$^); \\r
+ ) > $@T\r
+ mv -f $@T $@\r
+endif # avoid-generated\r
+endif # $(versioning) = yes\r
+endif # sysd-sorted-done\r
+\r
+\r
+ifndef compile-command.S\r
+compile-command.S = $(compile.S) $(OUTPUT_OPTION)\r
+endif\r
+ifndef compile-command.s\r
+compile-command.s = $(COMPILE.s) $< $(OUTPUT_OPTION)\r
+endif\r
+ifndef compile-command.c\r
+compile-command.c = $(compile.c) $(OUTPUT_OPTION)\r
+endif\r
+\r
+# GCC can grok options after the file name, and it looks nicer that way.\r
+compile.c = $(CC) $< -c $(CFLAGS) $(CPPFLAGS)\r
+compile.S = \\r
+ $(CC) $< -c $(CPPFLAGS) -DASSEMBLER $(asm-CPPFLAGS) $(ASFLAGS-$(suffix $@))\r
+COMPILE.S = \\r
+ $(CC) -c $(CPPFLAGS) -DASSEMBLER $(asm-CPPFLAGS) $(ASFLAGS-$(suffix $@))\r
+COMPILE.s = $(filter-out -pipe,$(CC)) -c $(ASFLAGS)\r
+\r
+# If we want to generate MD5 checksums for the sources do this now.\r
+ifeq ($(md5),yes)\r
+generate-md5 = ; rm -f $(@:.d=.md5); \\r
+$(CC) -E $< $(CFLAGS) $(CPPFLAGS) $($(<:$*.%=%)-CPPFLAGS) | \\r
+sed '/^\#/d;/^[[:space:]]*$$/d' | md5sum > $(@:.d=.md5)\r
+else\r
+generate-md5 =\r
+endif\r
+\r
+# We need this for the output to go in the right place. It will default to\r
+# empty if make was configured to work with a cc that can't grok -c and -o\r
+# together. You can't compile the C library with such a compiler.\r
+OUTPUT_OPTION = -o $@\r
+\r
+# We need the $(CFLAGS) to be in there to have the right predefines during\r
+# the dependency run for C sources. But having it for assembly sources can\r
+# get the wrong predefines.\r
+S-CPPFLAGS = $(asm-CPPFLAGS)\r
+define +make-deps\r
+$(make-target-directory)\r
+$(+mkdep) $< $(if $(filter %.c,$<),$(CFLAGS)) \\r
+ $(CPPFLAGS) $($(<:$*.%=%)-CPPFLAGS) | sed \\r
+-e 's,$(subst .,\.,$*)\.o,$(foreach o,$(all-object-suffixes),$(@:.d=$o)) $@,' \\r
+$(sed-remove-objpfx) > $(@:.d=.T)\r
+mv -f $(@:.d=.T) $@ $(generate-md5)\r
+endef\r
+ifneq (,$(objpfx))\r
+# Continuation lines here are dangerous because they introduce spaces!\r
+define sed-remove-objpfx\r
+-e 's@ $(subst .,\.,$(subst @,\@,$(common-objpfx)))@ $$(common-objpfx)@g' \\r
+-e 's@^$(subst .,\.,$(subst @,\@,$(common-objpfx)))@$$(common-objpfx)@g'\r
+endef\r
+endif\r
+\f\r
+# Modify the list of routines we build for different targets\r
+\r
+ifeq (yesyes,$(build-shared)$(elf))\r
+ifndef libc.so-version\r
+# Undefine this because it can't work when we libc.so is unversioned.\r
+static-only-routines =\r
+endif\r
+endif\r
+\r
+# Bounded pointer thunks are only built for *.ob\r
+elide-bp-thunks = $(addprefix $(bppfx),$(bp-thunks))\r
+\r
+elide-routines.oS += $(filter-out $(static-only-routines),\\r
+ $(routines) $(aux) $(sysdep_routines)) \\r
+ $(elide-bp-thunks)\r
+elide-routines.os += $(static-only-routines) $(elide-bp-thunks)\r
+\r
+# If we have versioned code we don't need the old versions in any of the\r
+# static libraries.\r
+elide-routines.o += $(shared-only-routines) $(elide-bp-thunks)\r
+elide-routines.op += $(shared-only-routines) $(elide-bp-thunks)\r
+elide-routines.og += $(shared-only-routines) $(elide-bp-thunks)\r
+elide-routines.ob += $(shared-only-routines)\r
+\f\r
+# Shared library building.\r
+\r
+ifeq (yes,$(build-shared))\r
+\r
+# Reference map file only when versioning is selected and a map file name\r
+# is given.\r
+ifeq ($(versioning),yes)\r
+map-file = $(firstword $($(@F:.so=-map)) \\r
+ $(addprefix $(common-objpfx), \\r
+ $(filter $(@F:.so=.map),$(version-maps))))\r
+load-map-file = $(map-file:%=-Wl,--version-script=%)\r
+endif\r
+\r
+# Pattern rule to build a shared object from an archive of PIC objects.\r
+# This must come after the installation rules so Make doesn't try to\r
+# build shared libraries in place from the installed *_pic.a files.\r
+# $(LDLIBS-%.so) may contain -l switches to generate run-time dependencies\r
+# on other shared objects.\r
+lib%.so: lib%_pic.a $(+preinit) $(+postinit) $(+interp)\r
+ifneq (,$(findstring aix,$(config-os)))\r
+ (echo '#!'; \\r
+ dump -g $< | sed '1,6d' | cut -f2 | sort | uniq) > $(<:a=exp)\r
+endif\r
+ $(build-shlib)\r
+\r
+ifeq ($(elf),yes)\r
+define build-shlib-helper\r
+$(LINK.o) -shared $(static-libgcc) -Wl,-O1 $(sysdep-LDFLAGS) $(config-LDFLAGS) \\r
+ $(extra-B-$(@F:lib%.so=%).so) -B$(csu-objpfx) \\r
+ $(extra-B-$(@F:lib%.so=%).so) $(load-map-file) \\r
+ -Wl,-soname=lib$(libprefix)$(@F:lib%.so=%).so$($(@F)-version) \\r
+ $(LDFLAGS.so) $(LDFLAGS-$(@F:lib%.so=%).so) \\r
+ -L$(subst :, -L,$(rpath-link)) -Wl,-rpath-link=$(rpath-link)\r
+endef\r
+else\r
+ifneq (,$(findstring aix,$(config-os)))\r
+define build-shlib-helper\r
+$(LINK.o) -Wl,-G,-bM:SRE,-bnoentry,-bE:$(<:a=exp) \\r
+ $(sysdep-LDFLAGS) $(config-LDFLAGS) $(extra-B-$(@F:lib%.so=%).so) \\r
+ $(extra-B-$(@F:lib%.so=%).so) $(load-map-file) \\r
+ $(LDFLAGS.so) $(LDFLAGS-$(@F:lib%.so=%).so) \\r
+ -L$(subst :, -L,$(rpath-link))\r
+endef\r
+else\r
+endif\r
+endif\r
+\r
+ifeq (yes,$(elf))\r
+# binutils only position loadable notes into the first page for binaries,\r
+# not for shared objects\r
+define build-shlib\r
+$(build-shlib-helper) \\r
+ -o $@.new $(csu-objpfx)abi-note.o -Wl,--verbose \\r
+ $(LDLIBS-$(@F:lib%.so=%).so) 2>&1 | \\r
+ sed -e '/^=========/,/^=========/!d;/^=========/d' \\r
+ -e 's/^.*\.hash[ ]*:.*$$/ .note.ABI-tag : { *(.note.ABI-tag) } &/' \\r
+ $(LDSEDCMD-$(@F:lib%.so=%).so) > $@.lds\r
+rm -f $@.new\r
+$(build-shlib-helper) -o $@ -T $@.lds \\r
+ $(csu-objpfx)abi-note.o $(build-shlib-objlist)\r
+rm -f $@.lds\r
+endef\r
+else\r
+ifneq (,$(findstring aix,$(config-os)))\r
+define build-shlib\r
+$(build-shlib-helper) \\r
+ -o $@ \\r
+ $(filter-out $(map-file) $(+preinit) $(+postinit),$^) \\r
+ $(no-whole-archive) $(LDLIBS-$(@F:lib%.so=%).so)\r
+endef\r
+define build-shlib\r
+$(build-shlib-helper) \\r
+ $(build-shlib-objlist)\r
+endef\r
+endif\r
+endif\r
+\r
+ifneq (,$(findstring aix,$(config-os)))\r
+define build-module-helper\r
+$(LINK.o) -Wl,-G -Wl,-bM:SRE -Wl,-bnoentry -Wl,-bexpall \\r
+ $(sysdep-LDFLAGS) $(config-LDFLAGS) \\r
+ $(load-map-file) \\r
+ $(LDFLAGS.so) $(LDFLAGS-$(@F:%.so=%).so) \\r
+ -L$(subst :, -L,$(rpath-link)) -Wl,-L=$(rpath-link)\r
+endef\r
+else\r
+define build-module-helper\r
+$(LINK.o) -shared $(static-libgcc) $(sysdep-LDFLAGS) $(config-LDFLAGS) \\r
+ -B$(csu-objpfx) $(load-map-file) \\r
+ $(LDFLAGS.so) $(LDFLAGS-$(@F:%.so=%).so) \\r
+ -L$(subst :, -L,$(rpath-link)) -Wl,-rpath-link=$(rpath-link)\r
+endef\r
+endif\r
+\r
+# This macro is similar to build-shlib but it does not define a soname\r
+# and it does not depend on the destination name to start with `lib'.\r
+ifeq (yes,$(elf))\r
+# binutils only position loadable notes into the first page for binaries,\r
+# not for shared objects\r
+define build-module\r
+$(build-module-helper) \\r
+ -o $@.new $(csu-objpfx)abi-note.o -Wl,--verbose \\r
+ $(LDLIBS-$(@F:lib%.so=%).so) 2>&1 | \\r
+ sed -e '/^=========/,/^=========/!d;/^=========/d' \\r
+ -e 's/^.*\.hash[ ]*:.*$$/ .note.ABI-tag : { *(.note.ABI-tag) } &/' \\r
+ > $@.lds\r
+rm -f $@.new\r
+$(build-module-helper) -o $@ -T $@.lds \\r
+ $(csu-objpfx)abi-note.o $(build-module-objlist)\r
+rm -f $@.lds\r
+endef\r
+else\r
+ifneq (,$(findstring aix,$(config-os)))\r
+define build-module\r
+$(build-module-helper) \\r
+ -o $@ \\r
+ $(filter-out $(map-file) $(+preinit) $(+postinit),$^) \\r
+ $(no-whole-archive) $(LDLIBS-$(@F:%.so=%).so)\r
+endef\r
+else\r
+define build-module\r
+define build-module\r
+$(build-module-helper) \\r
+ -o $@ \\r
+ $(build-module-objlist)\r
+endef\r
+endif\r
+endif\r
+\r
+build-module-helper-objlist = \\r
+ $(patsubst %_pic.a,$(whole-archive) %_pic.a $(no-whole-archive),\\r
+ $(filter-out $(map-file) $(+preinit) $(+postinit),$^))\r
+whole-archive := -Wl,--whole-archive\r
+\r
+build-module-objlist = $(build-module-helper-objlist) $(LDLIBS-$(@F:%.so=%).so)\r
+build-shlib-objlist = $(build-module-helper-objlist) \\r
+ $(LDLIBS-$(@F:lib%.so=%).so)\r
+\r
+# Don't try to use -lc when making libc.so itself.\r
+# Also omits crti.o and crtn.o, which we do not want\r
+# since we define our own `.init' section specially.\r
+LDFLAGS-c.so = -nostdlib -nostartfiles\r
+# But we still want to link libc.so against $(gnulib).\r
+LDLIBS-c.so += $(gnulib)\r
+# Give libc.so an entry point and make it directly runnable itself.\r
+LDFLAGS-c.so += -e __libc_main\r
+# Force the backward compatibility EH functions to be linked.\r
+LDFLAGS-c.so += -u __register_frame\r
+# Pre-link the objects of libc_pic.a so that we can locally resolve\r
+# COMMON symbols before we link against ld.so. This is because ld.so\r
+# contains some of libc_pic.a already, which will prevent the COMMONs\r
+# from being allocated in libc.so, which introduces evil dependencies\r
+# between libc.so and ld.so, which can make it impossible to upgrade.\r
+ifeq ($(elf),yes)\r
+$(common-objpfx)libc_pic.os: $(common-objpfx)libc_pic.a\r
+ $(LINK.o) -nostdlib -nostartfiles -r -o $@ \\r
+ $(LDFLAGS-c_pic.os) -Wl,-d -Wl,--whole-archive $^\r
+LDSEDCMD-c.so = -e 's/^.*\*(\.dynbss).*$$/& __start___libc_freeres_ptrs = .; *(__libc_freeres_ptrs) __stop___libc_freeres_ptrs = .;/'\r
+# Use our own special initializer and finalizer files for libc.so.\r
+$(common-objpfx)libc.so: $(elfobjdir)/soinit.os \\r
+ $(common-objpfx)libc_pic.os \\r
+ $(elfobjdir)/sofini.os \\r
+ $(elfobjdir)/interp.os $(elfobjdir)/ld.so\r
+ $(build-shlib)\r
+ifeq ($(versioning),yes)\r
+$(common-objpfx)libc.so: $(common-objpfx)libc.map\r
+endif\r
+common-generated += libc.so libc_pic.os\r
+ifdef libc.so-version\r
+$(common-objpfx)libc.so$(libc.so-version): $(common-objpfx)libc.so\r
+ $(make-link)\r
+common-generated += libc.so$(libc.so-version)\r
+endif\r
+endif\r
+else\r
+ifneq (,$(findstring aix,$(config-os)))\r
+$(common-objpfx)libc.so: $(common-objpfx)libc_pic.a\r
+ @rm -f $@\r
+ (echo '#!'; \\r
+ dump -g $^ | sed '1,6d' | cut -f2 | sort | uniq) > $(^:a=exp)\r
+ sed '/__mulh/d;/__mull/d;/__divss/d;/__divus/d;/__quoss/d;/__quous/d' \\r
+ /lib/syscalls.exp > $(common-objpfx)syscalls.exp\r
+ $(LINK.o) -G -bM:SRE -bnoentry -bE:$(^:a=exp) \\r
+ -bE:$(common-objpfx)syscalls.exp \\r
+ -bI:$(common-objpfx)syscalls.exp \\r
+ -L$(common-objpfx) -o $@ $^\r
+# AIX runtime ld wants libc.so to be libc.a(shr.o) hardwired\r
+ cp $@ $(common-objpfx)shr.o\r
+ $(AR) $(ARFLAGS) $(common-objpfx)libc.a $(common-objpfx)shr.o\r
+endif\r
+endif\r
+\f\r
+# Figure out the source filenames in this directory.\r
+\r
+override sources := $(addsuffix .c,\\r
+ $(filter-out $(elided-routines),\\r
+ $(routines) $(aux) \\r
+ $(sysdep_routines)))\r
+sysdep_routines := $(sysdep_routines)\r
+\r
+headers := $(headers) $(sysdep_headers)\r
+\r
+# This is the list of all object files, gotten by\r
+# replacing every ".c" in `sources' with a ".o".\r
+# We also add bounded-pointer thunks, which are later\r
+# elided for all suffixes except for `.ob'.\r
+override objects := $(addprefix $(objpfx),$(sources:.c=.o) \\r
+ $(patsubst %,$(bppfx)%.o,\\r
+ $(filter $(routines) $(sysdep_routines),$(bp-thunks))))\r
+\r
+\r
+# The makefile may define $(extra-libs) with `libfoo libbar'\r
+# to build libfoo.a et al from the modules listed in $(libfoo-routines).\r
+ifdef extra-libs\r
+# extra-lib.mk is included once for each extra lib to define rules\r
+# to build it, and to add its objects to the various variables.\r
+# During its evaluation, $(lib) is set to the name of the library.\r
+extra-libs-left := $(extra-libs)\r
+include $(patsubst %,$(..)extra-lib.mk,$(extra-libs))\r
+endif\r
+\f\r
++depfiles := $(sources:.c=.d) \\r
+ $(patsubst %.o,%.d,$(filter %.o,$(extra-objs:.os=.o))) \\r
+ $(addsuffix .d,$(tests) $(xtests) $(test-srcs))\r
+ifeq ($(build-programs),yes)\r
++depfiles += $(addsuffix .d,$(others) $(sysdep-others))\r
+endif\r
++depfiles := $(addprefix $(objpfx),\\r
+ $(filter-out $(addsuffix .d,$(omit-deps)),\\r
+ $(+depfiles)))\r
+\r
+ifdef +depfiles\r
+ifneq ($(no_deps),t)\r
+-include $(+depfiles)\r
+endif\r
+endif\r
+\f\f\r
+# Maximize efficiency by minimizing the number of rules.\r
+.SUFFIXES: # Clear the suffix list. We don't use suffix rules.\r
+# Don't define any builtin rules.\r
+MAKEFLAGS := $(MAKEFLAGS)r\r
+\r
+# Generic rule for making directories.\r
+%/:\r
+# mkdir isn't smart enough to strip a trailing /.\r
+ mkdir $(@:%/=%)\r
+\f\r
+# Make sure that object files are not removed\r
+# when they are intermediates between sources and library members.\r
+.PRECIOUS: $(addprefix $(objpfx)%,$(all-object-suffixes))\r
+\r
+# Make sure that the parent library archive is never removed.\r
+.PRECIOUS: $(foreach l,$(libtypes),$(patsubst %,$(common-objpfx)$l,c))\r
+\f\r
+# Use the verbose option of ar and tar when not running silently.\r
+ifeq "$(findstring s,$(MAKEFLAGS))" "" # if not -s\r
+verbose := v\r
+else # -s\r
+verbose :=\r
+endif # not -s\r
+\r
+ARFLAGS := r$(verbose)\r
+CREATE_ARFLAGS := cru$(verbose)\r
+\f\r
+# This makes all the object files in the parent library archive.\r
+\r
+.PHONY: lib lib-noranlib\r
+lib: lib-noranlib $(foreach l,$(libtypes),$(patsubst %,$(common-objpfx)$l,c))\r
+lib-noranlib: libobjs\r
+\r
+# For object-suffix $o, the list of objects with that suffix.\r
+# Makefiles can define `elide-routines.so = foo' to leave foo.so out.\r
+o-objects = $(patsubst %.o,%$o,$(filter-out $(patsubst %,$(objpfx)%.o,\\r
+ $(elide-routines$o)),\\r
+ $(objects))) \\r
+ $(addprefix $(objpfx),$(o-objects$o))\r
+\r
+others: $(addprefix $(objpfx),$(install-lib))\r
+\r
+ifndef objects\r
+\r
+# Create the stamp$o files to keep the parent makefile happy.\r
+subdir_lib: $(foreach o,$(object-suffixes-for-libc),$(objpfx)stamp$o)\r
+$(foreach o,$(object-suffixes-for-libc),$(objpfx)stamp$o):\r
+ $(make-target-directory)\r
+ rm -f $@; > $@\r
+else\r
+\r
+# Define explicit rules to update each $(objpfx)stamp.SUFFIX\r
+# timestamp file; these rules (one explicit rule is generated for each\r
+# object suffix) write a list of objects to update in the stamp file.\r
+# The parent will then actually add them all to the archive in the\r
+# archive rule, below.\r
+define o-iterator-doit\r
+$(objpfx)stamp$o: $(o-objects); $$(do-stamp)\r
+endef\r
+define do-stamp\r
+echo '$(patsubst $(objpfx)%,$(addsuffix /,$(subdir))%,$^)' > $@T\r
+mv -f $@T $@\r
+endef\r
+object-suffixes-left := $(object-suffixes-for-libc)\r
+include $(o-iterator)\r
+\r
+endif\r
+\r
+# Now define explicit rules to build the library archives; these depend\r
+# on the stamp files built above.\r
+define o-iterator-doit\r
+$(common-objpfx)$(patsubst %,$(libtype$o),c): \\r
+ $(subdirs-stamp-o) $(common-objpfx)stamp$o; $$(do-makelib)\r
+endef\r
+define do-makelib\r
+cd $(common-objdir) && \\r
+$(AR) $(CREATE_ARFLAGS) $(@F) `cat $(patsubst $(common-objpfx)%,%,$^)`\r
+$(RANLIB) $@\r
+endef\r
+subdirs-stamps := $(foreach d,$(subdirs),$(common-objpfx)$d/stamp%)\r
+subdirs-stamp-o = $(subst %,$o,$(subdirs-stamps))\r
+ifndef subdir\r
+$(subdirs-stamps): subdir_lib;\r
+endif\r
+object-suffixes-left = $(object-suffixes-for-libc)\r
+include $(o-iterator)\r
+\r
+\r
+# This makes all the object files.\r
+.PHONY: objects objs libobjs extra-objs\r
+objects objs: libobjs extra-objs\r
+libobjs: $(foreach o,$(object-suffixes-for-libc),$(objpfx)stamp$o)\r
+extra-objs: $(addprefix $(objpfx),$(extra-objs))\r
+\r
+# Canned sequence for building an extra library archive.\r
+define build-extra-lib\r
+$(patsubst %/,cd % &&,$(objpfx)) \\r
+$(AR) $(CREATE_ARFLAGS) $(@:$(objpfx)%=%) \\r
+ $(patsubst $(objpfx)%,%,$^)\r
+$(RANLIB) $@\r
+endef\r
+\f\r
+# Installation.\r
+\r
+.PHONY: force-install\r
+force-install:\r
+\r
+# $(install-lib) are installed from the object directory into $(libdir);\r
+# files in $(install-lib) matching `lib%.a' are ranlib'd after installation\r
+# unless they also appear in $(non-lib.a). $(install-data) are installed\r
+# as they are into $(datadir). $(headers) are installed as they are in\r
+# $(includedir). $(install-bin), $(install-bin-script) and $(install-sbin)\r
+# are installed from the object directory into $(bindir), $(bindir) and\r
+# $(sbindir), respectively. $(install-others) are absolute path names of\r
+# files to install; rules to install them are defined elsewhere.\r
+\r
+# The simple library name to install libc.a under.\r
+# This could be defined by a sysdep Makefile.\r
+ifndef libc-name\r
+libc-name := c\r
+endif\r
+\r
+define do-install\r
+$(make-target-directory)\r
+$(INSTALL_DATA) $< $@\r
+endef\r
+\r
+# Make the target directory if it doesn't exist, using the `mkinstalldirs'\r
+# script that does `mkdir -p' even if `mkdir' doesn't support that flag.\r
+define make-target-directory\r
+$(addprefix $(..)./scripts/mkinstalldirs ,\\r
+ $(filter-out $(wildcard $(@D:%/=%)),$(@D:%/=%)))\r
+endef\r
+\r
+# Any directory (parent or subdir) should install libc.a; this way\r
+# "make install" in a subdir is guaranteed to install everything it changes.\r
+installed-libcs := $(foreach o,$(filter-out .os,$(object-suffixes-for-libc)),\\r
+ $(inst_libdir)/$(patsubst %,$(libtype$o),\\r
+ $(libprefix)$(libc-name)))\r
+install: $(installed-libcs)\r
+$(installed-libcs): $(inst_libdir)/lib$(libprefix)%: lib $(+force)\r
+ $(make-target-directory)\r
+ $(INSTALL_DATA) $(common-objpfx)lib$(*:$(libc-name)%=c%) $@\r
+# Running ranlib after installing makes the __.SYMDEF time stamp up to\r
+# date, which avoids messages from some linkers.\r
+ $(RANLIB) $@\r
+\r
+define do-install-program\r
+$(make-target-directory)\r
+$(INSTALL_PROGRAM) $< $@.new\r
+mv -f $@.new $@\r
+endef\r
+\r
+define do-install-script\r
+$(make-target-directory)\r
+$(INSTALL_SCRIPT) $< $@.new\r
+mv -f $@.new $@\r
+endef\r
+\r
+install-lib.so := $(filter %.so,$(install-lib:%_pic.a=%.so))\r
+install-lib := $(filter-out %.so %_pic.a,$(install-lib))\r
+\r
+ifeq (yes,$(build-shared))\r
+# Find which .so's have versions.\r
+versioned := $(strip $(foreach so,$(install-lib.so),\\r
+ $(patsubst %,$(so),$($(so)-version))))\r
+\r
+install-lib.so-versioned := $(filter $(versioned), $(install-lib.so))\r
+install-lib.so-unversioned := $(filter-out $(versioned), $(install-lib.so))\r
+\r
+install-lib-nosubdir: $(install-lib.so-versioned:%=$(inst_libdir)/%) \\r
+ $(install-lib.so-unversioned:%=$(inst_slibdir)/%)\r
+\r
+# Install all the unversioned shared libraries.\r
+$(install-lib.so-unversioned:%=$(inst_slibdir)/%): $(inst_slibdir)/%.so: \\r
+ $(objpfx)%.so $(+force)\r
+ $(do-install-program)\r
+\r
+ifneq ($(findstring -s,$(LN_S)),)\r
+define make-link\r
+rm -f $@.new\r
+$(SHELL) $(..)scripts/rellns-sh $< $@.new\r
+mv -f $@.new $@\r
+endef\r
+else\r
+# If we have no symbolic links don't bother with rellns-sh.\r
+define make-link\r
+rm -f $@.new\r
+$(LN_S) $< $@.new\r
+mv -f $@.new $@\r
+endef\r
+endif\r
+\r
+ifeq (yes,$(build-shared))\r
+ifeq (no,$(cross-compiling))\r
+symbolic-link-prog := $(common-objpfx)elf/sln\r
+symbolic-link-list := $(common-objpfx)elf/symlink.list\r
+define make-shlib-link\r
+echo $(<F) $@ >> $(symbolic-link-list)\r
+endef\r
+else # cross-compiling\r
+# We need a definition that can be used by elf/Makefile's install rules.\r
+symbolic-link-prog = $(LN_S)\r
+endif\r
+endif\r
+ifndef make-shlib-link\r
+define make-shlib-link\r
+rm -f $@\r
+$(LN_S) $(<F) $@\r
+endef\r
+endif\r
+\r
+ifdef libc.so-version\r
+# For a library specified to be version N, install three files:\r
+# libc.so -> libc.so.N (e.g. libc.so.6)\r
+# libc.so.6 -> libc-VERSION.so (e.g. libc-1.10.so)\r
+\r
+$(inst_slibdir)/libc.so$(libc.so-version): $(inst_slibdir)/libc-$(version).so \\r
+ $(+force)\r
+ $(make-shlib-link)\r
+$(inst_slibdir)/libc-$(version).so: $(common-objpfx)libc.so $(+force)\r
+ $(do-install-program)\r
+install: $(inst_slibdir)/libc.so$(libc.so-version)\r
+\r
+# This fragment of linker script gives the OUTPUT_FORMAT statement\r
+# for the configuration we are building. We put this statement into\r
+# the linker scripts we install for -lc et al so that they will not be\r
+# used by a link for a different format on a multi-architecture system.\r
+$(common-objpfx)format.lds: $(..)scripts/output-format.sed \\r
+ $(common-objpfx)config.make \\r
+ $(common-objpfx)config.h $(..)Makerules\r
+ $(LINK.o) -shared $(sysdep-LDFLAGS) $(config-LDFLAGS) $(LDFLAGS.so) \\r
+ -x c /dev/null -o $@.so -Wl,--verbose -v 2>&1 \\r
+ | sed -n -f $< > $@.new\r
+ rm -f $@.so\r
+ mv -f $@.new $@\r
+common-generated += format.lds\r
+\r
+ifndef subdir\r
+# What we install as libc.so for programs to link against is in fact a\r
+# link script. It contains references for the various libraries we need.\r
+# The libc.so object is not complete since some functions are only defined\r
+# in libc_nonshared.a.\r
+# We need to use absolute paths since otherwise local copies (if they exist)\r
+# of the files are taken by the linker.\r
+install: $(inst_libdir)/libc.so\r
+$(inst_libdir)/libc.so: $(common-objpfx)format.lds \\r
+ $(common-objpfx)libc.so$(libc.so-version) \\r
+ $(inst_libdir)/$(patsubst %,$(libtype.oS),\\r
+ $(libprefix)$(libc-name)) \\r
+ $(+force)\r
+ (echo '/* GNU ld script';\\r
+ echo ' Use the shared library, but some functions are only in';\\r
+ echo ' the static library, so try that secondarily. */';\\r
+ cat $<; \\r
+ echo 'GROUP ( $(slibdir)/libc.so$(libc.so-version)' \\r
+ '$(libdir)/$(patsubst %,$(libtype.oS),$(libprefix)$(libc-name))'\\r
+ ')' \\r
+ ) > $@.new\r
+ mv -f $@.new $@\r
+\r
+endif\r
+\r
+else\r
+install: $(inst_slibdir)/libc.so\r
+$(inst_slibdir)/libc.so: $(common-objpfx)libc.so $(+force)\r
+ $(do-install-program)\r
+endif\r
+\r
+ifneq (,$(versioned))\r
+# Produce three sets of rules as above for all the smaller versioned libraries.\r
+\r
+define o-iterator-doit\r
+$(inst_libdir)/$o: $(inst_slibdir)/$o$($o-version) $(+force); $$(make-link)\r
+endef\r
+object-suffixes-left := $(versioned)\r
+include $(o-iterator)\r
+\r
+# Make symlinks in the build directory, because the versioned names might\r
+# be referenced by a DT_NEEDED in another library.\r
+define o-iterator-doit\r
+$(objpfx)$o$($o-version): $(objpfx)$o; $$(make-link)\r
+endef\r
+object-suffixes-left := $(versioned)\r
+include $(o-iterator)\r
+\r
+generated += $(foreach o,$(versioned),$o$($o-version))\r
+\r
+ifeq (,$($(subdir)-version))\r
+define o-iterator-doit\r
+$(inst_slibdir)/$o$($o-version): $(inst_slibdir)/$(o:.so=)-$(version).so \\r
+ $(+force);\r
+ $$(make-shlib-link)\r
+endef\r
+object-suffixes-left := $(versioned)\r
+include $(o-iterator)\r
+\r
+define o-iterator-doit\r
+$(inst_slibdir)/$(o:.so=)-$(version).so: $(objpfx)$o $(+force);\r
+ $$(do-install-program)\r
+endef\r
+object-suffixes-left := $(versioned)\r
+include $(o-iterator)\r
+else\r
+define o-iterator-doit\r
+$(inst_slibdir)/$o$($o-version): \\r
+ $(inst_slibdir)/$(o:.so=)-$($(subdir)-version).so $(+force);\r
+ $$(make-shlib-link)\r
+endef\r
+object-suffixes-left := $(versioned)\r
+include $(o-iterator)\r
+\r
+define o-iterator-doit\r
+$(inst_slibdir)/$(o:.so=)-$($(subdir)-version).so: $(objpfx)$o $(+force);\r
+ $$(do-install-program)\r
+endef\r
+object-suffixes-left := $(versioned)\r
+include $(o-iterator)\r
+endif\r
+endif\r
+\r
+define do-install-so\r
+$(do-install-program)\r
+$(patsubst %,ln -s -f $(@F) $(@D)/$(patsubst %$*.so,%,$(<F))$(libprefix)$*.so,\\r
+ $(filter-out %.so,$@))\r
+endef\r
+\r
+so-versions := $(sort $(foreach so,$(install-lib.so),.so$($(so)-version)))\r
+$(foreach v,$(so-versions),\\r
+ $(inst_slibdir)/lib$(libprefix)%$v): $(common-objpfx)lib%.so \\r
+ $(+force)\r
+ $(do-install-so)\r
+$(foreach v,$(so-versions),\\r
+ $(inst_slibdir)/$(libprefix)%$v): $(common-objpfx)%.so $(+force)\r
+ $(do-install-so)\r
+endif\r
+\r
+ifdef install-bin\r
+$(addprefix $(inst_bindir)/,$(install-bin)): \\r
+ $(inst_bindir)/%: $(objpfx)% $(+force)\r
+ $(do-install-program)\r
+endif\r
+ifdef install-bin-script\r
+$(addprefix $(inst_bindir)/,$(install-bin-script)): \\r
+ $(inst_bindir)/%: $(objpfx)% $(+force)\r
+ $(do-install-script)\r
+endif\r
+ifdef install-rootsbin\r
+$(addprefix $(inst_rootsbindir)/,$(install-rootsbin)): \\r
+ $(inst_rootsbindir)/%: $(objpfx)% $(+force)\r
+ $(do-install-program)\r
+endif\r
+ifdef install-sbin\r
+$(addprefix $(inst_sbindir)/,$(install-sbin)): \\r
+ $(inst_sbindir)/%: $(objpfx)% $(+force)\r
+ $(do-install-program)\r
+endif\r
+ifdef install-lib\r
+install-lib.a := $(filter lib%.a,$(install-lib))\r
+install-lib-non.a := $(filter-out lib%.a,$(install-lib))\r
+ifdef install-lib-non.a\r
+$(addprefix $(inst_libdir)/$(libprefix),$(install-lib-non.a)): \\r
+ $(inst_libdir)/$(libprefix)%: $(objpfx)% $(+force)\r
+ $(do-install)\r
+endif\r
+ifdef install-lib.a\r
+$(install-lib.a:lib%.a=$(inst_libdir)/lib$(libprefix)%.a): \\r
+ $(inst_libdir)/lib$(libprefix)%.a: $(objpfx)lib%.a $(+force)\r
+ $(do-install)\r
+ $(patsubst %,$(RANLIB) $@,$(filter-out $(non-lib.a),$(<F)))\r
+endif\r
+endif\r
+ifdef install-data\r
+$(addprefix $(inst_datadir)/,$(install-data)): $(inst_datadir)/%: % $(+force)\r
+ $(do-install)\r
+endif\r
+headers := $(strip $(headers))\r
+ifdef headers\r
+$(addprefix $(inst_includedir)/,$(headers)): $(inst_includedir)/%: % $(+force)\r
+ $(do-install)\r
+endif # headers\r
+\r
+.PHONY: install-bin-nosubdir install-bin-script-nosubdir \\r
+ install-rootsbin-nosubdir install-sbin-nosubdir install-lib-nosubdir \\r
+ install-data-nosubdir install-headers-nosubdir\r
+install-bin-nosubdir: $(addprefix $(inst_bindir)/,$(install-bin))\r
+install-bin-script-nosubdir: $(addprefix $(inst_bindir)/,$(install-bin-script))\r
+install-rootsbin-nosubdir: \\r
+ $(addprefix $(inst_rootsbindir)/,$(install-rootsbin))\r
+install-sbin-nosubdir: $(addprefix $(inst_sbindir)/,$(install-sbin))\r
+install-lib-nosubdir: $(addprefix $(inst_libdir)/,\\r
+ $(patsubst lib%.a,lib$(libprefix)%.a,$(install-lib.a)) \\r
+ $(addprefix $(libprefix),$(install-lib-non.a)))\r
+install-data-nosubdir: $(addprefix $(inst_datadir)/,$(install-data))\r
+install-headers-nosubdir: $(addprefix $(inst_includedir)/,$(headers))\r
+install-others-nosubdir: $(install-others)\r
+\r
+# We need all the `-nosubdir' targets so that `install' in the parent\r
+# doesn't depend on several things which each iterate over the subdirs.\r
+# This rule makes `install-FOO' always use `install-FOO-nosubdir' as a\r
+# subroutine. Then in the parent `install-FOO' also causes subdir makes.\r
+install-%:: install-%-nosubdir ;\r
+\r
+.PHONY: install install-no-libc.a-nosubdir\r
+ifeq ($(build-programs),yes)\r
+install-no-libc.a-nosubdir: install-headers-nosubdir install-data-nosubdir\\r
+ install-bin-nosubdir install-bin-script-nosubdir \\r
+ install-lib-nosubdir install-others-nosubdir \\r
+ install-rootsbin-nosubdir install-sbin-nosubdir\r
+else\r
+install-no-libc.a-nosubdir: install-headers-nosubdir install-data-nosubdir\\r
+ install-lib-nosubdir install-others-nosubdir\r
+endif\r
+install: install-no-libc.a-nosubdir\r
+\f\r
+# Command to compile $< in $(objdir) using the native libraries.\r
+define native-compile\r
+$(make-target-directory)\r
+$(patsubst %/,cd % &&,$(objpfx)) \\r
+$(BUILD_CC) $($(basename $(<F))-CFLAGS) $(ALL_BUILD_CFLAGS) \\r
+ $(firstword $(filter /%,$< $(shell pwd)/$<)) -o $(@F)\r
+endef\r
+\r
+# Command to compile $< in $(common-objdir) using the native libraries.\r
+# We must cd to $(objdir) anyway so that $(..)config.h is valid.\r
+define common-objdir-compile\r
+$(patsubst %/,cd % &&,$(objpfx)) \\r
+$(BUILD_CC) $($(basename $(<F))-CFLAGS) $(ALL_BUILD_CFLAGS) \\r
+ $(firstword $(filter /%,$< $(shell pwd)/$<)) -o $(..)$(@F)\r
+endef\r
+\r
+# We always want to use configuration definitions.\r
+# Note that this is only used for commands running in $(objpfx).\r
+ALL_BUILD_CFLAGS = $(BUILD_CFLAGS) -include $(..)config.h\r
+\r
+# Support the GNU standard name for this target.\r
+.PHONY: check\r
+check: tests\r
+# Special target to run tests which cannot be run unconditionally.\r
+# Maintainers should use this target.\r
+.PHONY: xcheck\r
+xcheck: xtests\r
+\r
+all-nonlib = $(strip $(tests) $(xtests) $(test-srcs) $(test-extras) $(others))\r
+ifneq (,$(all-nonlib))\r
+cpp-srcs-left = $(all-nonlib:=.c)\r
+lib := nonlib\r
+include $(patsubst %,$(..)cppflags-iterator.mk,$(all-nonlib))\r
+endif\r
+\r
+# The include magic above causes those files to use this variable for flags.\r
+CPPFLAGS-nonlib = -DNOT_IN_libc=1\r
+\r
+\r
+ifeq ($(versioning),yes)\r
+# Generate normalized lists of symbols, versions, and data sizes.\r
+# This is handy for checking against existing library binaries.\r
+\r
+%.symlist: $(..)scripts/abilist.awk %.dynsym\r
+ $(AWK) -f $^ > $@T\r
+ mv -f $@T $@\r
+\r
+%.dynsym: %.so\r
+ $(OBJDUMP) --dynamic-syms $< > $@T\r
+ mv -f $@T $@\r
+\r
+tests: $(patsubst %.so,$(objpfx)%.symlist,$(install-lib.so-versioned))\r
+generated += $(install-lib.so-versioned:.so=.symlist)\r
+\r
+ifeq ($(subdir),elf)\r
+tests: $(common-objpfx)libc.symlist\r
+common-generated += libc.symlist\r
+endif\r
+endif\r
+\f\r
+.PHONY: TAGS\r
+TAGS: $(objpfx)distinfo $(..)MakeTAGS\r
+ $(MAKE) $(addprefix -f ,$^) $@\r
+\r
+$(..)po/%.pot: $(objpfx)distinfo $(..)MakeTAGS FORCE\r
+ $(MAKE) $(addprefix -f ,$(filter-out FORCE,$^)) $@\r
+FORCE:\r
+\r
+\r
+.PHONY: echo-headers\r
+echo-headers:\r
+ @echo $(headers)\r
+\r
+\f\r
+# Common cleaning targets.\r
+\r
+.PHONY: common-mostlyclean common-clean mostlyclean clean do-tests-clean\r
+clean: common-clean\r
+mostlyclean: common-mostlyclean\r
+\r
+do-tests-clean:\r
+ -rm -f $(addprefix $(objpfx),$(addsuffix .out,$(tests) $(xtests) \\r
+ $(test-srcs)) \\r
+ $(addsuffix -bp.out,$(tests) $(xtests) \\r
+ $(test-srcs)))\r
+\r
+# Remove the object files.\r
+common-mostlyclean:\r
+ -rm -f $(addprefix $(objpfx),$(tests) $(xtests) $(test-srcs) \\r
+ $(others) $(sysdep-others) stubs \\r
+ $(addsuffix .o,$(tests) $(xtests) \\r
+ $(test-srcs) $(others) \\r
+ $(sysdep-others)) \\r
+ $(addsuffix -bp,$(tests) $(xtests) \\r
+ $(test-srcs)) \\r
+ $(addsuffix .out,$(tests) $(xtests) \\r
+ $(test-srcs)) \\r
+ $(addsuffix -bp.out,$(tests) $(xtests) \\r
+ $(test-srcs)))\r
+ -rm -f $(addprefix $(objpfx),$(extra-objs) $(install-lib) \\r
+ $(install-lib.so) \\r
+ $(install-lib.so:%.so=%_pic.a))\r
+ -rm -f core\r
+ -rm -f $(objpfx)rtld-*.os\r
+ $(rmobjs)\r
+define rmobjs\r
+$(foreach o,$(object-suffixes-for-libc),\r
+-rm -f $(objpfx)stamp$o $(o-objects))\r
+endef\r
+\r
+# Also remove the dependencies and generated source files.\r
+common-clean: common-mostlyclean\r
+ -rm -f $(addprefix $(objpfx),$(generated)) $(+depfiles)\r
+ -rm -f $(objpfx)rtld-*.d\r
+ -rm -fr $(addprefix $(objpfx),$(generated-dirs))\r
+ -rm -f $(addprefix $(common-objpfx),$(common-generated))\r
+ -rm -f $(objpfx)distinfo\r
+\f\r
+# Produce a file `stubs' which contains `#define __stub_FUNCTION'\r
+# for each function which is a stub. We grovel over all the .d files\r
+# looking for references to <stub-tag.h>. Then we grovel over each\r
+# referenced source file to see what stub function it defines.\r
+\r
+ifdef objpfx\r
+.PHONY: stubs # The parent Makefile calls this target.\r
+stubs: $(objpfx)stubs\r
+endif\r
+s = $(sysdep_dir)/generic\r
+$(objpfx)stubs: $(+depfiles)\r
+# Use /dev/null since `...` might expand to empty.\r
+ (s=`cd $s && $(PWD_P)`; \\r
+ $(patsubst %/,cd % &&,$(objpfx)) \\r
+ sed -n 's/^stub_warning *(\([^)]*\).*$$/#define __stub_\1/p' \\r
+ `sed -n -e '\@ $s/[^ ]*\.c@{; s@^.* $s/\([^ ]*\.c\).*$$@'"$$s"'/\1@; h; }' \\r
+ -e '/stub-tag\.h/{; g; p; }' \\r
+ $(patsubst $(objpfx)%,%,$^) /dev/null` \\r
+ /dev/null) > $@T\r
+ mv -f $@T $@\r
+\f\r
+# Make the distribution tar file.\r
+\r
+.PHONY: dist\r
+dist: $(objpfx)distinfo $(..)Make-dist\r
+ $(MAKE) -f $< -f $(word 2,$^) $(Make-dist-args)\r
+\r
+# Avoid depending on source files found in sysdeps dirs,\r
+# because the references affect implicit rule selection.\r
+dist: $(filter-out %.c %.S %.s,$(distribute))\r
+\r
+# We used to simply export all these variables, but that frequently made the\r
+# environment get too large. Instead, we write all the information into\r
+# a generated makefile fragment `distinfo', and then include it with -f in\r
+# the sub-make that makes the distribution (above).\r
+$(objpfx)distinfo: Makefile $(..)Makerules \\r
+ $(wildcard $(foreach dir,$(sysdirs),$(dir)/Makefile))\r
+ $(make-target-directory)\r
+ $(distinfo-vars)\r
+ mv -f $@.new $@\r
+.PHONY: subdir_distinfo\r
+subdir_distinfo: $(objpfx)distinfo\r
+\r
+define distinfo-vars\r
+rm -f $@.new\r
+echo > $@.new 'subdir := $(subdir)'\r
+$(foreach var,subdir-dirs sources elided-routines sysdep_routines \\r
+ headers sysdep_headers distribute dont_distribute generated \\r
+ others tests xtests test-srcs extra-libs versioned \\r
+ $(extra-libs:%=%-routines) \\r
+ $(addprefix install-,lib lib.so data bin bin-script sbin others),\r
+echo >> $@.new '$(subdir)-$(var) := $($(var))'\r
+echo >> $@.new '$(var) = $$($(subdir)-$(var))')\r
+endef\r
+\f\r
+ifneq (,$(strip $(gpl2lgpl)))\r
+ifneq (,$(wildcard $(..)gpl2lgpl.sed))\r
+# Snarf from the master source and frob the copying notice.\r
+$(gpl2lgpl): %: $(..)gpl2lgpl.sed /home/gd/gnu/lib/%\r
+ sed -f $^ > $@-tmp\r
+# So I don't edit them by mistake.\r
+ chmod a-w $@-tmp\r
+ mv -f $@-tmp $@\r
+ifeq ($(with-cvs),yes)\r
+ test ! -d CVS || cvs $(CVSOPTS) commit -m'Updated from $^' $@\r
+endif\r
+endif\r
+endif\r
+\r
+# Local Variables:\r
+# mode: makefile\r
+# End:\r