Remove set-hooks.h from generic includes
[glibc.git] / extra-lib.mk
blob72f8d2e1dfa364bd7d0ebc9ac62083c9d802fef1
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
6 # to be included in that library. A sysdep Makefile can add to
7 # $(lib)-sysdep_routines to include additional modules.
9 # Libraries listed in $(extra-libs-noinstall) are built, but not
10 # installed.
12 lib := $(firstword $(extra-libs-left))
13 extra-libs-left := $(filter-out $(lib),$(extra-libs-left))
15 object-suffixes-$(lib) := $(filter-out $($(lib)-inhibit-o),$(object-suffixes))
17 ifneq (,$($(lib)-static-only-routines))
18 ifneq (,$(filter yes%,$(build-shared)$($(lib).so-version)))
19 object-suffixes-$(lib) += $(filter-out $($(lib)-inhibit-o),.oS)
20 endif
21 endif
23 ifneq (,$(object-suffixes-$(lib)))
25 # Make sure these are simply-expanded variables before we append to them,
26 # since we want the expressions we append to be expanded right now.
27 install-lib := $(install-lib)
28 extra-objs := $(extra-objs)
30 # The modules that go in $(lib).
31 all-$(lib)-routines := $($(lib)-routines) $($(lib)-sysdep_routines)
33 # Add each flavor of library to the lists of things to build and install.
34 ifeq (,$(filter $(lib), $(extra-libs-noinstall)))
35 install-lib += $(foreach o,$(object-suffixes-$(lib)),$(lib:lib%=$(libtype$o)))
36 endif
37 extra-objs += $(foreach o,$(filter-out .os .oS,$(object-suffixes-$(lib))),\
38 $(patsubst %,%$o,$(filter-out \
39 $($(lib)-shared-only-routines),\
40 $(all-$(lib)-routines))))
41 ifneq (,$(filter .os,$(object-suffixes-$(lib))))
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)))
48 endif
49 alltypes-$(lib) := $(foreach o,$(object-suffixes-$(lib)),\
50 $(objpfx)$(patsubst %,$(libtype$o),\
51 $(lib:lib%=%)))
53 ifeq (,$(filter $(lib),$(extra-libs-others)))
54 lib-noranlib: $(alltypes-$(lib))
55 ifeq (yes,$(build-shared))
56 lib-noranlib: $(objpfx)$(lib).so$($(lib).so-version)
57 endif
58 else
59 others: $(alltypes-$(lib))
60 endif
62 # The linked shared library is never a dependent of lib-noranlib,
63 # because linking it will depend on libc.so already being built.
64 ifneq (,$(filter .os,$(object-suffixes-$(lib))))
65 others: $(objpfx)$(lib).so$($(lib).so-version)
66 endif
69 # Use o-iterator.mk to generate a rule for each flavor of library.
70 ifneq (,$(filter-out .os .oS,$(object-suffixes-$(lib))))
71 define o-iterator-doit
72 $(objpfx)$(patsubst %,$(libtype$o),$(lib:lib%=%)): \
73 $(patsubst %,$(objpfx)%$o,\
74 $(filter-out $($(lib)-shared-only-routines),\
75 $(all-$(lib)-routines))); \
76 $$(build-extra-lib)
77 endef
78 object-suffixes-left = $(filter-out .os .oS,$(object-suffixes-$(lib)))
79 include $(patsubst %,$(..)o-iterator.mk,$(object-suffixes-left))
80 endif
82 ifneq (,$(filter .os,$(object-suffixes-$(lib))))
83 $(objpfx)$(patsubst %,$(libtype.os),$(lib:lib%=%)): \
84 $(patsubst %,$(objpfx)%.os,\
85 $(filter-out $($(lib)-static-only-routines),\
86 $(all-$(lib)-routines)))
87 $(build-extra-lib)
88 endif
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)))
95 $(build-extra-lib)
96 endif
98 ifeq ($(build-shared),yes)
99 # Add the version script to the dependencies of the shared library.
100 $(objpfx)$(lib).so: $(firstword $($(lib)-map) \
101 $(addprefix $(common-objpfx), \
102 $(filter $(lib).map, \
103 $(version-maps))))
104 endif
106 endif
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))
111 include $(patsubst %,$(..)libof-iterator.mk,$(cpp-srcs-left))
112 endif