]>
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. | |
c23de0aa FW |
8 | # |
9 | # Libraries listed in $(extra-libs-noinstall) are built, but not | |
10 | # installed. | |
693e7b96 | 11 | |
0a951d0e | 12 | lib := $(firstword $(extra-libs-left)) |
693e7b96 RM |
13 | extra-libs-left := $(filter-out $(lib),$(extra-libs-left)) |
14 | ||
193ce8dc RM |
15 | object-suffixes-$(lib) := $(filter-out $($(lib)-inhibit-o),$(object-suffixes)) |
16 | ||
3f488b9c | 17 | ifneq (,$($(lib)-static-only-routines)) |
0269750c | 18 | ifneq (,$(filter yes%,$(build-shared)$($(lib).so-version))) |
3f488b9c RM |
19 | object-suffixes-$(lib) += $(filter-out $($(lib)-inhibit-o),.oS) |
20 | endif | |
21 | endif | |
22 | ||
a13dab1c RM |
23 | ifneq (,$(object-suffixes-$(lib))) |
24 | ||
6aa8372e | 25 | # Make sure these are simply-expanded variables before we append to them, |
e97ec51d | 26 | # since we want the expressions we append to be expanded right now. |
6aa8372e RM |
27 | install-lib := $(install-lib) |
28 | extra-objs := $(extra-objs) | |
29 | ||
b3ed8219 AS |
30 | # The modules that go in $(lib). |
31 | all-$(lib)-routines := $($(lib)-routines) $($(lib)-sysdep_routines) | |
32 | ||
693e7b96 | 33 | # Add each flavor of library to the lists of things to build and install. |
c23de0aa | 34 | ifeq (,$(filter $(lib), $(extra-libs-noinstall))) |
193ce8dc | 35 | install-lib += $(foreach o,$(object-suffixes-$(lib)),$(lib:lib%=$(libtype$o))) |
c23de0aa | 36 | endif |
3f488b9c | 37 | extra-objs += $(foreach o,$(filter-out .os .oS,$(object-suffixes-$(lib))),\ |
05f732b3 UD |
38 | $(patsubst %,%$o,$(filter-out \ |
39 | $($(lib)-shared-only-routines),\ | |
b3ed8219 | 40 | $(all-$(lib)-routines)))) |
05f732b3 | 41 | ifneq (,$(filter .os,$(object-suffixes-$(lib)))) |
9dc7c64f AS |
42 | extra-objs += $(patsubst %,%.os,$(filter-out $($(lib)-static-only-routines),\ |
43 | $(all-$(lib)-routines))) | |
44 | endif | |
45 | ifneq (,$(filter .oS,$(object-suffixes-$(lib)))) | |
46 | extra-objs += $(patsubst %,%.oS,$(filter $($(lib)-static-only-routines),\ | |
47 | $(all-$(lib)-routines))) | |
05f732b3 | 48 | endif |
6aa8372e | 49 | alltypes-$(lib) := $(foreach o,$(object-suffixes-$(lib)),\ |
64166d98 | 50 | $(objpfx)$(patsubst %,$(libtype$o),\ |
6aa8372e | 51 | $(lib:lib%=%))) |
693e7b96 | 52 | |
e33b438a | 53 | ifeq (,$(filter $(lib),$(extra-libs-others))) |
693e7b96 | 54 | lib-noranlib: $(alltypes-$(lib)) |
5f0e6fc7 | 55 | ifeq (yes,$(build-shared)) |
edf5b2d7 | 56 | lib-noranlib: $(objpfx)$(lib).so$($(lib).so-version) |
5f0e6fc7 | 57 | endif |
e97ec51d RM |
58 | else |
59 | others: $(alltypes-$(lib)) | |
60 | endif | |
693e7b96 | 61 | |
d06b536d RM |
62 | # The linked shared library is never a dependent of lib-noranlib, |
63 | # because linking it will depend on libc.so already being built. | |
40a55d20 | 64 | ifneq (,$(filter .os,$(object-suffixes-$(lib)))) |
d705269e | 65 | others: $(objpfx)$(lib).so$($(lib).so-version) |
d06b536d RM |
66 | endif |
67 | ||
68 | ||
693e7b96 | 69 | # Use o-iterator.mk to generate a rule for each flavor of library. |
3f488b9c | 70 | ifneq (,$(filter-out .os .oS,$(object-suffixes-$(lib)))) |
693e7b96 | 71 | define o-iterator-doit |
64166d98 | 72 | $(objpfx)$(patsubst %,$(libtype$o),$(lib:lib%=%)): \ |
05f732b3 UD |
73 | $(patsubst %,$(objpfx)%$o,\ |
74 | $(filter-out $($(lib)-shared-only-routines),\ | |
b3ed8219 | 75 | $(all-$(lib)-routines))); \ |
05f732b3 | 76 | $$(build-extra-lib) |
693e7b96 | 77 | endef |
3f488b9c RM |
78 | object-suffixes-left = $(filter-out .os .oS,$(object-suffixes-$(lib))) |
79 | include $(patsubst %,$(..)o-iterator.mk,$(object-suffixes-left)) | |
05f732b3 UD |
80 | endif |
81 | ||
82 | ifneq (,$(filter .os,$(object-suffixes-$(lib)))) | |
83 | $(objpfx)$(patsubst %,$(libtype.os),$(lib:lib%=%)): \ | |
3f488b9c RM |
84 | $(patsubst %,$(objpfx)%.os,\ |
85 | $(filter-out $($(lib)-static-only-routines),\ | |
86 | $(all-$(lib)-routines))) | |
87 | $(build-extra-lib) | |
88 | endif | |
89 | ||
90 | ifneq (,$(filter .oS,$(object-suffixes-$(lib)))) | |
91 | $(objpfx)$(patsubst %,$(libtype.oS),$(lib:lib%=%)): \ | |
92 | $(patsubst %,$(objpfx)%.oS,\ | |
93 | $(filter $($(lib)-static-only-routines),\ | |
94 | $(all-$(lib)-routines))) | |
05f732b3 UD |
95 | $(build-extra-lib) |
96 | endif | |
a13dab1c | 97 | |
3f2e46a4 | 98 | ifeq ($(build-shared),yes) |
f21acc89 | 99 | # Add the version script to the dependencies of the shared library. |
a9ddb793 UD |
100 | $(objpfx)$(lib).so: $(firstword $($(lib)-map) \ |
101 | $(addprefix $(common-objpfx), \ | |
102 | $(filter $(lib).map, \ | |
103 | $(version-maps)))) | |
104 | endif | |
f21acc89 | 105 | |
a13dab1c | 106 | endif |
71319b9c | 107 | |
0a951d0e RM |
108 | # This will define `libof-ROUTINE := LIB' for each of the routines. |
109 | cpp-srcs-left := $($(lib)-routines) $($(lib)-sysdep_routines) | |
110 | ifneq (,$(cpp-srcs-left)) | |
2bfdaedd | 111 | include $(patsubst %,$(..)libof-iterator.mk,$(cpp-srcs-left)) |
71319b9c | 112 | endif |