]>
Commit | Line | Data |
---|---|---|
693e7b96 RM |
1 | # This file is included several times in a row, once |
2 | # for each element of $(extra-libs). $(extra-libs-left) | |
3 | # is initialized first to $(extra-libs) so that with each | |
4 | # inclusion, we advance $(lib) to the next library name (e.g. libfoo). | |
5 | # The variable $($(lib)-routines) defines the list of modules | |
b3ed8219 AS |
6 | # to be included in that library. A sysdep Makefile can add to |
7 | # $(lib)-sysdep_routines to include additional modules. | |
693e7b96 RM |
8 | |
9 | lib := $(firstword $(extra-libs-left)) | |
10 | extra-libs-left := $(filter-out $(lib),$(extra-libs-left)) | |
11 | ||
193ce8dc RM |
12 | object-suffixes-$(lib) := $(filter-out $($(lib)-inhibit-o),$(object-suffixes)) |
13 | ||
a13dab1c RM |
14 | ifneq (,$(object-suffixes-$(lib))) |
15 | ||
6aa8372e | 16 | # Make sure these are simply-expanded variables before we append to them, |
e97ec51d | 17 | # since we want the expressions we append to be expanded right now. |
6aa8372e RM |
18 | install-lib := $(install-lib) |
19 | extra-objs := $(extra-objs) | |
20 | ||
b3ed8219 AS |
21 | # The modules that go in $(lib). |
22 | all-$(lib)-routines := $($(lib)-routines) $($(lib)-sysdep_routines) | |
23 | ||
693e7b96 | 24 | # Add each flavor of library to the lists of things to build and install. |
193ce8dc | 25 | install-lib += $(foreach o,$(object-suffixes-$(lib)),$(lib:lib%=$(libtype$o))) |
05f732b3 UD |
26 | extra-objs += $(foreach o,$(object-suffixes-$(lib):.os=),\ |
27 | $(patsubst %,%$o,$(filter-out \ | |
28 | $($(lib)-shared-only-routines),\ | |
b3ed8219 | 29 | $(all-$(lib)-routines)))) |
05f732b3 | 30 | ifneq (,$(filter .os,$(object-suffixes-$(lib)))) |
b3ed8219 | 31 | extra-objs += $(all-$(lib)-routines:%=%.os) |
05f732b3 | 32 | endif |
6aa8372e | 33 | alltypes-$(lib) := $(foreach o,$(object-suffixes-$(lib)),\ |
64166d98 | 34 | $(objpfx)$(patsubst %,$(libtype$o),\ |
6aa8372e | 35 | $(lib:lib%=%))) |
693e7b96 | 36 | |
e33b438a | 37 | ifeq (,$(filter $(lib),$(extra-libs-others))) |
693e7b96 | 38 | lib-noranlib: $(alltypes-$(lib)) |
5f0e6fc7 | 39 | ifeq (yes,$(build-shared)) |
edf5b2d7 | 40 | lib-noranlib: $(objpfx)$(lib).so$($(lib).so-version) |
5f0e6fc7 | 41 | endif |
e97ec51d RM |
42 | else |
43 | others: $(alltypes-$(lib)) | |
44 | endif | |
693e7b96 | 45 | |
d06b536d RM |
46 | # The linked shared library is never a dependent of lib-noranlib, |
47 | # because linking it will depend on libc.so already being built. | |
40a55d20 | 48 | ifneq (,$(filter .os,$(object-suffixes-$(lib)))) |
d705269e | 49 | others: $(objpfx)$(lib).so$($(lib).so-version) |
d06b536d RM |
50 | endif |
51 | ||
52 | ||
693e7b96 | 53 | # Use o-iterator.mk to generate a rule for each flavor of library. |
74eee886 | 54 | ifneq (,$(filter-out .os,$(object-suffixes-$(lib)))) |
693e7b96 | 55 | define o-iterator-doit |
64166d98 | 56 | $(objpfx)$(patsubst %,$(libtype$o),$(lib:lib%=%)): \ |
05f732b3 UD |
57 | $(patsubst %,$(objpfx)%$o,\ |
58 | $(filter-out $($(lib)-shared-only-routines),\ | |
b3ed8219 | 59 | $(all-$(lib)-routines))); \ |
05f732b3 | 60 | $$(build-extra-lib) |
693e7b96 | 61 | endef |
05f732b3 UD |
62 | object-suffixes-left = $(object-suffixes-$(lib):.os=) |
63 | include $(patsubst %,$(..)o-iterator.mk,$(object-suffixes-$(lib):.os=)) | |
64 | endif | |
65 | ||
66 | ifneq (,$(filter .os,$(object-suffixes-$(lib)))) | |
67 | $(objpfx)$(patsubst %,$(libtype.os),$(lib:lib%=%)): \ | |
b3ed8219 | 68 | $(all-$(lib)-routines:%=$(objpfx)%.os) |
05f732b3 UD |
69 | $(build-extra-lib) |
70 | endif | |
a13dab1c | 71 | |
a9ddb793 | 72 | ifeq ($(versioning),yes) |
f21acc89 | 73 | # Add the version script to the dependencies of the shared library. |
a9ddb793 UD |
74 | $(objpfx)$(lib).so: $(firstword $($(lib)-map) \ |
75 | $(addprefix $(common-objpfx), \ | |
76 | $(filter $(lib).map, \ | |
77 | $(version-maps)))) | |
78 | endif | |
f21acc89 | 79 | |
a13dab1c | 80 | endif |