Sun Jun 9 01:11:49 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu>
[glibc.git] / extra-lib.mk
blob283da06b93d623685ecd3615109f4e73d9a24680
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.
8 lib := $(firstword $(extra-libs-left))
9 extra-libs-left := $(filter-out $(lib),$(extra-libs-left))
11 object-suffixes-$(lib) := $(filter-out $($(lib)-inhibit-o),$(object-suffixes))
13 ifneq (,$(object-suffixes-$(lib)))
15 # Make sure these are simply-expanded variables before we append to them,
16 # since we want the expressions we append to be expanded right now.
17 install-lib := $(install-lib)
18 extra-objs := $(extra-objs)
20 # Add each flavor of library to the lists of things to build and install.
21 install-lib += $(foreach o,$(object-suffixes-$(lib)),$(lib:lib%=$(libtype$o)))
22 extra-objs += $(foreach o,$(object-suffixes-$(lib)),\
23 $(patsubst %,%$o,$($(lib)-routines)))
24 alltypes-$(lib) := $(foreach o,$(object-suffixes-$(lib)),\
25 $(objpfx)$(patsubst %,$(libtype$o),\
26 $(lib:lib%=%)))
28 ifeq (,$($(lib)-no-lib-dep))
29 lib-noranlib: $(alltypes-$(lib))
30 else
31 others: $(alltypes-$(lib))
32 endif
34 # The linked shared library is never a dependent of lib-noranlib,
35 # because linking it will depend on libc.so already being built.
36 ifneq (,$(filter .so,$(object-suffixes-$(lib))))
37 others: $(objpfx)$(lib).so
38 endif
41 # Use o-iterator.mk to generate a rule for each flavor of library.
42 define o-iterator-doit
43 $(objpfx)$(patsubst %,$(libtype$o),$(lib:lib%=%)): \
44 $($(lib)-routines:%=$(objpfx)%$o); $$(build-extra-lib)
45 endef
46 object-suffixes-left = $(object-suffixes-$(lib))
47 include $(patsubst %,$(..)o-iterator.mk,$(object-suffixes-$(lib)))
49 endif