Files
glibc/extra-lib.mk
T

89 lines
3.0 KiB
Makefile
Raw Normal View History

# This file is included several times in a row, once
# for each element of $(extra-libs). $(extra-libs-left)
# is initialized first to $(extra-libs) so that with each
# inclusion, we advance $(lib) to the next library name (e.g. libfoo).
# The variable $($(lib)-routines) defines the list of modules
1999-07-20 08:19:37 +00:00
# to be included in that library. A sysdep Makefile can add to
# $(lib)-sysdep_routines to include additional modules.
lib := $(firstword $(extra-libs-left))
extra-libs-left := $(filter-out $(lib),$(extra-libs-left))
object-suffixes-$(lib) := $(filter-out $($(lib)-inhibit-o),$(object-suffixes))
ifneq (,$(object-suffixes-$(lib)))
# Make sure these are simply-expanded variables before we append to them,
# since we want the expressions we append to be expanded right now.
install-lib := $(install-lib)
extra-objs := $(extra-objs)
1999-07-20 08:19:37 +00:00
# The modules that go in $(lib).
all-$(lib)-routines := $($(lib)-routines) $($(lib)-sysdep_routines)
# Add each flavor of library to the lists of things to build and install.
install-lib += $(foreach o,$(object-suffixes-$(lib)),$(lib:lib%=$(libtype$o)))
1998-11-08 10:40:28 +00:00
extra-objs += $(foreach o,$(object-suffixes-$(lib):.os=),\
$(patsubst %,%$o,$(filter-out \
$($(lib)-shared-only-routines),\
1999-07-20 08:19:37 +00:00
$(all-$(lib)-routines))))
1998-11-08 10:40:28 +00:00
ifneq (,$(filter .os,$(object-suffixes-$(lib))))
1999-07-20 08:19:37 +00:00
extra-objs += $(all-$(lib)-routines:%=%.os)
1998-11-08 10:40:28 +00:00
endif
alltypes-$(lib) := $(foreach o,$(object-suffixes-$(lib)),\
$(objpfx)$(patsubst %,$(libtype$o),\
$(lib:lib%=%)))
ifeq (,$(filter $(lib),$(extra-libs-others)))
lib-noranlib: $(alltypes-$(lib))
ifeq (yes,$(build-shared))
1996-09-07 04:10:57 +00:00
lib-noranlib: $(objpfx)$(lib).so$($(lib).so-version)
endif
else
others: $(alltypes-$(lib))
endif
# The linked shared library is never a dependent of lib-noranlib,
# because linking it will depend on libc.so already being built.
1997-08-20 03:53:21 +00:00
ifneq (,$(filter .os,$(object-suffixes-$(lib))))
1997-06-19 19:11:22 +00:00
others: $(objpfx)$(lib).so$($(lib).so-version)
endif
# Use o-iterator.mk to generate a rule for each flavor of library.
1998-11-10 19:11:20 +00:00
ifneq (,$(filter-out .os,$(object-suffixes-$(lib))))
define o-iterator-doit
$(objpfx)$(patsubst %,$(libtype$o),$(lib:lib%=%)): \
1998-11-08 10:40:28 +00:00
$(patsubst %,$(objpfx)%$o,\
$(filter-out $($(lib)-shared-only-routines),\
1999-07-20 08:19:37 +00:00
$(all-$(lib)-routines))); \
1998-11-08 10:40:28 +00:00
$$(build-extra-lib)
endef
1998-11-08 10:40:28 +00:00
object-suffixes-left = $(object-suffixes-$(lib):.os=)
include $(patsubst %,$(..)o-iterator.mk,$(object-suffixes-$(lib):.os=))
endif
ifneq (,$(filter .os,$(object-suffixes-$(lib))))
$(objpfx)$(patsubst %,$(libtype.os),$(lib:lib%=%)): \
1999-07-20 08:19:37 +00:00
$(all-$(lib)-routines:%=$(objpfx)%.os)
1998-11-08 10:40:28 +00:00
$(build-extra-lib)
endif
1998-07-20 17:25:48 +00:00
ifeq ($(versioning),yes)
1997-07-12 23:35:19 +00:00
# Add the version script to the dependencies of the shared library.
1998-07-20 17:25:48 +00:00
$(objpfx)$(lib).so: $(firstword $($(lib)-map) \
$(addprefix $(common-objpfx), \
$(filter $(lib).map, \
$(version-maps))))
endif
1997-07-12 23:35:19 +00:00
endif
2002-04-08 08:59:00 +00:00
# This will define `libof-ROUTINE := LIB' for each of the routines.
cpp-srcs-left := $($(lib)-routines) $($(lib)-sysdep_routines)
ifneq (,$(cpp-srcs-left))
include $(patsubst %,$(..)cppflags-iterator.mk,$(cpp-srcs-left))
2002-04-08 08:59:00 +00:00
endif
CPPFLAGS-$(lib) := -DNOT_IN_libc=1 -DIS_IN_$(lib)=1