2013-01-02 19:01:50 +00:00
|
|
|
|
# Copyright (C) 1991-2013 Free Software Foundation, Inc.
|
2002-12-27 20:13:29 +00:00
|
|
|
|
# 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
|
2012-02-09 23:18:22 +00:00
|
|
|
|
# License along with the GNU C Library; if not, see
|
|
|
|
|
# <http://www.gnu.org/licenses/>.
|
2002-12-27 20:13:29 +00:00
|
|
|
|
|
|
|
|
|
#
|
|
|
|
|
# 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
|
|
|
|
|
|
|
|
|
|
ifndef +included-Makeconfig
|
|
|
|
|
include $(..)Makeconfig
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
# 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))
|
|
|
|
|
|
|
|
|
|
# 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
|
|
|
|
|
|
* Makefile (subdir-target-args): New variable.
($(all-subdirs-targets)): Use it in place of -C option.
* Rules: Use $(..) instead of ../ if it's already defined.
* Makeconfig (subdir-srcdirs): New variable.
* csu/Makefile (all-Banner-files): Use it.
* configure.in (--enable-add-ons): Set to "yes" by default.
Handle absolute add-on directory names when looking for configure
fragments. Also look for sysdeps/*/preconfigure fragments in add-ons.
Require add-on configure to set $libc_add_on_canonical, use
that in $add_ons_sfx. Substitute add_on_subdirs with computed list
of subdir names each add-on configure set in libc_add_on_subdirs.
* configure: Regenerated.
* Makefile (%/preconfigure: %/preconfigure.in): New pattern rule.
* config.make.in (add-on-subdirs): New substituted variable.
* Makeconfig (all-subdirs): Include $(add-on-subdirs).
Remove $(add-ons), $(sysdep-subdirs).
Don't filter out $(sysdep-inhibit-subdirs).
($(common-objpfx)sysd-dirs): Target removed. Don't include it.
($(common-objpfx)sysd-sorted): Rewritten to feed Depend and Subdirs
files together to gen-sorted.awk, and $(subdirs) via -v.
(subdirs): Remove magic reordering for mach and hurd.
* scripts/gen-sorted.awk: Use subdirs from command line.
Process Subdirs and Depend files directly.
Let Subdirs files use "first dir" and "inhibit dir".
Always move elf to the end of the list.
* hurd/Depend: New file.
* sysdeps/mach/Subdirs: Use "first mach".
* Makefile (dist-separate): Remove linuxthreads.
(dist-separate-linuxthreads): Variable removed.
(glibc-%.tar rule): Use $(sysdeps-add-ons).
* Makerules ($(common-objpfx)Versions.v.i): Use $(subdirs),
not $(all-subdirs).
(sysdep-makefiles): Use $(sysdirs).
(sysdirs): Remove export.
($(+sysdir_pfx)sysd-rules): Handle absolute directory names in
$(config-sysdirs).
(+sysdir_pfx): Variable removed.
(sysd-rules): Use $(common-objpfx) in place of it.
(sysdirs): Variable moved to ...
* Makeconfig (sysdirs): ... here.
Handle absolute directory names in $(config-sysdirs).
(full_config_sysdirs): Variable removed.
* csu/Makefile: Use $(sysdirs) in vpath directive.
* math/Makefile (ulps-file): Use $(sysdirs).
* sysdeps/gnu/Makefile (errlist-c): Likewise.
($(objpfx)errlist-compat.c): Likewise.
* Makeconfig (all-Subdirs-files): Likewise.
($(common-objpfx)config.status): Likewise.
* configure.in (sysnames): Handle absolute add-on directory names.
(sysdeps_add_ons): New variable, AC_SUBST it.
Compute which add-ons contributed sysdeps directories.
* configure: Regenerated.
* config.make.in (sysdeps-add-ons): New substituted variable.
* Makerules (+sysdep_dirs, +sysdep-includes): Variables moved ...
* Makeconfig: ... to here.
(+sysdep_dirs): Append $(sysdeps-add-ons) here.
(+includes): Remove $(objpfx) include, already in $(+sysdep_dirs).
Remove $(includes).
(sysdep-makeconfigs): Use $(+sysdep_dirs).
($(common-objpfx)shlib-versions.v.i): Likewise.
* Makeconfig: Remove hair to set Makeconfig-add-on.
* sysdeps/unix/Makefile (sysdirs): Remove export.
(asm_CPP): Variable removed.
($(common-objpfx)sysd-syscalls): Pass them directly for the script.
* sysdeps/posix/Makefile: New file.
* Makerules (L_tmpnam, TMP_MAX, L_ctermid, L_cuserid): Set non-posix
values here with ?=.
* stdlib/gen-mpn-copy: File removed.
* stdlib/Makefile (distribute): Remove it.
* configure.in: Don't grok --with-gmp.
* configure: Regenerated.
* configure.in (libc_cv_idn): Don't check it; libidn/configure does it.
* configure: Regenerated.
* bare: Directory removed, saved in ports repository.
2006-02-28 07:11:04 +00:00
|
|
|
|
sysdep-makefiles := $(wildcard $(sysdirs:=/Makefile))
|
2002-12-27 20:13:29 +00:00
|
|
|
|
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.
|
2013-09-04 15:25:42 +00:00
|
|
|
|
ifeq ($(build-shared),yes)
|
2002-12-27 20:13:29 +00:00
|
|
|
|
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
|
2013-09-04 15:25:42 +00:00
|
|
|
|
endif # $(build-shared) = yes
|
2002-12-27 20:13:29 +00:00
|
|
|
|
|
2010-03-15 18:44:58 +00:00
|
|
|
|
ifndef avoid-generated
|
|
|
|
|
before-compile := $(common-objpfx)libc-abis.h $(before-compile)
|
2010-04-09 22:31:45 +00:00
|
|
|
|
$(common-objpfx)libc-abis.h: $(common-objpfx)libc-abis.stamp; @:
|
|
|
|
|
$(common-objpfx)libc-abis.stamp: $(..)scripts/gen-libc-abis \
|
2010-04-08 22:29:19 +00:00
|
|
|
|
$(firstword $(wildcard $(sysdirs:=/libc-abis)) \
|
|
|
|
|
$(..)libc-abis) \
|
|
|
|
|
$(..)Makerules
|
|
|
|
|
$(SHELL) $< \
|
2010-03-15 18:44:58 +00:00
|
|
|
|
$(base-machine)-$(config-vendor)-$(config-os) \
|
2010-04-09 22:31:45 +00:00
|
|
|
|
< $(word 2,$^) > $(@:.stamp=.h)T
|
|
|
|
|
$(move-if-change) $(@:.stamp=.h)T $(@:.stamp=.h)
|
|
|
|
|
touch $@
|
2010-03-15 18:44:58 +00:00
|
|
|
|
common-generated += $(common-objpfx)libc-abis.h
|
|
|
|
|
endif # avoid-generated
|
|
|
|
|
|
2003-05-02 02:20:45 +00:00
|
|
|
|
# Make sure the subdirectory for object files gets created.
|
2002-12-27 20:13:29 +00:00
|
|
|
|
ifdef objpfx
|
2003-05-02 02:20:45 +00:00
|
|
|
|
ifeq (,$(wildcard $(objpfx).))
|
2002-12-27 20:13:29 +00:00
|
|
|
|
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
|
|
|
|
|
|
2003-05-05 19:13:59 +00:00
|
|
|
|
# We don't want $(common-objpfx) files to depend on miscellaneous stuff
|
|
|
|
|
# in subdirs.
|
|
|
|
|
ifdef subdir
|
|
|
|
|
common-before-compile := $(filter-out $(objpfx)%,$(before-compile))
|
|
|
|
|
else
|
|
|
|
|
common-before-compile = $(before-compile)
|
|
|
|
|
endif
|
|
|
|
|
|
2003-05-02 02:20:45 +00:00
|
|
|
|
ifndef subdir
|
2002-12-27 20:13:29 +00:00
|
|
|
|
# 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.
|
2003-05-02 02:20:45 +00:00
|
|
|
|
#
|
|
|
|
|
# We only generate these in the top-level makefile, to avoid any weirdness
|
|
|
|
|
# from subdir-specific makefile tweaks creeping in on an update.
|
2003-05-05 19:13:59 +00:00
|
|
|
|
$(common-objpfx)%.make: $(..)%.make.c $(..)Makerules $(common-before-compile)
|
2002-12-27 20:13:29 +00:00
|
|
|
|
rm -f $@T $@.dT
|
|
|
|
|
(echo '# Generated from $*.make.c by Makerules.'; \
|
2006-03-01 04:20:27 +00:00
|
|
|
|
$(CC) $(CFLAGS) $(CPPFLAGS) -E -DASSEMBLER $< \
|
2003-05-28 21:05:12 +00:00
|
|
|
|
-MD -MP -MT '$$(common-objpfx)$*.make' -MF $@.dT \
|
2002-12-27 20:13:29 +00:00
|
|
|
|
| sed -n '/@@@/{s/@@@[ ]*\(.*\)@@@/\1/;s/[ ]*$$//p;}'; \
|
|
|
|
|
echo 'common-generated += $(@F)'; \
|
2003-01-15 08:08:20 +00:00
|
|
|
|
sed $(sed-remove-objpfx) $(sed-remove-dotdot) $@.dT; \
|
|
|
|
|
rm -f $@.dT) > $@T
|
2002-12-27 20:13:29 +00:00
|
|
|
|
mv -f $@T $@
|
2003-05-02 02:20:45 +00:00
|
|
|
|
endif
|
2003-01-15 08:08:20 +00:00
|
|
|
|
|
2003-01-15 20:24:04 +00:00
|
|
|
|
ifdef subdir
|
2003-05-28 21:05:12 +00:00
|
|
|
|
sed-remove-dotdot := -e 's@ *\.\.\/\([^ \]*\)@ $$(..)\1@g' \
|
|
|
|
|
-e 's@^\.\.\/\([^ \]*\)@$$(..)\1@g'
|
2003-01-15 20:24:04 +00:00
|
|
|
|
else
|
2003-05-28 21:05:12 +00:00
|
|
|
|
sed-remove-dotdot := -e 's@ *\([^ \/$$][^ \]*\)@ $$(..)\1@g' \
|
|
|
|
|
-e 's@^\([^ \/$$][^ \]*\)@$$(..)\1@g'
|
2003-01-15 20:24:04 +00:00
|
|
|
|
endif
|
2003-05-05 19:13:59 +00:00
|
|
|
|
|
|
|
|
|
|
2005-12-22 05:18:34 +00:00
|
|
|
|
ifdef gen-as-const-headers
|
2003-05-05 19:13:59 +00:00
|
|
|
|
# Generating headers for assembly constants.
|
|
|
|
|
# We need this defined early to get into before-compile before
|
|
|
|
|
# it's used in sysd-rules, below.
|
|
|
|
|
$(common-objpfx)%.h $(common-objpfx)%.h.d: $(..)scripts/gen-as-const.awk \
|
|
|
|
|
%.sym $(common-before-compile)
|
|
|
|
|
$(AWK) -f $< $(filter %.sym,$^) \
|
2004-01-15 01:54:31 +00:00
|
|
|
|
| $(CC) -S -o $(@:.h.d=.h)T3 $(CFLAGS) $(CPPFLAGS) -x c - \
|
|
|
|
|
-MD -MP -MF $(@:.h=.h.d)T -MT '$(@:.h=.h.d) $(@:.h.d=.h)'
|
|
|
|
|
sed -n 's/^.*@@@name@@@\([^@]*\)@@@value@@@[^0-9Xxa-fA-F-]*\([0-9Xxa-fA-F-][0-9Xxa-fA-F-]*\).*@@@end@@@.*$$/#define \1 \2/p' \
|
|
|
|
|
$(@:.h.d=.h)T3 > $(@:.h.d=.h)T
|
|
|
|
|
rm -f $(@:.h.d=.h)T3
|
2003-05-05 19:13:59 +00:00
|
|
|
|
sed $(sed-remove-objpfx) $(sed-remove-dotdot) \
|
|
|
|
|
$(@:.h=.h.d)T > $(@:.h=.h.d)T2
|
|
|
|
|
rm -f $(@:.h=.h.d)T
|
|
|
|
|
mv -f $(@:.h=.h.d)T2 $(@:.h=.h.d)
|
|
|
|
|
mv -f $(@:.h.d=.h)T $(@:.h.d=.h)
|
|
|
|
|
vpath %.sym $(sysdirs)
|
|
|
|
|
before-compile += $(gen-as-const-headers:%.sym=$(common-objpfx)%.h)
|
2005-12-22 05:18:34 +00:00
|
|
|
|
|
2005-12-22 23:38:16 +00:00
|
|
|
|
tests += $(gen-as-const-headers:%.sym=test-as-const-%)
|
|
|
|
|
generated += $(gen-as-const-headers:%.sym=test-as-const-%.c)
|
|
|
|
|
$(objpfx)test-as-const-%.c: $(..)scripts/gen-as-const.awk $(..)Makerules \
|
|
|
|
|
%.sym $(common-objpfx)%.h
|
2005-12-22 05:18:34 +00:00
|
|
|
|
($(AWK) '{ sub(/^/, "asconst_", $$2); print; }' $(filter %.h,$^); \
|
|
|
|
|
$(AWK) -v test=1 -f $< $(filter %.sym,$^); \
|
|
|
|
|
echo '#include "$(..)test-skeleton.c"') > $@T
|
|
|
|
|
mv -f $@T $@
|
|
|
|
|
endif
|
2002-12-27 20:13:29 +00:00
|
|
|
|
|
|
|
|
|
# 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.
|
|
|
|
|
|
2013-06-17 16:55:21 +00:00
|
|
|
|
# System-dependent makefiles can put in `inhibit-sysdep-asm' regexps
|
|
|
|
|
# matching sysdep directories whose assembly source files should be
|
|
|
|
|
# suppressed.
|
2002-12-27 20:13:29 +00:00
|
|
|
|
|
* Makefile (subdir-target-args): New variable.
($(all-subdirs-targets)): Use it in place of -C option.
* Rules: Use $(..) instead of ../ if it's already defined.
* Makeconfig (subdir-srcdirs): New variable.
* csu/Makefile (all-Banner-files): Use it.
* configure.in (--enable-add-ons): Set to "yes" by default.
Handle absolute add-on directory names when looking for configure
fragments. Also look for sysdeps/*/preconfigure fragments in add-ons.
Require add-on configure to set $libc_add_on_canonical, use
that in $add_ons_sfx. Substitute add_on_subdirs with computed list
of subdir names each add-on configure set in libc_add_on_subdirs.
* configure: Regenerated.
* Makefile (%/preconfigure: %/preconfigure.in): New pattern rule.
* config.make.in (add-on-subdirs): New substituted variable.
* Makeconfig (all-subdirs): Include $(add-on-subdirs).
Remove $(add-ons), $(sysdep-subdirs).
Don't filter out $(sysdep-inhibit-subdirs).
($(common-objpfx)sysd-dirs): Target removed. Don't include it.
($(common-objpfx)sysd-sorted): Rewritten to feed Depend and Subdirs
files together to gen-sorted.awk, and $(subdirs) via -v.
(subdirs): Remove magic reordering for mach and hurd.
* scripts/gen-sorted.awk: Use subdirs from command line.
Process Subdirs and Depend files directly.
Let Subdirs files use "first dir" and "inhibit dir".
Always move elf to the end of the list.
* hurd/Depend: New file.
* sysdeps/mach/Subdirs: Use "first mach".
* Makefile (dist-separate): Remove linuxthreads.
(dist-separate-linuxthreads): Variable removed.
(glibc-%.tar rule): Use $(sysdeps-add-ons).
* Makerules ($(common-objpfx)Versions.v.i): Use $(subdirs),
not $(all-subdirs).
(sysdep-makefiles): Use $(sysdirs).
(sysdirs): Remove export.
($(+sysdir_pfx)sysd-rules): Handle absolute directory names in
$(config-sysdirs).
(+sysdir_pfx): Variable removed.
(sysd-rules): Use $(common-objpfx) in place of it.
(sysdirs): Variable moved to ...
* Makeconfig (sysdirs): ... here.
Handle absolute directory names in $(config-sysdirs).
(full_config_sysdirs): Variable removed.
* csu/Makefile: Use $(sysdirs) in vpath directive.
* math/Makefile (ulps-file): Use $(sysdirs).
* sysdeps/gnu/Makefile (errlist-c): Likewise.
($(objpfx)errlist-compat.c): Likewise.
* Makeconfig (all-Subdirs-files): Likewise.
($(common-objpfx)config.status): Likewise.
* configure.in (sysnames): Handle absolute add-on directory names.
(sysdeps_add_ons): New variable, AC_SUBST it.
Compute which add-ons contributed sysdeps directories.
* configure: Regenerated.
* config.make.in (sysdeps-add-ons): New substituted variable.
* Makerules (+sysdep_dirs, +sysdep-includes): Variables moved ...
* Makeconfig: ... to here.
(+sysdep_dirs): Append $(sysdeps-add-ons) here.
(+includes): Remove $(objpfx) include, already in $(+sysdep_dirs).
Remove $(includes).
(sysdep-makeconfigs): Use $(+sysdep_dirs).
($(common-objpfx)shlib-versions.v.i): Likewise.
* Makeconfig: Remove hair to set Makeconfig-add-on.
* sysdeps/unix/Makefile (sysdirs): Remove export.
(asm_CPP): Variable removed.
($(common-objpfx)sysd-syscalls): Pass them directly for the script.
* sysdeps/posix/Makefile: New file.
* Makerules (L_tmpnam, TMP_MAX, L_ctermid, L_cuserid): Set non-posix
values here with ?=.
* stdlib/gen-mpn-copy: File removed.
* stdlib/Makefile (distribute): Remove it.
* configure.in: Don't grok --with-gmp.
* configure: Regenerated.
* configure.in (libc_cv_idn): Don't check it; libidn/configure does it.
* configure: Regenerated.
* bare: Directory removed, saved in ports repository.
2006-02-28 07:11:04 +00:00
|
|
|
|
-include $(common-objpfx)sysd-rules
|
2002-12-27 20:13:29 +00:00
|
|
|
|
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
|
2013-06-17 16:55:21 +00:00
|
|
|
|
$(common-objpfx)sysd-rules: $(..)scripts/sysd-rules.awk \
|
|
|
|
|
$(common-objpfx)config.make $(..)Makerules \
|
2008-02-07 00:39:24 +00:00
|
|
|
|
$(sysdep-makefiles) $(sysdep-makeconfigs) \
|
|
|
|
|
$(sysd-rules-force)
|
2002-12-27 20:13:29 +00:00
|
|
|
|
-@rm -f $@T
|
2013-06-17 16:55:21 +00:00
|
|
|
|
LC_ALL=C $(AWK) -f $< > $@T \
|
|
|
|
|
-v all_object_suffixes='$(all-object-suffixes)' \
|
|
|
|
|
-v inhibit_sysdep_asm='$(inhibit-sysdep-asm)' \
|
|
|
|
|
-v sysd_rules_patterns='$(sysd-rules-patterns)' \
|
|
|
|
|
-v config_sysdirs='$(config-sysdirs)'
|
2002-12-27 20:13:29 +00:00
|
|
|
|
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
|
|
|
|
|
|
2005-12-14 08:43:25 +00:00
|
|
|
|
define o-iterator-doit
|
|
|
|
|
$(objpfx)%$o: %.S $(before-compile); $$(compile-command.S)
|
|
|
|
|
endef
|
|
|
|
|
object-suffixes-left := $(all-object-suffixes)
|
|
|
|
|
include $(o-iterator)
|
|
|
|
|
|
|
|
|
|
define o-iterator-doit
|
|
|
|
|
$(objpfx)%$o: %.c $(before-compile); $$(compile-command.c)
|
|
|
|
|
endef
|
|
|
|
|
object-suffixes-left := $(all-object-suffixes)
|
|
|
|
|
include $(o-iterator)
|
|
|
|
|
|
2005-12-23 01:55:26 +00:00
|
|
|
|
define o-iterator-doit
|
|
|
|
|
$(objpfx)%$o: %.cc $(before-compile); $$(compile-command.cc)
|
|
|
|
|
endef
|
|
|
|
|
object-suffixes-left := $(all-object-suffixes)
|
|
|
|
|
include $(o-iterator)
|
|
|
|
|
|
2005-12-14 08:43:25 +00:00
|
|
|
|
# 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)
|
|
|
|
|
|
|
|
|
|
define o-iterator-doit
|
|
|
|
|
$(objpfx)%$o: $(objpfx)%.c $(before-compile); $$(compile-command.c)
|
|
|
|
|
endef
|
|
|
|
|
object-suffixes-left := $(all-object-suffixes)
|
|
|
|
|
include $(o-iterator)
|
|
|
|
|
endif
|
|
|
|
|
|
2002-12-27 20:13:29 +00:00
|
|
|
|
# Generate version maps, but wait until sysdep-subdirs is known
|
|
|
|
|
ifeq ($(sysd-sorted-done),t)
|
2013-09-04 15:25:42 +00:00
|
|
|
|
ifeq ($(build-shared),yes)
|
2002-12-27 20:13:29 +00:00
|
|
|
|
-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
|
* Makefile (subdir-target-args): New variable.
($(all-subdirs-targets)): Use it in place of -C option.
* Rules: Use $(..) instead of ../ if it's already defined.
* Makeconfig (subdir-srcdirs): New variable.
* csu/Makefile (all-Banner-files): Use it.
* configure.in (--enable-add-ons): Set to "yes" by default.
Handle absolute add-on directory names when looking for configure
fragments. Also look for sysdeps/*/preconfigure fragments in add-ons.
Require add-on configure to set $libc_add_on_canonical, use
that in $add_ons_sfx. Substitute add_on_subdirs with computed list
of subdir names each add-on configure set in libc_add_on_subdirs.
* configure: Regenerated.
* Makefile (%/preconfigure: %/preconfigure.in): New pattern rule.
* config.make.in (add-on-subdirs): New substituted variable.
* Makeconfig (all-subdirs): Include $(add-on-subdirs).
Remove $(add-ons), $(sysdep-subdirs).
Don't filter out $(sysdep-inhibit-subdirs).
($(common-objpfx)sysd-dirs): Target removed. Don't include it.
($(common-objpfx)sysd-sorted): Rewritten to feed Depend and Subdirs
files together to gen-sorted.awk, and $(subdirs) via -v.
(subdirs): Remove magic reordering for mach and hurd.
* scripts/gen-sorted.awk: Use subdirs from command line.
Process Subdirs and Depend files directly.
Let Subdirs files use "first dir" and "inhibit dir".
Always move elf to the end of the list.
* hurd/Depend: New file.
* sysdeps/mach/Subdirs: Use "first mach".
* Makefile (dist-separate): Remove linuxthreads.
(dist-separate-linuxthreads): Variable removed.
(glibc-%.tar rule): Use $(sysdeps-add-ons).
* Makerules ($(common-objpfx)Versions.v.i): Use $(subdirs),
not $(all-subdirs).
(sysdep-makefiles): Use $(sysdirs).
(sysdirs): Remove export.
($(+sysdir_pfx)sysd-rules): Handle absolute directory names in
$(config-sysdirs).
(+sysdir_pfx): Variable removed.
(sysd-rules): Use $(common-objpfx) in place of it.
(sysdirs): Variable moved to ...
* Makeconfig (sysdirs): ... here.
Handle absolute directory names in $(config-sysdirs).
(full_config_sysdirs): Variable removed.
* csu/Makefile: Use $(sysdirs) in vpath directive.
* math/Makefile (ulps-file): Use $(sysdirs).
* sysdeps/gnu/Makefile (errlist-c): Likewise.
($(objpfx)errlist-compat.c): Likewise.
* Makeconfig (all-Subdirs-files): Likewise.
($(common-objpfx)config.status): Likewise.
* configure.in (sysnames): Handle absolute add-on directory names.
(sysdeps_add_ons): New variable, AC_SUBST it.
Compute which add-ons contributed sysdeps directories.
* configure: Regenerated.
* config.make.in (sysdeps-add-ons): New substituted variable.
* Makerules (+sysdep_dirs, +sysdep-includes): Variables moved ...
* Makeconfig: ... to here.
(+sysdep_dirs): Append $(sysdeps-add-ons) here.
(+includes): Remove $(objpfx) include, already in $(+sysdep_dirs).
Remove $(includes).
(sysdep-makeconfigs): Use $(+sysdep_dirs).
($(common-objpfx)shlib-versions.v.i): Likewise.
* Makeconfig: Remove hair to set Makeconfig-add-on.
* sysdeps/unix/Makefile (sysdirs): Remove export.
(asm_CPP): Variable removed.
($(common-objpfx)sysd-syscalls): Pass them directly for the script.
* sysdeps/posix/Makefile: New file.
* Makerules (L_tmpnam, TMP_MAX, L_ctermid, L_cuserid): Set non-posix
values here with ?=.
* stdlib/gen-mpn-copy: File removed.
* stdlib/Makefile (distribute): Remove it.
* configure.in: Don't grok --with-gmp.
* configure: Regenerated.
* configure.in (libc_cv_idn): Don't check it; libidn/configure does it.
* configure: Regenerated.
* bare: Directory removed, saved in ports repository.
2006-02-28 07:11:04 +00:00
|
|
|
|
ifneq ($(sysd-versions-subdirs),$(sorted-subdirs) $(config-sysdirs))
|
2002-12-27 20:13:29 +00:00
|
|
|
|
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
|
2005-02-10 21:24:36 +00:00
|
|
|
|
{ while read which lib version setname; do \
|
|
|
|
|
test x"$$which" = xDEFAULT || continue; \
|
2002-12-27 20:13:29 +00:00
|
|
|
|
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.
|
* Makefile (subdir-target-args): New variable.
($(all-subdirs-targets)): Use it in place of -C option.
* Rules: Use $(..) instead of ../ if it's already defined.
* Makeconfig (subdir-srcdirs): New variable.
* csu/Makefile (all-Banner-files): Use it.
* configure.in (--enable-add-ons): Set to "yes" by default.
Handle absolute add-on directory names when looking for configure
fragments. Also look for sysdeps/*/preconfigure fragments in add-ons.
Require add-on configure to set $libc_add_on_canonical, use
that in $add_ons_sfx. Substitute add_on_subdirs with computed list
of subdir names each add-on configure set in libc_add_on_subdirs.
* configure: Regenerated.
* Makefile (%/preconfigure: %/preconfigure.in): New pattern rule.
* config.make.in (add-on-subdirs): New substituted variable.
* Makeconfig (all-subdirs): Include $(add-on-subdirs).
Remove $(add-ons), $(sysdep-subdirs).
Don't filter out $(sysdep-inhibit-subdirs).
($(common-objpfx)sysd-dirs): Target removed. Don't include it.
($(common-objpfx)sysd-sorted): Rewritten to feed Depend and Subdirs
files together to gen-sorted.awk, and $(subdirs) via -v.
(subdirs): Remove magic reordering for mach and hurd.
* scripts/gen-sorted.awk: Use subdirs from command line.
Process Subdirs and Depend files directly.
Let Subdirs files use "first dir" and "inhibit dir".
Always move elf to the end of the list.
* hurd/Depend: New file.
* sysdeps/mach/Subdirs: Use "first mach".
* Makefile (dist-separate): Remove linuxthreads.
(dist-separate-linuxthreads): Variable removed.
(glibc-%.tar rule): Use $(sysdeps-add-ons).
* Makerules ($(common-objpfx)Versions.v.i): Use $(subdirs),
not $(all-subdirs).
(sysdep-makefiles): Use $(sysdirs).
(sysdirs): Remove export.
($(+sysdir_pfx)sysd-rules): Handle absolute directory names in
$(config-sysdirs).
(+sysdir_pfx): Variable removed.
(sysd-rules): Use $(common-objpfx) in place of it.
(sysdirs): Variable moved to ...
* Makeconfig (sysdirs): ... here.
Handle absolute directory names in $(config-sysdirs).
(full_config_sysdirs): Variable removed.
* csu/Makefile: Use $(sysdirs) in vpath directive.
* math/Makefile (ulps-file): Use $(sysdirs).
* sysdeps/gnu/Makefile (errlist-c): Likewise.
($(objpfx)errlist-compat.c): Likewise.
* Makeconfig (all-Subdirs-files): Likewise.
($(common-objpfx)config.status): Likewise.
* configure.in (sysnames): Handle absolute add-on directory names.
(sysdeps_add_ons): New variable, AC_SUBST it.
Compute which add-ons contributed sysdeps directories.
* configure: Regenerated.
* config.make.in (sysdeps-add-ons): New substituted variable.
* Makerules (+sysdep_dirs, +sysdep-includes): Variables moved ...
* Makeconfig: ... to here.
(+sysdep_dirs): Append $(sysdeps-add-ons) here.
(+includes): Remove $(objpfx) include, already in $(+sysdep_dirs).
Remove $(includes).
(sysdep-makeconfigs): Use $(+sysdep_dirs).
($(common-objpfx)shlib-versions.v.i): Likewise.
* Makeconfig: Remove hair to set Makeconfig-add-on.
* sysdeps/unix/Makefile (sysdirs): Remove export.
(asm_CPP): Variable removed.
($(common-objpfx)sysd-syscalls): Pass them directly for the script.
* sysdeps/posix/Makefile: New file.
* Makerules (L_tmpnam, TMP_MAX, L_ctermid, L_cuserid): Set non-posix
values here with ?=.
* stdlib/gen-mpn-copy: File removed.
* stdlib/Makefile (distribute): Remove it.
* configure.in: Don't grok --with-gmp.
* configure: Regenerated.
* configure.in (libc_cv_idn): Don't check it; libidn/configure does it.
* configure: Regenerated.
* bare: Directory removed, saved in ports repository.
2006-02-28 07:11:04 +00:00
|
|
|
|
$(common-objpfx)Versions.v.i: $(wildcard $(subdirs:%=$(..)%/Versions)) \
|
2002-12-27 20:13:29 +00:00
|
|
|
|
$(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
|
* Makefile (subdir-target-args): New variable.
($(all-subdirs-targets)): Use it in place of -C option.
* Rules: Use $(..) instead of ../ if it's already defined.
* Makeconfig (subdir-srcdirs): New variable.
* csu/Makefile (all-Banner-files): Use it.
* configure.in (--enable-add-ons): Set to "yes" by default.
Handle absolute add-on directory names when looking for configure
fragments. Also look for sysdeps/*/preconfigure fragments in add-ons.
Require add-on configure to set $libc_add_on_canonical, use
that in $add_ons_sfx. Substitute add_on_subdirs with computed list
of subdir names each add-on configure set in libc_add_on_subdirs.
* configure: Regenerated.
* Makefile (%/preconfigure: %/preconfigure.in): New pattern rule.
* config.make.in (add-on-subdirs): New substituted variable.
* Makeconfig (all-subdirs): Include $(add-on-subdirs).
Remove $(add-ons), $(sysdep-subdirs).
Don't filter out $(sysdep-inhibit-subdirs).
($(common-objpfx)sysd-dirs): Target removed. Don't include it.
($(common-objpfx)sysd-sorted): Rewritten to feed Depend and Subdirs
files together to gen-sorted.awk, and $(subdirs) via -v.
(subdirs): Remove magic reordering for mach and hurd.
* scripts/gen-sorted.awk: Use subdirs from command line.
Process Subdirs and Depend files directly.
Let Subdirs files use "first dir" and "inhibit dir".
Always move elf to the end of the list.
* hurd/Depend: New file.
* sysdeps/mach/Subdirs: Use "first mach".
* Makefile (dist-separate): Remove linuxthreads.
(dist-separate-linuxthreads): Variable removed.
(glibc-%.tar rule): Use $(sysdeps-add-ons).
* Makerules ($(common-objpfx)Versions.v.i): Use $(subdirs),
not $(all-subdirs).
(sysdep-makefiles): Use $(sysdirs).
(sysdirs): Remove export.
($(+sysdir_pfx)sysd-rules): Handle absolute directory names in
$(config-sysdirs).
(+sysdir_pfx): Variable removed.
(sysd-rules): Use $(common-objpfx) in place of it.
(sysdirs): Variable moved to ...
* Makeconfig (sysdirs): ... here.
Handle absolute directory names in $(config-sysdirs).
(full_config_sysdirs): Variable removed.
* csu/Makefile: Use $(sysdirs) in vpath directive.
* math/Makefile (ulps-file): Use $(sysdirs).
* sysdeps/gnu/Makefile (errlist-c): Likewise.
($(objpfx)errlist-compat.c): Likewise.
* Makeconfig (all-Subdirs-files): Likewise.
($(common-objpfx)config.status): Likewise.
* configure.in (sysnames): Handle absolute add-on directory names.
(sysdeps_add_ons): New variable, AC_SUBST it.
Compute which add-ons contributed sysdeps directories.
* configure: Regenerated.
* config.make.in (sysdeps-add-ons): New substituted variable.
* Makerules (+sysdep_dirs, +sysdep-includes): Variables moved ...
* Makeconfig: ... to here.
(+sysdep_dirs): Append $(sysdeps-add-ons) here.
(+includes): Remove $(objpfx) include, already in $(+sysdep_dirs).
Remove $(includes).
(sysdep-makeconfigs): Use $(+sysdep_dirs).
($(common-objpfx)shlib-versions.v.i): Likewise.
* Makeconfig: Remove hair to set Makeconfig-add-on.
* sysdeps/unix/Makefile (sysdirs): Remove export.
(asm_CPP): Variable removed.
($(common-objpfx)sysd-syscalls): Pass them directly for the script.
* sysdeps/posix/Makefile: New file.
* Makerules (L_tmpnam, TMP_MAX, L_ctermid, L_cuserid): Set non-posix
values here with ?=.
* stdlib/gen-mpn-copy: File removed.
* stdlib/Makefile (distribute): Remove it.
* configure.in: Don't grok --with-gmp.
* configure: Regenerated.
* configure.in (libc_cv_idn): Don't check it; libidn/configure does it.
* configure: Regenerated.
* bare: Directory removed, saved in ports repository.
2006-02-28 07:11:04 +00:00
|
|
|
|
( echo 'sysd-versions-subdirs = $(subdirs) $(config-sysdirs)' ; \
|
2002-12-27 20:13:29 +00:00
|
|
|
|
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
|
2013-09-04 15:25:42 +00:00
|
|
|
|
endif # $(build-shared) = yes
|
2002-12-27 20:13:29 +00:00
|
|
|
|
endif # sysd-sorted-done
|
|
|
|
|
|
2003-05-02 02:20:45 +00:00
|
|
|
|
# Generate .dT files as we compile.
|
2004-06-18 Roland McGrath <roland@frob.com>
* Makerules (compile-mkdep-flags): Add -MT $@.
* Makefile (dist, tag-for-dist): New targets.
(files-for-dist, tag-of-stem): New variables.
(glibc-%.tar glibc-linuxthreads-%.tar): New pattern rule.
Make tar files using cvs export.
(%.bz2, %.gz, tag-%): New pattern rules.
(distribute): Variable removed.
(+subdir_targets): Remove distinfo targets.
(echo_subdirs, echo-distinfo, parent_echo-distinfo): Targets removed.
(rpm/%): Pattern rule removed.
* rpm/Makefile, rpm/rpmrc, rpm/template: Ancient cruft files removed.
* Rules (subdir_echo-headers, subdir_echo-distinfo, subdir_dist):
Targets removed.
* Makerules (dist, subdir_distinfo): Targets removed.
($(objpfx)distinfo): Depend on $(distribute).
* Make-dist: File removed.
2004-06-20 01:42:52 +00:00
|
|
|
|
compile-mkdep-flags = -MD -MP -MF $@.dt -MT $@
|
2003-05-02 02:20:45 +00:00
|
|
|
|
compile-command.S = $(compile.S) $(OUTPUT_OPTION) $(compile-mkdep-flags)
|
|
|
|
|
compile-command.c = $(compile.c) $(OUTPUT_OPTION) $(compile-mkdep-flags)
|
2005-12-23 01:55:26 +00:00
|
|
|
|
compile-command.cc = $(compile.cc) $(OUTPUT_OPTION) $(compile-mkdep-flags)
|
2002-12-27 20:13:29 +00:00
|
|
|
|
|
2012-05-12 06:40:20 +00:00
|
|
|
|
# Like compile-mkdep-flags, but for use with $(BUILD_CC). We don't want to
|
|
|
|
|
# track system includes here, they may spuriously trigger an install rule,
|
|
|
|
|
# and would cause the check-local-headers test to fail.
|
|
|
|
|
native-compile-mkdep-flags = -MMD -MP -MF $@.dt -MT $@
|
|
|
|
|
|
2002-12-27 20:13:29 +00:00
|
|
|
|
# GCC can grok options after the file name, and it looks nicer that way.
|
|
|
|
|
compile.c = $(CC) $< -c $(CFLAGS) $(CPPFLAGS)
|
2005-12-23 01:55:26 +00:00
|
|
|
|
compile.cc = $(CXX) $< -c $(CXXFLAGS) $(CPPFLAGS)
|
2003-03-10 09:10:43 +00:00
|
|
|
|
compile.S = $(CC) $< -c $(CPPFLAGS) $(S-CPPFLAGS) \
|
|
|
|
|
$(ASFLAGS) $(ASFLAGS-$(suffix $@))
|
2012-05-22 23:00:50 +00:00
|
|
|
|
COMPILE.c = $(CC) -c $(CFLAGS) $(CPPFLAGS)
|
2003-03-10 09:10:43 +00:00
|
|
|
|
COMPILE.S = $(CC) -c $(CPPFLAGS) $(S-CPPFLAGS) \
|
|
|
|
|
$(ASFLAGS) $(ASFLAGS-$(suffix $@))
|
2002-12-27 20:13:29 +00:00
|
|
|
|
|
|
|
|
|
# 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 $@
|
|
|
|
|
|
2012-05-22 23:00:50 +00:00
|
|
|
|
# This is the end of the pipeline for compiling generated C code.
|
|
|
|
|
compile-stdin.c = $(COMPILE.c) -o $@ -x c - $(compile-mkdep-flags)
|
|
|
|
|
|
2002-12-27 20:13:29 +00:00
|
|
|
|
# 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.
|
2002-12-31 21:14:21 +00:00
|
|
|
|
S-CPPFLAGS = -DASSEMBLER $(asm-CPPFLAGS)
|
2003-05-02 02:20:45 +00:00
|
|
|
|
|
2002-12-27 20:13:29 +00:00
|
|
|
|
define +make-deps
|
|
|
|
|
$(make-target-directory)
|
|
|
|
|
$(+mkdep) $< $(if $(filter %.c,$<),$(CFLAGS)) \
|
2003-05-04 23:05:44 +00:00
|
|
|
|
$(CPPFLAGS) $($(patsubst .%,%,$(suffix $(<F)))-CPPFLAGS) | sed -e\
|
|
|
|
|
's,$(subst .,\.,$(@F:.d=.o)),$(foreach o,$(all-object-suffixes),$(@:.d=$o)) $@,' \
|
|
|
|
|
$(sed-remove-objpfx) $(sed-remove-dotdot) > $(@:.d=.T)
|
2002-12-27 20:13:29 +00:00
|
|
|
|
mv -f $(@:.d=.T) $@ $(generate-md5)
|
|
|
|
|
endef
|
2003-05-02 02:20:45 +00:00
|
|
|
|
|
2002-12-27 20:13:29 +00:00
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
# Modify the list of routines we build for different targets
|
|
|
|
|
|
2012-01-08 01:30:26 +00:00
|
|
|
|
ifeq (yes,$(build-shared))
|
2002-12-27 20:13:29 +00:00
|
|
|
|
ifndef libc.so-version
|
|
|
|
|
# Undefine this because it can't work when we libc.so is unversioned.
|
|
|
|
|
static-only-routines =
|
|
|
|
|
endif
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
elide-routines.oS += $(filter-out $(static-only-routines),\
|
2013-01-31 22:57:06 +00:00
|
|
|
|
$(routines) $(aux) $(sysdep_routines))
|
|
|
|
|
elide-routines.os += $(static-only-routines)
|
2002-12-27 20:13:29 +00:00
|
|
|
|
|
|
|
|
|
# If we have versioned code we don't need the old versions in any of the
|
|
|
|
|
# static libraries.
|
2013-01-31 22:57:06 +00:00
|
|
|
|
elide-routines.o += $(shared-only-routines)
|
|
|
|
|
elide-routines.op += $(shared-only-routines)
|
|
|
|
|
elide-routines.og += $(shared-only-routines)
|
2002-12-27 20:13:29 +00:00
|
|
|
|
|
|
|
|
|
# Shared library building.
|
|
|
|
|
|
|
|
|
|
ifeq (yes,$(build-shared))
|
|
|
|
|
|
2013-09-04 15:25:42 +00:00
|
|
|
|
# Reference map file only when shared libraries are built and a map file name
|
2002-12-27 20:13:29 +00:00
|
|
|
|
# is given.
|
2013-09-04 15:25:42 +00:00
|
|
|
|
ifeq ($(build-shared),yes)
|
2002-12-27 20:13:29 +00:00
|
|
|
|
map-file = $(firstword $($(@F:.so=-map)) \
|
|
|
|
|
$(addprefix $(common-objpfx), \
|
|
|
|
|
$(filter $(@F:.so=.map),$(version-maps))))
|
|
|
|
|
load-map-file = $(map-file:%=-Wl,--version-script=%)
|
|
|
|
|
endif
|
|
|
|
|
|
2013-05-31 16:16:33 +00:00
|
|
|
|
# Compiler arguments to use to link a shared object with libc and
|
|
|
|
|
# ld.so. This is intended to be as similar as possible to a default
|
|
|
|
|
# link with an installed libc.
|
|
|
|
|
link-libc-args = -Wl,--start-group \
|
|
|
|
|
$(libc-for-link) \
|
|
|
|
|
$(common-objpfx)libc_nonshared.a \
|
|
|
|
|
$(as-needed) $(elfobjdir)/ld.so $(no-as-needed) \
|
|
|
|
|
-Wl,--end-group
|
|
|
|
|
|
|
|
|
|
# The corresponding shared libc to use. This may be modified for a
|
|
|
|
|
# particular target.
|
|
|
|
|
libc-for-link = $(common-objpfx)libc.so
|
|
|
|
|
|
|
|
|
|
# The corresponding dependencies. As these are used in dependencies,
|
|
|
|
|
# not just commands, they cannot use target-specific variables so need
|
|
|
|
|
# to name both possible libc.so objects.
|
|
|
|
|
link-libc-deps = $(common-objpfx)libc.so $(common-objpfx)linkobj/libc.so \
|
|
|
|
|
$(common-objpfx)libc_nonshared.a $(elfobjdir)/ld.so
|
|
|
|
|
|
2002-12-27 20:13:29 +00:00
|
|
|
|
# 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
|
2013-05-31 16:16:33 +00:00
|
|
|
|
# on other shared objects. The linking with libc and ld.so is intended
|
|
|
|
|
# to be as similar as possible to a default link with an installed libc.
|
|
|
|
|
lib%.so: lib%_pic.a $(+preinit) $(+postinit) $(+interp) $(link-libc-deps)
|
|
|
|
|
$(build-shlib) $(link-libc-args)
|
2002-12-27 20:13:29 +00:00
|
|
|
|
|
|
|
|
|
define build-shlib-helper
|
2003-01-05 10:21:08 +00:00
|
|
|
|
$(LINK.o) -shared $(static-libgcc) -Wl,-O1 $(sysdep-LDFLAGS) \
|
2013-01-11 15:14:18 +00:00
|
|
|
|
$(if $($(@F)-no-z-defs)$(no-z-defs),,-Wl,-z,defs) $(rtld-LDFLAGS) \
|
2002-12-27 20:13:29 +00:00
|
|
|
|
$(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
|
|
|
|
|
|
2011-06-11 11:16:49 +00:00
|
|
|
|
ifeq (yes,$(use-default-link))
|
|
|
|
|
# If the linker is good enough, we can let it use its default linker script.
|
|
|
|
|
shlib-lds =
|
|
|
|
|
shlib-lds-flags =
|
|
|
|
|
else
|
2002-12-27 20:13:29 +00:00
|
|
|
|
# binutils only position loadable notes into the first page for binaries,
|
|
|
|
|
# not for shared objects
|
2003-04-30 04:18:12 +00:00
|
|
|
|
$(common-objpfx)shlib.lds: $(common-objpfx)config.make $(..)Makerules
|
2003-04-26 23:38:49 +00:00
|
|
|
|
$(LINK.o) -shared -Wl,-O1 \
|
2003-11-01 00:36:04 +00:00
|
|
|
|
-nostdlib -nostartfiles \
|
2013-01-11 15:14:18 +00:00
|
|
|
|
$(sysdep-LDFLAGS) $(rtld-LDFLAGS) $(LDFLAGS.so) \
|
2003-04-26 23:38:49 +00:00
|
|
|
|
-Wl,--verbose 2>&1 | \
|
|
|
|
|
sed > $@T \
|
|
|
|
|
-e '/^=========/,/^=========/!d;/^=========/d' \
|
2006-09-05 02:02:55 +00:00
|
|
|
|
$(if $(filter yes,$(have-hash-style)), \
|
|
|
|
|
-e 's/^.*\.gnu\.hash[ ]*:.*$$/ .note.ABI-tag : { *(.note.ABI-tag) } &/' \
|
|
|
|
|
-e '/^[ ]*\.hash[ ]*:.*$$/{h;d;}' \
|
|
|
|
|
-e '/DATA_SEGMENT_ALIGN/{H;g}' \
|
|
|
|
|
, \
|
|
|
|
|
-e 's/^.*\.hash[ ]*:.*$$/ .note.ABI-tag : { *(.note.ABI-tag) } &/' \
|
|
|
|
|
) \
|
2003-04-26 23:38:49 +00:00
|
|
|
|
-e 's/^.*\*(\.dynbss).*$$/& \
|
2003-04-30 04:18:12 +00:00
|
|
|
|
PROVIDE(__start___libc_freeres_ptrs = .); \
|
2003-04-26 23:38:49 +00:00
|
|
|
|
*(__libc_freeres_ptrs) \
|
2004-01-13 08:36:54 +00:00
|
|
|
|
PROVIDE(__stop___libc_freeres_ptrs = .);/'\
|
2005-02-11 00:29:55 +00:00
|
|
|
|
-e 's@^.*\*(\.jcr).*$$@& \
|
2004-03-25 03:54:03 +00:00
|
|
|
|
PROVIDE(__start___libc_subfreeres = .);\
|
|
|
|
|
__libc_subfreeres : { *(__libc_subfreeres) }\
|
|
|
|
|
PROVIDE(__stop___libc_subfreeres = .);\
|
|
|
|
|
PROVIDE(__start___libc_atexit = .);\
|
|
|
|
|
__libc_atexit : { *(__libc_atexit) }\
|
|
|
|
|
PROVIDE(__stop___libc_atexit = .);\
|
|
|
|
|
PROVIDE(__start___libc_thread_subfreeres = .);\
|
|
|
|
|
__libc_thread_subfreeres : { *(__libc_thread_subfreeres) }\
|
2005-02-11 00:29:55 +00:00
|
|
|
|
PROVIDE(__stop___libc_thread_subfreeres = .);\
|
|
|
|
|
/DISCARD/ : { *(.gnu.glibc-stub.*) }@'
|
2011-06-11 06:37:35 +00:00
|
|
|
|
test -s $@T
|
2003-04-26 23:38:49 +00:00
|
|
|
|
mv -f $@T $@
|
|
|
|
|
common-generated += shlib.lds
|
|
|
|
|
|
2011-06-11 10:41:23 +00:00
|
|
|
|
shlib-lds = $(common-objpfx)shlib.lds
|
|
|
|
|
shlib-lds-flags = -T $(shlib-lds)
|
2011-06-11 11:16:49 +00:00
|
|
|
|
endif
|
2011-06-11 10:41:23 +00:00
|
|
|
|
|
2003-04-26 23:38:49 +00:00
|
|
|
|
define build-shlib
|
2011-06-11 10:41:23 +00:00
|
|
|
|
$(build-shlib-helper) -o $@ $(shlib-lds-flags) \
|
2002-12-27 20:13:29 +00:00
|
|
|
|
$(csu-objpfx)abi-note.o $(build-shlib-objlist)
|
|
|
|
|
endef
|
|
|
|
|
|
|
|
|
|
define build-module-helper
|
2013-01-11 15:14:18 +00:00
|
|
|
|
$(LINK.o) -shared $(static-libgcc) $(sysdep-LDFLAGS) $(rtld-LDFLAGS) \
|
2003-07-21 22:40:24 +00:00
|
|
|
|
$(if $($(@F)-no-z-defs)$(no-z-defs),,-Wl,-z,defs) \
|
2002-12-27 20:13:29 +00:00
|
|
|
|
-B$(csu-objpfx) $(load-map-file) \
|
|
|
|
|
$(LDFLAGS.so) $(LDFLAGS-$(@F:%.so=%).so) \
|
|
|
|
|
-L$(subst :, -L,$(rpath-link)) -Wl,-rpath-link=$(rpath-link)
|
|
|
|
|
endef
|
|
|
|
|
|
|
|
|
|
# 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'.
|
|
|
|
|
# binutils only position loadable notes into the first page for binaries,
|
|
|
|
|
# not for shared objects
|
|
|
|
|
define build-module
|
2011-06-11 10:41:23 +00:00
|
|
|
|
$(build-module-helper) -o $@ $(shlib-lds-flags) \
|
2013-05-31 16:16:33 +00:00
|
|
|
|
$(csu-objpfx)abi-note.o $(build-module-objlist) $(link-libc-args)
|
2002-12-27 20:13:29 +00:00
|
|
|
|
endef
|
2006-01-11 22:18:24 +00:00
|
|
|
|
define build-module-asneeded
|
2011-06-11 10:41:23 +00:00
|
|
|
|
$(build-module-helper) -o $@ $(shlib-lds-flags) \
|
2006-01-11 22:18:24 +00:00
|
|
|
|
$(csu-objpfx)abi-note.o \
|
2013-05-31 16:16:33 +00:00
|
|
|
|
-Wl,--as-needed $(build-module-objlist) -Wl,--no-as-needed \
|
|
|
|
|
$(link-libc-args)
|
2006-01-11 22:18:24 +00:00
|
|
|
|
endef
|
2002-12-27 20:13:29 +00:00
|
|
|
|
|
|
|
|
|
build-module-helper-objlist = \
|
|
|
|
|
$(patsubst %_pic.a,$(whole-archive) %_pic.a $(no-whole-archive),\
|
2013-05-31 16:16:33 +00:00
|
|
|
|
$(filter-out %.lds $(map-file) $(+preinit) $(+postinit) \
|
|
|
|
|
$(link-libc-deps),$^))
|
2002-12-27 20:13:29 +00:00
|
|
|
|
|
|
|
|
|
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
|
2004-12-15 18:54:41 +00:00
|
|
|
|
# But we still want to link libc.so against $(libc.so-gnulib).
|
|
|
|
|
LDLIBS-c.so += $(libc.so-gnulib)
|
2002-12-27 20:13:29 +00:00
|
|
|
|
# Give libc.so an entry point and make it directly runnable itself.
|
|
|
|
|
LDFLAGS-c.so += -e __libc_main
|
2004-03-06 09:51:56 +00:00
|
|
|
|
# If lazy relocation is disabled add the -z now flag.
|
|
|
|
|
ifeq ($(bind-now),yes)
|
|
|
|
|
LDFLAGS-c.so += -Wl,-z,now
|
|
|
|
|
endif
|
2002-12-27 20:13:29 +00:00
|
|
|
|
# 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.
|
|
|
|
|
$(common-objpfx)libc_pic.os: $(common-objpfx)libc_pic.a
|
2011-06-10 17:34:45 +00:00
|
|
|
|
$(LINK.o) -nostdlib -nostartfiles -r -o $@ \
|
2011-09-10 18:34:15 +00:00
|
|
|
|
$(LDFLAGS-c_pic.os) -Wl,-d $(whole-archive) $^ -o $@
|
2011-06-25 07:06:42 +00:00
|
|
|
|
|
|
|
|
|
ifeq (,$(strip $(shlib-lds-flags)))
|
|
|
|
|
# Generate a list of -R options to excise .gnu.glibc-stub.* sections.
|
|
|
|
|
$(common-objpfx)libc_pic.opts: $(common-objpfx)libc_pic.os
|
|
|
|
|
$(OBJDUMP) -h $< | \
|
|
|
|
|
$(AWK) '$$2 ~ /\.gnu\.glibc-stub\./ { print "-R", $$2 }' \
|
|
|
|
|
> $@T
|
|
|
|
|
mv -f $@T $@
|
|
|
|
|
# Apply those -R options.
|
|
|
|
|
$(common-objpfx)libc_pic.os.clean: $(common-objpfx)libc_pic.opts \
|
|
|
|
|
$(common-objpfx)libc_pic.os
|
|
|
|
|
$(OBJCOPY) @$^ $@
|
|
|
|
|
generated += libc_pic.opts libc_pic.os.clean
|
|
|
|
|
|
|
|
|
|
libc_pic_clean := .clean
|
|
|
|
|
endif
|
|
|
|
|
|
2013-10-03 17:38:14 +00:00
|
|
|
|
# Build a possibly-modified version of libc_pic.a for use in building
|
|
|
|
|
# linkobj/libc.so.
|
|
|
|
|
ifeq (,$(filter sunrpc,$(subdirs)))
|
|
|
|
|
$(common-objpfx)linkobj/libc_pic.a: $(common-objpfx)libc_pic.a
|
|
|
|
|
$(make-target-directory)
|
|
|
|
|
ln -f $< $@
|
|
|
|
|
else
|
|
|
|
|
$(common-objpfx)linkobj/libc_pic.a: $(common-objpfx)libc_pic.a \
|
|
|
|
|
$(common-objpfx)sunrpc/librpc_compat_pic.a
|
|
|
|
|
$(make-target-directory)
|
|
|
|
|
(cd $(common-objpfx)linkobj; \
|
|
|
|
|
$(AR) x ../libc_pic.a; \
|
|
|
|
|
rm $$($(AR) t ../sunrpc/librpc_compat_pic.a | sed 's/^compat-//'); \
|
|
|
|
|
$(AR) x ../sunrpc/librpc_compat_pic.a; \
|
|
|
|
|
$(AR) cr libc_pic.a *.os; \
|
|
|
|
|
rm *.os)
|
|
|
|
|
endif # $(subdirs) contains sunrpc
|
|
|
|
|
|
|
|
|
|
# Clear link-libc-deps for the libc.so libraries so build-shlibs does not
|
|
|
|
|
# filter ld.so out of the list of linked objects.
|
2013-05-31 16:16:33 +00:00
|
|
|
|
$(common-objpfx)libc.so: link-libc-deps = # empty
|
2013-10-03 17:38:14 +00:00
|
|
|
|
$(common-objpfx)linkobj/libc.so: link-libc-deps = # empty
|
2013-05-31 16:16:33 +00:00
|
|
|
|
|
2013-10-03 17:38:14 +00:00
|
|
|
|
# Use our own special initializer and finalizer files for the libc.so
|
|
|
|
|
# libraries.
|
2002-12-27 20:13:29 +00:00
|
|
|
|
$(common-objpfx)libc.so: $(elfobjdir)/soinit.os \
|
2011-06-25 07:06:42 +00:00
|
|
|
|
$(common-objpfx)libc_pic.os$(libc_pic_clean) \
|
2002-12-27 20:13:29 +00:00
|
|
|
|
$(elfobjdir)/sofini.os \
|
2013-10-03 17:38:14 +00:00
|
|
|
|
$(elfobjdir)/interp.os \
|
|
|
|
|
$(elfobjdir)/ld.so \
|
|
|
|
|
$(shlib-lds)
|
|
|
|
|
$(build-shlib)
|
|
|
|
|
|
|
|
|
|
$(common-objpfx)linkobj/libc.so: $(elfobjdir)/soinit.os \
|
|
|
|
|
$(common-objpfx)linkobj/libc_pic.a \
|
|
|
|
|
$(elfobjdir)/sofini.os \
|
|
|
|
|
$(elfobjdir)/interp.os \
|
|
|
|
|
$(elfobjdir)/ld.so \
|
2011-06-11 10:41:23 +00:00
|
|
|
|
$(shlib-lds)
|
2002-12-27 20:13:29 +00:00
|
|
|
|
$(build-shlib)
|
2013-10-03 17:38:14 +00:00
|
|
|
|
|
2013-09-04 15:25:42 +00:00
|
|
|
|
ifeq ($(build-shared),yes)
|
2002-12-27 20:13:29 +00:00
|
|
|
|
$(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
|
|
|
|
|
|
|
|
|
|
# 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".
|
2013-01-31 22:57:06 +00:00
|
|
|
|
override objects := $(addprefix $(objpfx),$(sources:.c=.o))
|
2002-12-27 20:13:29 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# 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
|
2004-03-08 21:31:23 +00:00
|
|
|
|
|
|
|
|
|
|
2005-10-16 09:25:59 +00:00
|
|
|
|
# The makefile may define $(modules-names) to build additional modules.
|
|
|
|
|
# These are built with $(build-module), except any in $(modules-names-nobuild).
|
2004-03-08 21:31:23 +00:00
|
|
|
|
ifdef modules-names
|
|
|
|
|
# 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-modules-left := $(modules-names)
|
|
|
|
|
include $(patsubst %,$(..)extra-modules.mk,$(modules-names))
|
2005-10-16 09:25:59 +00:00
|
|
|
|
|
|
|
|
|
extra-modules-build := $(filter-out $(modules-names-nobuild),$(modules-names))
|
|
|
|
|
$(extra-modules-build:%=$(objpfx)%.so): $(objpfx)%.so: \
|
2013-05-31 16:16:33 +00:00
|
|
|
|
$(objpfx)%.os $(shlib-lds) $(link-libs-deps)
|
2005-10-16 09:25:59 +00:00
|
|
|
|
$(build-module)
|
2004-03-08 21:31:23 +00:00
|
|
|
|
endif
|
2002-12-27 20:13:29 +00:00
|
|
|
|
|
|
|
|
|
+depfiles := $(sources:.c=.d) \
|
|
|
|
|
$(patsubst %.o,%.d,$(filter %.o,$(extra-objs:.os=.o))) \
|
2012-05-05 07:56:47 +00:00
|
|
|
|
$(patsubst %.oS,%.d,$(filter %.oS,$(extra-objs))) \
|
2006-08-21 21:06:35 +00:00
|
|
|
|
$(patsubst %.o,%.d,$(filter %.o,$(extra-test-objs:.os=.o))) \
|
2002-12-27 20:13:29 +00:00
|
|
|
|
$(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)),\
|
2003-01-15 08:08:20 +00:00
|
|
|
|
$(+depfiles)))
|
2003-05-02 02:20:45 +00:00
|
|
|
|
all-dt-files := $(foreach o,$(object-suffixes-for-libc),$(+depfiles:.d=$o.dt))
|
|
|
|
|
+depfiles := $(patsubst %.dt,%.d,$(wildcard $(all-dt-files))) \
|
|
|
|
|
$(wildcard $(all-dt-files:.dt=.d))
|
|
|
|
|
|
|
|
|
|
# This is a funny rule in that it removes its input file.
|
|
|
|
|
%.d: %.dt
|
|
|
|
|
@sed $(sed-remove-objpfx) $< > $(@:.d=.T) && \
|
|
|
|
|
mv -f $(@:.d=.T) $@ && \
|
|
|
|
|
rm -f $<
|
2003-01-15 08:08:20 +00:00
|
|
|
|
|
|
|
|
|
# Avoid the .h.d files for any .sym files whose .h files don't exist yet.
|
|
|
|
|
# They will be generated when they're needed, and trying too early won't work.
|
|
|
|
|
+gen-as-const := $(gen-as-const-headers:%.sym=$(common-objpfx)%.h)
|
|
|
|
|
+depfiles += $(addsuffix .d,$(filter $(wildcard $(+gen-as-const)),\
|
|
|
|
|
$(+gen-as-const)))
|
2002-12-27 20:13:29 +00:00
|
|
|
|
|
|
|
|
|
ifdef +depfiles
|
|
|
|
|
ifneq ($(no_deps),t)
|
|
|
|
|
-include $(+depfiles)
|
|
|
|
|
endif
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
# 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 /.
|
2007-08-26 02:18:14 +00:00
|
|
|
|
# We always require a mkdir which supports the -p option to avoid error
|
|
|
|
|
# messages in case of races.
|
|
|
|
|
mkdir -p $(@:%/=%)
|
2002-12-27 20:13:29 +00:00
|
|
|
|
|
|
|
|
|
# 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))
|
|
|
|
|
|
|
|
|
|
# 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)
|
|
|
|
|
|
|
|
|
|
# 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
|
2003-05-02 07:19:19 +00:00
|
|
|
|
$(make-target-directory)
|
2002-12-27 20:13:29 +00:00
|
|
|
|
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)%,%,$^)`
|
|
|
|
|
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)%,%,$^)
|
|
|
|
|
endef
|
|
|
|
|
|
|
|
|
|
# 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
|
2007-07-24 23:09:42 +00:00
|
|
|
|
# unless they also appear in $(non-lib.a). $(install-data) are installed as
|
|
|
|
|
# they are into $(datadir). $(headers) are installed as they are in
|
2002-12-27 20:13:29 +00:00
|
|
|
|
# $(includedir). $(install-bin), $(install-bin-script) and $(install-sbin)
|
|
|
|
|
# are installed from the object directory into $(bindir), $(bindir) and
|
2007-07-24 23:09:42 +00:00
|
|
|
|
# $(sbindir), respectively. $(install-others) and $(install-others-programs)
|
|
|
|
|
# are absolute path names of files to install; rules to install them are
|
|
|
|
|
# defined elsewhere.
|
2002-12-27 20:13:29 +00:00
|
|
|
|
|
|
|
|
|
# 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%) $@
|
|
|
|
|
|
|
|
|
|
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))
|
|
|
|
|
|
2003-02-22 20:32:58 +00:00
|
|
|
|
# For versioned libraries, we install three files:
|
|
|
|
|
# $(inst_libdir)/libfoo.so -- for linking, symlink or ld script
|
|
|
|
|
# $(inst_slibdir)/libfoo.so.NN -- for loading by SONAME, symlink
|
|
|
|
|
# $(inst_slibdir)/libfoo-X.Y.Z.so -- the real shared object file
|
2012-08-22 04:21:31 +00:00
|
|
|
|
lib-version := $(firstword $($(subdir)-version) $(version))
|
2003-02-22 20:32:58 +00:00
|
|
|
|
install-lib-nosubdir: $(install-lib.so-unversioned:%=$(inst_slibdir)/%) \
|
|
|
|
|
$(foreach L,$(install-lib.so-versioned),\
|
|
|
|
|
$(inst_libdir)/$L \
|
2012-08-22 04:21:31 +00:00
|
|
|
|
$(inst_slibdir)/$(L:.so=)-$(lib-version).so \
|
2003-02-22 20:32:58 +00:00
|
|
|
|
$(inst_slibdir)/$L$($L-version))
|
2002-12-27 20:13:29 +00:00
|
|
|
|
|
|
|
|
|
# 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
|
2013-03-18 11:44:47 +00:00
|
|
|
|
echo `$(..)scripts/rellns-sh -p $< $@` $@ >> $(symbolic-link-list)
|
2002-12-27 20:13:29 +00:00
|
|
|
|
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 $@
|
2013-03-18 11:44:47 +00:00
|
|
|
|
$(LN_S) `$(..)scripts/rellns-sh -p $< $@` $@
|
2002-12-27 20:13:29 +00:00
|
|
|
|
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)
|
|
|
|
|
|
|
|
|
|
# This fragment of linker script gives the OUTPUT_FORMAT statement
|
|
|
|
|
# for the configuration we are building. We put this statement into
|
|
|
|
|
# the linker scripts we install for -lc et al so that they will not be
|
|
|
|
|
# used by a link for a different format on a multi-architecture system.
|
|
|
|
|
$(common-objpfx)format.lds: $(..)scripts/output-format.sed \
|
|
|
|
|
$(common-objpfx)config.make \
|
|
|
|
|
$(common-objpfx)config.h $(..)Makerules
|
2011-06-11 07:45:12 +00:00
|
|
|
|
ifneq (unknown,$(output-format))
|
|
|
|
|
echo > $@.new 'OUTPUT_FORMAT($(output-format))'
|
|
|
|
|
else
|
2013-01-11 15:14:18 +00:00
|
|
|
|
$(LINK.o) -shared $(sysdep-LDFLAGS) $(rtld-LDFLAGS) $(LDFLAGS.so) \
|
2002-12-27 20:13:29 +00:00
|
|
|
|
-x c /dev/null -o $@.so -Wl,--verbose -v 2>&1 \
|
|
|
|
|
| sed -n -f $< > $@.new
|
2011-07-02 23:59:14 +00:00
|
|
|
|
test -s $@.new
|
2002-12-27 20:13:29 +00:00
|
|
|
|
rm -f $@.so
|
2011-06-11 07:45:12 +00:00
|
|
|
|
endif
|
2002-12-27 20:13:29 +00:00
|
|
|
|
mv -f $@.new $@
|
|
|
|
|
common-generated += format.lds
|
|
|
|
|
|
|
|
|
|
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)format.lds \
|
|
|
|
|
$(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. */';\
|
|
|
|
|
cat $<; \
|
|
|
|
|
echo 'GROUP ( $(slibdir)/libc.so$(libc.so-version)' \
|
|
|
|
|
'$(libdir)/$(patsubst %,$(libtype.oS),$(libprefix)$(libc-name))'\
|
2013-03-20 14:23:09 +00:00
|
|
|
|
' AS_NEEDED (' $(rtlddir)/$(rtld-installed-name) ') )' \
|
2002-12-27 20:13:29 +00:00
|
|
|
|
) > $@.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
|
2003-02-21 09:30:54 +00:00
|
|
|
|
object-suffixes-left := $(filter-out $(install-lib-ldscripts),$(versioned))
|
|
|
|
|
ifneq (,$(object-suffixes-left))
|
2002-12-27 20:13:29 +00:00
|
|
|
|
include $(o-iterator)
|
2003-02-21 09:30:54 +00:00
|
|
|
|
endif
|
2002-12-27 20:13:29 +00:00
|
|
|
|
|
|
|
|
|
# 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)
|
|
|
|
|
endif
|
|
|
|
|
endif
|
|
|
|
|
ifdef install-data
|
|
|
|
|
$(addprefix $(inst_datadir)/,$(install-data)): $(inst_datadir)/%: % $(+force)
|
|
|
|
|
$(do-install)
|
|
|
|
|
endif
|
|
|
|
|
headers := $(strip $(headers))
|
|
|
|
|
ifdef headers
|
2006-01-17 04:31:22 +00:00
|
|
|
|
# This implicit rule installs headers from the source directory.
|
|
|
|
|
# It may be ignored in preference to rules from sysd-rules to find
|
|
|
|
|
# headers in the sysdeps tree.
|
|
|
|
|
$(inst_includedir)/%.h: $(objpfx)%.h $(+force)
|
2002-12-27 20:13:29 +00:00
|
|
|
|
$(do-install)
|
2012-03-09 22:05:49 +00:00
|
|
|
|
$(inst_includedir)/%.h: $(common-objpfx)%.h $(+force)
|
|
|
|
|
$(do-install)
|
2006-01-17 04:31:22 +00:00
|
|
|
|
$(inst_includedir)/%.h: %.h $(+force)
|
|
|
|
|
$(do-install)
|
|
|
|
|
$(inst_includedir)/%.h: $(..)include/%.h $(+force)
|
|
|
|
|
$(do-install)
|
|
|
|
|
headers-nonh := $(filter-out %.h,$(headers))
|
|
|
|
|
ifdef headers-nonh
|
|
|
|
|
$(addprefix $(inst_includedir)/,$(headers-nonh)): $(inst_includedir)/%: \
|
|
|
|
|
% $(+force)
|
|
|
|
|
$(do-install)
|
|
|
|
|
endif # headers-nonh
|
2002-12-27 20:13:29 +00:00
|
|
|
|
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)
|
2007-07-24 23:09:42 +00:00
|
|
|
|
install-others-programs-nosubdir: $(install-others-programs)
|
2002-12-27 20:13:29 +00:00
|
|
|
|
|
|
|
|
|
# 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
|
2007-07-24 23:09:42 +00:00
|
|
|
|
install-no-libc.a-nosubdir: install-headers-nosubdir install-data-nosubdir \
|
2002-12-27 20:13:29 +00:00
|
|
|
|
install-lib-nosubdir install-others-nosubdir
|
2007-07-24 23:09:42 +00:00
|
|
|
|
ifeq ($(build-programs),yes)
|
|
|
|
|
install-no-libc.a-nosubdir: install-bin-nosubdir install-bin-script-nosubdir \
|
|
|
|
|
install-rootsbin-nosubdir install-sbin-nosubdir \
|
|
|
|
|
install-others-programs-nosubdir
|
2002-12-27 20:13:29 +00:00
|
|
|
|
endif
|
|
|
|
|
install: install-no-libc.a-nosubdir
|
|
|
|
|
|
2012-04-24 20:05:34 +00:00
|
|
|
|
# Command to compile $< using the native libraries.
|
2002-12-27 20:13:29 +00:00
|
|
|
|
define native-compile
|
|
|
|
|
$(make-target-directory)
|
|
|
|
|
$(BUILD_CC) $($(basename $(<F))-CFLAGS) $(ALL_BUILD_CFLAGS) \
|
2012-04-25 18:51:38 +00:00
|
|
|
|
$< $(OUTPUT_OPTION) $(BUILD_LDFLAGS)
|
2002-12-27 20:13:29 +00:00
|
|
|
|
endef
|
|
|
|
|
|
|
|
|
|
# We always want to use configuration definitions.
|
2012-04-25 18:51:38 +00:00
|
|
|
|
ALL_BUILD_CFLAGS = $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) -D_GNU_SOURCE \
|
|
|
|
|
-DIS_IN_build -include $(common-objpfx)config.h
|
2002-12-27 20:13:29 +00:00
|
|
|
|
|
|
|
|
|
# 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))
|
2005-12-23 01:55:26 +00:00
|
|
|
|
cpp-srcs-left = $(all-nonlib:=.c) $(all-nonlib:=.cc)
|
2002-12-27 20:13:29 +00:00
|
|
|
|
lib := nonlib
|
2005-12-23 01:55:26 +00:00
|
|
|
|
include $(patsubst %,$(..)cppflags-iterator.mk,$(cpp-srcs-left))
|
2002-12-27 20:13:29 +00:00
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
# The include magic above causes those files to use this variable for flags.
|
|
|
|
|
CPPFLAGS-nonlib = -DNOT_IN_libc=1
|
|
|
|
|
|
|
|
|
|
|
2013-09-04 15:25:42 +00:00
|
|
|
|
ifeq ($(build-shared),yes)
|
2002-12-27 20:13:29 +00:00
|
|
|
|
# Generate normalized lists of symbols, versions, and data sizes.
|
|
|
|
|
# This is handy for checking against existing library binaries.
|
|
|
|
|
|
|
|
|
|
%.symlist: $(..)scripts/abilist.awk %.dynsym
|
|
|
|
|
LC_ALL=C $(AWK) -f $^ > $@T
|
|
|
|
|
mv -f $@T $@
|
|
|
|
|
|
|
|
|
|
%.dynsym: %.so
|
2012-10-08 21:04:15 +00:00
|
|
|
|
LC_ALL=C $(OBJDUMP) --dynamic-syms $< > $@T
|
2002-12-27 20:13:29 +00:00
|
|
|
|
mv -f $@T $@
|
|
|
|
|
|
2012-04-28 08:36:51 +00:00
|
|
|
|
vpath %.abilist $(+sysdep_dirs)
|
|
|
|
|
|
2012-05-03 18:51:38 +00:00
|
|
|
|
# The .PRECIOUS rule prevents the files built by an implicit rule whose
|
|
|
|
|
# target pattern is %.symlist from being considered "intermediate files"
|
|
|
|
|
# and automatically removed. We only want these files to be removed by
|
|
|
|
|
# 'make clean', which is handled by the 'generated' variable.
|
|
|
|
|
.PRECIOUS: %.symlist
|
|
|
|
|
generated += $(extra-libs:=.symlist)
|
|
|
|
|
|
2012-04-28 08:36:51 +00:00
|
|
|
|
check-abi-%: $(common-objpfx)config.make %.abilist $(objpfx)%.symlist
|
2003-01-15 08:08:20 +00:00
|
|
|
|
$(check-abi)
|
2012-04-28 08:36:51 +00:00
|
|
|
|
check-abi-%: $(common-objpfx)config.make %.abilist $(common-objpfx)%.symlist
|
2003-01-15 08:08:20 +00:00
|
|
|
|
$(check-abi)
|
|
|
|
|
define check-abi
|
2012-04-29 04:31:26 +00:00
|
|
|
|
diff -p -U 0 $(filter %.abilist,$^) $(filter %.symlist,$^)
|
2003-01-15 08:08:20 +00:00
|
|
|
|
endef
|
2002-12-27 20:13:29 +00:00
|
|
|
|
|
2012-04-28 08:36:51 +00:00
|
|
|
|
update-abi-%: $(objpfx)%.symlist %.abilist
|
2003-01-15 08:08:20 +00:00
|
|
|
|
$(update-abi)
|
2012-04-28 08:36:51 +00:00
|
|
|
|
update-abi-%: $(common-objpfx)%.symlist %.abilist
|
2003-01-15 08:08:20 +00:00
|
|
|
|
$(update-abi)
|
|
|
|
|
define update-abi
|
2012-04-28 08:36:51 +00:00
|
|
|
|
@if cmp -s $^ 2> /dev/null; \
|
|
|
|
|
then \
|
|
|
|
|
echo '+++ $(filter %.abilist,$^) is unchanged'; \
|
|
|
|
|
else cp -f $^; \
|
|
|
|
|
echo '*** Now check $(filter %.abilist,$^) changes for correctness ***'; \
|
2003-01-15 08:08:20 +00:00
|
|
|
|
fi
|
|
|
|
|
endef
|
2002-12-27 20:13:29 +00:00
|
|
|
|
|
|
|
|
|
.PHONY: update-abi check-abi
|
|
|
|
|
update-abi: $(patsubst %.so,update-abi-%,$(install-lib.so-versioned))
|
|
|
|
|
check-abi: $(patsubst %.so,check-abi-%,$(install-lib.so-versioned))
|
|
|
|
|
ifdef subdir
|
|
|
|
|
subdir_check-abi: check-abi
|
|
|
|
|
subdir_update-abi: update-abi
|
|
|
|
|
else
|
|
|
|
|
check-abi: subdir_check-abi
|
|
|
|
|
update-abi: subdir_update-abi
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
ifeq ($(subdir),elf)
|
|
|
|
|
check-abi: check-abi-libc
|
|
|
|
|
update-abi: update-abi-libc
|
|
|
|
|
common-generated += libc.symlist
|
|
|
|
|
endif
|
|
|
|
|
|
2003-03-27 09:48:09 +00:00
|
|
|
|
ifeq ($(build-shared),yes)
|
2003-03-19 08:27:55 +00:00
|
|
|
|
ifdef subdir
|
|
|
|
|
tests: check-abi
|
|
|
|
|
endif
|
|
|
|
|
endif
|
|
|
|
|
|
2002-12-27 20:13:29 +00:00
|
|
|
|
endif
|
2002-12-27 23:05:53 +00:00
|
|
|
|
|
* Makefile (subdir-target-args): New variable.
($(all-subdirs-targets)): Use it in place of -C option.
* Rules: Use $(..) instead of ../ if it's already defined.
* Makeconfig (subdir-srcdirs): New variable.
* csu/Makefile (all-Banner-files): Use it.
* configure.in (--enable-add-ons): Set to "yes" by default.
Handle absolute add-on directory names when looking for configure
fragments. Also look for sysdeps/*/preconfigure fragments in add-ons.
Require add-on configure to set $libc_add_on_canonical, use
that in $add_ons_sfx. Substitute add_on_subdirs with computed list
of subdir names each add-on configure set in libc_add_on_subdirs.
* configure: Regenerated.
* Makefile (%/preconfigure: %/preconfigure.in): New pattern rule.
* config.make.in (add-on-subdirs): New substituted variable.
* Makeconfig (all-subdirs): Include $(add-on-subdirs).
Remove $(add-ons), $(sysdep-subdirs).
Don't filter out $(sysdep-inhibit-subdirs).
($(common-objpfx)sysd-dirs): Target removed. Don't include it.
($(common-objpfx)sysd-sorted): Rewritten to feed Depend and Subdirs
files together to gen-sorted.awk, and $(subdirs) via -v.
(subdirs): Remove magic reordering for mach and hurd.
* scripts/gen-sorted.awk: Use subdirs from command line.
Process Subdirs and Depend files directly.
Let Subdirs files use "first dir" and "inhibit dir".
Always move elf to the end of the list.
* hurd/Depend: New file.
* sysdeps/mach/Subdirs: Use "first mach".
* Makefile (dist-separate): Remove linuxthreads.
(dist-separate-linuxthreads): Variable removed.
(glibc-%.tar rule): Use $(sysdeps-add-ons).
* Makerules ($(common-objpfx)Versions.v.i): Use $(subdirs),
not $(all-subdirs).
(sysdep-makefiles): Use $(sysdirs).
(sysdirs): Remove export.
($(+sysdir_pfx)sysd-rules): Handle absolute directory names in
$(config-sysdirs).
(+sysdir_pfx): Variable removed.
(sysd-rules): Use $(common-objpfx) in place of it.
(sysdirs): Variable moved to ...
* Makeconfig (sysdirs): ... here.
Handle absolute directory names in $(config-sysdirs).
(full_config_sysdirs): Variable removed.
* csu/Makefile: Use $(sysdirs) in vpath directive.
* math/Makefile (ulps-file): Use $(sysdirs).
* sysdeps/gnu/Makefile (errlist-c): Likewise.
($(objpfx)errlist-compat.c): Likewise.
* Makeconfig (all-Subdirs-files): Likewise.
($(common-objpfx)config.status): Likewise.
* configure.in (sysnames): Handle absolute add-on directory names.
(sysdeps_add_ons): New variable, AC_SUBST it.
Compute which add-ons contributed sysdeps directories.
* configure: Regenerated.
* config.make.in (sysdeps-add-ons): New substituted variable.
* Makerules (+sysdep_dirs, +sysdep-includes): Variables moved ...
* Makeconfig: ... to here.
(+sysdep_dirs): Append $(sysdeps-add-ons) here.
(+includes): Remove $(objpfx) include, already in $(+sysdep_dirs).
Remove $(includes).
(sysdep-makeconfigs): Use $(+sysdep_dirs).
($(common-objpfx)shlib-versions.v.i): Likewise.
* Makeconfig: Remove hair to set Makeconfig-add-on.
* sysdeps/unix/Makefile (sysdirs): Remove export.
(asm_CPP): Variable removed.
($(common-objpfx)sysd-syscalls): Pass them directly for the script.
* sysdeps/posix/Makefile: New file.
* Makerules (L_tmpnam, TMP_MAX, L_ctermid, L_cuserid): Set non-posix
values here with ?=.
* stdlib/gen-mpn-copy: File removed.
* stdlib/Makefile (distribute): Remove it.
* configure.in: Don't grok --with-gmp.
* configure: Regenerated.
* configure.in (libc_cv_idn): Don't check it; libidn/configure does it.
* configure: Regenerated.
* bare: Directory removed, saved in ports repository.
2006-02-28 07:11:04 +00:00
|
|
|
|
# These will have been set by sysdeps/posix/Makefile.
|
|
|
|
|
L_tmpnam ?= 1
|
|
|
|
|
TMP_MAX ?= 0
|
|
|
|
|
L_ctermid ?= 1
|
|
|
|
|
L_cuserid ?= 1
|
|
|
|
|
|
2003-01-15 08:08:20 +00:00
|
|
|
|
stdio_lim = $(common-objpfx)bits/stdio_lim.h
|
|
|
|
|
|
|
|
|
|
$(stdio_lim:lim.h=%.h) $(stdio_lim:lim.h=%.d): $(stdio_lim:lim.h=%.st); @:
|
|
|
|
|
$(stdio_lim:h=st): $(..)stdio-common/stdio_lim.h.in $(..)Rules \
|
|
|
|
|
$(common-objpfx)config.make
|
|
|
|
|
$(make-target-directory)
|
2003-05-28 21:05:12 +00:00
|
|
|
|
{ echo '#include "$(..)posix/bits/posix1_lim.h"'; \
|
|
|
|
|
echo '#define _LIBC 1'; \
|
|
|
|
|
echo '#include "$(..)misc/sys/uio.h"'; } | \
|
|
|
|
|
$(CC) -E -dM -MD -MP -MF $(@:st=dT) -MT '$(@:st=h) $(@:st=d)' \
|
2012-05-14 22:42:52 +00:00
|
|
|
|
$(CPPUNDEFS) $(+includes) -xc - -o $(@:st=hT)
|
2003-05-28 21:05:12 +00:00
|
|
|
|
sed $(sed-remove-objpfx) $(sed-remove-dotdot) \
|
|
|
|
|
$(@:st=dT) > $(@:st=dt)
|
|
|
|
|
mv -f $(@:st=dt) $(@:st=d)
|
2003-01-15 08:08:20 +00:00
|
|
|
|
fopen_max=`sed -n 's/^#define OPEN_MAX //1p' $(@:st=hT)`; \
|
|
|
|
|
filename_max=`sed -n 's/^#define PATH_MAX //1p' $(@:st=hT)`; \
|
|
|
|
|
iov_max=`sed -n 's/^#define UIO_MAXIOV //p' $(@:st=hT)`; \
|
|
|
|
|
fopen_max=$${fopen_max:-16}; \
|
|
|
|
|
filename_max=$${filename_max:-1024}; \
|
2003-05-28 21:05:12 +00:00
|
|
|
|
if [ -z "$$iov_max" ]; then \
|
2003-01-15 08:08:20 +00:00
|
|
|
|
define_iov_max="# undef IOV_MAX"; \
|
|
|
|
|
else \
|
|
|
|
|
define_iov_max="# define IOV_MAX $$iov_max"; \
|
|
|
|
|
fi; \
|
|
|
|
|
sed -e "s/@FOPEN_MAX@/$$fopen_max/" \
|
|
|
|
|
-e "s/@FILENAME_MAX@/$$filename_max/" \
|
|
|
|
|
-e "s/@L_tmpnam@/$(L_tmpnam)/" \
|
|
|
|
|
-e "s/@TMP_MAX@/$(TMP_MAX)/" \
|
|
|
|
|
-e "s/@L_ctermid@/$(L_ctermid)/" \
|
|
|
|
|
-e "s/@L_cuserid@/$(L_cuserid)/" \
|
|
|
|
|
-e "s/@define_IOV_MAX@/$$define_iov_max/" \
|
|
|
|
|
$< > $(@:st=h.new)
|
|
|
|
|
$(move-if-change) $(@:st=h.new) $(@:st=h)
|
|
|
|
|
# Remove these last so that they can be examined if something went wrong.
|
|
|
|
|
rm -f $(@:st=hT) $(@:st=dT) $(@:st=dt)
|
|
|
|
|
touch $@
|
|
|
|
|
# Get dependencies.
|
|
|
|
|
ifndef no_deps
|
|
|
|
|
-include $(stdio_lim:h=d)
|
|
|
|
|
endif
|
|
|
|
|
common-generated += bits/stdio_lim.h bits/stdio_lim.d bits/stdio_lim.st
|
2002-12-27 20:13:29 +00:00
|
|
|
|
|
|
|
|
|
FORCE:
|
|
|
|
|
|
|
|
|
|
.PHONY: echo-headers
|
|
|
|
|
echo-headers:
|
|
|
|
|
@echo $(headers)
|
|
|
|
|
|
2004-10-23 20:10:40 +00:00
|
|
|
|
%.bz2: %; bzip2 -9vk $<
|
|
|
|
|
%.gz: %; gzip -9vnc $< > $@.new && mv -f $@.new $@
|
2009-10-28 22:27:43 +00:00
|
|
|
|
%.xz: %; xz -9evk $<
|
2002-12-27 20:13:29 +00:00
|
|
|
|
|
|
|
|
|
# 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) \
|
2013-02-15 15:07:54 +00:00
|
|
|
|
$(test-srcs)))
|
2002-12-27 20:13:29 +00:00
|
|
|
|
|
|
|
|
|
# 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 .out,$(tests) $(xtests) \
|
2013-02-15 15:07:54 +00:00
|
|
|
|
$(test-srcs)))
|
2006-08-21 21:06:35 +00:00
|
|
|
|
-rm -f $(addprefix $(objpfx),$(extra-objs) $(extra-test-objs) \
|
|
|
|
|
$(install-lib) $(install-lib.so) \
|
2002-12-27 20:13:29 +00:00
|
|
|
|
$(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
|
2003-05-02 02:20:45 +00:00
|
|
|
|
-rm -f $(addprefix $(objpfx),$(generated))
|
|
|
|
|
-rm -f $(objpfx)*.d $(objpfx)*.dt
|
2002-12-27 20:13:29 +00:00
|
|
|
|
-rm -fr $(addprefix $(objpfx),$(generated-dirs))
|
|
|
|
|
-rm -f $(addprefix $(common-objpfx),$(common-generated))
|
2012-04-24 20:08:49 +00:00
|
|
|
|
-rm -f $(gen-as-const-headers:%.sym=$(common-objpfx)%.h)
|
2002-12-27 20:13:29 +00:00
|
|
|
|
|
|
|
|
|
# Produce a file `stubs' which contains `#define __stub_FUNCTION'
|
2012-11-04 18:59:40 +00:00
|
|
|
|
# for each function which is a stub.
|
2002-12-27 20:13:29 +00:00
|
|
|
|
|
|
|
|
|
ifdef objpfx
|
|
|
|
|
.PHONY: stubs # The parent Makefile calls this target.
|
|
|
|
|
stubs: $(objpfx)stubs
|
|
|
|
|
endif
|
2005-02-11 00:29:55 +00:00
|
|
|
|
objs-for-stubs := $(foreach o,$(object-suffixes-for-libc),$(o-objects)) \
|
|
|
|
|
$(addprefix $(objpfx),$(extra-objs))
|
|
|
|
|
$(objpfx)stubs: $(objs-for-stubs)
|
|
|
|
|
ifneq (,$(strip $(objs-for-stubs)))
|
2005-07-22 07:10:10 +00:00
|
|
|
|
(cd $(objpfx).; $(OBJDUMP) -h $(patsubst $(objpfx)%,%,$^)) | \
|
2005-02-11 00:29:55 +00:00
|
|
|
|
$(AWK) '/\.gnu\.glibc-stub\./ { \
|
2010-03-15 18:44:58 +00:00
|
|
|
|
sub(/\.gnu\.glibc-stub\./, "", $$2); \
|
2005-02-11 00:29:55 +00:00
|
|
|
|
stubs[$$2] = 1; } \
|
|
|
|
|
END { for (s in stubs) print "#define __stub_" s }' > $@T
|
2002-12-27 20:13:29 +00:00
|
|
|
|
mv -f $@T $@
|
2003-06-12 11:30:23 +00:00
|
|
|
|
else
|
|
|
|
|
> $@
|
|
|
|
|
endif
|
2002-12-27 20:13:29 +00:00
|
|
|
|
|
|
|
|
|
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 $@
|
|
|
|
|
endif
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
# Local Variables:
|
|
|
|
|
# mode: makefile
|
|
|
|
|
# End:
|