OLD | NEW |
1 # This file is included several times in a row, once | 1 # This file is included several times in a row, once |
2 # for each element of $(extra-libs). $(extra-libs-left) | 2 # for each element of $(extra-libs). $(extra-libs-left) |
3 # is initialized first to $(extra-libs) so that with each | 3 # is initialized first to $(extra-libs) so that with each |
4 # inclusion, we advance $(lib) to the next library name (e.g. libfoo). | 4 # inclusion, we advance $(lib) to the next library name (e.g. libfoo). |
5 # The variable $($(lib)-routines) defines the list of modules | 5 # The variable $($(lib)-routines) defines the list of modules |
6 # to be included in that library. A sysdep Makefile can add to | 6 # to be included in that library. A sysdep Makefile can add to |
7 # $(lib)-sysdep_routines to include additional modules. | 7 # $(lib)-sysdep_routines to include additional modules. |
8 | 8 |
9 lib := $(firstword $(extra-libs-left)) | 9 lib := $(firstword $(extra-libs-left)) |
10 extra-libs-left := $(filter-out $(lib),$(extra-libs-left)) | 10 extra-libs-left := $(filter-out $(lib),$(extra-libs-left)) |
11 | 11 |
12 object-suffixes-$(lib) := $(filter-out $($(lib)-inhibit-o),$(object-suffixes)) | 12 object-suffixes-$(lib) := $(filter-out $($(lib)-inhibit-o),$(object-suffixes)) |
13 | 13 |
14 ifneq (,$($(lib)-static-only-routines)) | 14 ifneq (,$($(lib)-static-only-routines)) |
15 ifneq (,$(filter yesyes%,$(build-shared)$(elf)$($(lib).so-version))) | 15 ifneq (,$(filter yesyes%,$(build-shared)$(elf)$($(lib).so-version))) |
16 object-suffixes-$(lib) += $(filter-out $($(lib)-inhibit-o),.oS) | 16 object-suffixes-$(lib) += $(filter-out $($(lib)-inhibit-o),.ons) |
17 endif | 17 endif |
18 endif | 18 endif |
19 | 19 |
20 ifneq (,$(object-suffixes-$(lib))) | 20 ifneq (,$(object-suffixes-$(lib))) |
21 | 21 |
22 # Make sure these are simply-expanded variables before we append to them, | 22 # Make sure these are simply-expanded variables before we append to them, |
23 # since we want the expressions we append to be expanded right now. | 23 # since we want the expressions we append to be expanded right now. |
24 install-lib := $(install-lib) | 24 install-lib := $(install-lib) |
25 extra-objs := $(extra-objs) | 25 extra-objs := $(extra-objs) |
26 | 26 |
27 # The modules that go in $(lib). | 27 # The modules that go in $(lib). |
28 all-$(lib)-routines := $($(lib)-routines) $($(lib)-sysdep_routines) | 28 all-$(lib)-routines := $($(lib)-routines) $($(lib)-sysdep_routines) |
29 | 29 |
30 # Add each flavor of library to the lists of things to build and install. | 30 # Add each flavor of library to the lists of things to build and install. |
31 install-lib += $(foreach o,$(object-suffixes-$(lib)),$(lib:lib%=$(libtype$o))) | 31 install-lib += $(foreach o,$(object-suffixes-$(lib)),$(lib:lib%=$(libtype$o))) |
32 extra-objs += $(foreach o,$(filter-out .os .oS,$(object-suffixes-$(lib))),\ | 32 extra-objs += $(foreach o,$(filter-out .os .ons,$(object-suffixes-$(lib))),\ |
33 $(patsubst %,%$o,$(filter-out \ | 33 $(patsubst %,%$o,$(filter-out \ |
34 $($(lib)-shared-only-routines),\ | 34 $($(lib)-shared-only-routines),\ |
35 $(all-$(lib)-routines)))) | 35 $(all-$(lib)-routines)))) |
36 ifneq (,$(filter .os,$(object-suffixes-$(lib)))) | 36 ifneq (,$(filter .os,$(object-suffixes-$(lib)))) |
37 extra-objs += $(all-$(lib)-routines:%=%.os) | 37 extra-objs += $(all-$(lib)-routines:%=%.os) |
38 endif | 38 endif |
39 alltypes-$(lib) := $(foreach o,$(object-suffixes-$(lib)),\ | 39 alltypes-$(lib) := $(foreach o,$(object-suffixes-$(lib)),\ |
40 $(objpfx)$(patsubst %,$(libtype$o),\ | 40 $(objpfx)$(patsubst %,$(libtype$o),\ |
41 $(lib:lib%=%))) | 41 $(lib:lib%=%))) |
42 | 42 |
43 ifeq (,$(filter $(lib),$(extra-libs-others))) | 43 ifeq (,$(filter $(lib),$(extra-libs-others))) |
44 lib-noranlib: $(alltypes-$(lib)) | 44 lib-noranlib: $(alltypes-$(lib)) |
45 ifeq (yes,$(build-shared)) | 45 ifeq (yes,$(build-shared)) |
46 lib-noranlib: $(objpfx)$(lib).so$($(lib).so-version) | 46 lib-noranlib: $(objpfx)$(lib).so$($(lib).so-version) |
47 endif | 47 endif |
48 else | 48 else |
49 others: $(alltypes-$(lib)) | 49 others: $(alltypes-$(lib)) |
50 endif | 50 endif |
51 | 51 |
52 # The linked shared library is never a dependent of lib-noranlib, | 52 # The linked shared library is never a dependent of lib-noranlib, |
53 # because linking it will depend on libc.so already being built. | 53 # because linking it will depend on libc.so already being built. |
54 ifneq (,$(filter .os,$(object-suffixes-$(lib)))) | 54 ifneq (,$(filter .os,$(object-suffixes-$(lib)))) |
55 others: $(objpfx)$(lib).so$($(lib).so-version) | 55 others: $(objpfx)$(lib).so$($(lib).so-version) |
56 endif | 56 endif |
57 | 57 |
58 | 58 |
59 # Use o-iterator.mk to generate a rule for each flavor of library. | 59 # Use o-iterator.mk to generate a rule for each flavor of library. |
60 ifneq (,$(filter-out .os .oS,$(object-suffixes-$(lib)))) | 60 ifneq (,$(filter-out .os .ons,$(object-suffixes-$(lib)))) |
61 define o-iterator-doit | 61 define o-iterator-doit |
62 $(objpfx)$(patsubst %,$(libtype$o),$(lib:lib%=%)): \ | 62 $(objpfx)$(patsubst %,$(libtype$o),$(lib:lib%=%)): \ |
63 $(patsubst %,$(objpfx)%$o,\ | 63 $(patsubst %,$(objpfx)%$o,\ |
64 $(filter-out $($(lib)-shared-only-routines),\ | 64 $(filter-out $($(lib)-shared-only-routines),\ |
65 $(all-$(lib)-routines))); \ | 65 $(all-$(lib)-routines))); \ |
66 $$(build-extra-lib) | 66 $$(build-extra-lib) |
67 endef | 67 endef |
68 object-suffixes-left = $(filter-out .os .oS,$(object-suffixes-$(lib))) | 68 object-suffixes-left = $(filter-out .os .ons,$(object-suffixes-$(lib))) |
69 include $(patsubst %,$(..)o-iterator.mk,$(object-suffixes-left)) | 69 include $(patsubst %,$(..)o-iterator.mk,$(object-suffixes-left)) |
70 endif | 70 endif |
71 | 71 |
72 ifneq (,$(filter .os,$(object-suffixes-$(lib)))) | 72 ifneq (,$(filter .os,$(object-suffixes-$(lib)))) |
73 $(objpfx)$(patsubst %,$(libtype.os),$(lib:lib%=%)): \ | 73 $(objpfx)$(patsubst %,$(libtype.os),$(lib:lib%=%)): \ |
74 $(patsubst %,$(objpfx)%.os,\ | 74 $(patsubst %,$(objpfx)%.os,\ |
75 $(filter-out $($(lib)-static-only-routines),\ | 75 $(filter-out $($(lib)-static-only-routines),\ |
76 $(all-$(lib)-routines))) | 76 $(all-$(lib)-routines))) |
77 $(build-extra-lib) | 77 $(build-extra-lib) |
78 endif | 78 endif |
79 | 79 |
80 ifneq (,$(filter .oS,$(object-suffixes-$(lib)))) | 80 ifneq (,$(filter .ons,$(object-suffixes-$(lib)))) |
81 $(objpfx)$(patsubst %,$(libtype.oS),$(lib:lib%=%)): \ | 81 $(objpfx)$(patsubst %,$(libtype.ons),$(lib:lib%=%)): \ |
82 $(patsubst %,$(objpfx)%.oS,\ | 82 $(patsubst %,$(objpfx)%.ons,\ |
83 $(filter $($(lib)-static-only-routines),\ | 83 $(filter $($(lib)-static-only-routines),\ |
84 $(all-$(lib)-routines))) | 84 $(all-$(lib)-routines))) |
85 $(build-extra-lib) | 85 $(build-extra-lib) |
86 endif | 86 endif |
87 | 87 |
88 ifeq ($(versioning),yes) | 88 ifeq ($(versioning),yes) |
89 # Add the version script to the dependencies of the shared library. | 89 # Add the version script to the dependencies of the shared library. |
90 $(objpfx)$(lib).so: $(firstword $($(lib)-map) \ | 90 $(objpfx)$(lib).so: $(firstword $($(lib)-map) \ |
91 $(addprefix $(common-objpfx), \ | 91 $(addprefix $(common-objpfx), \ |
92 $(filter $(lib).map, \ | 92 $(filter $(lib).map, \ |
93 $(version-maps)))) | 93 $(version-maps)))) |
94 endif | 94 endif |
95 | 95 |
96 endif | 96 endif |
97 | 97 |
98 # This will define `libof-ROUTINE := LIB' for each of the routines. | 98 # This will define `libof-ROUTINE := LIB' for each of the routines. |
99 cpp-srcs-left := $($(lib)-routines) $($(lib)-sysdep_routines) | 99 cpp-srcs-left := $($(lib)-routines) $($(lib)-sysdep_routines) |
100 ifneq (,$(cpp-srcs-left)) | 100 ifneq (,$(cpp-srcs-left)) |
101 include $(patsubst %,$(..)cppflags-iterator.mk,$(cpp-srcs-left)) | 101 include $(patsubst %,$(..)cppflags-iterator.mk,$(cpp-srcs-left)) |
102 endif | 102 endif |
103 | 103 |
104 CPPFLAGS-$(lib) := -DNOT_IN_libc=1 -DIS_IN_$(lib)=1 | 104 CPPFLAGS-$(lib) := -DNOT_IN_libc=1 -DIS_IN_$(lib)=1 |
OLD | NEW |