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