about summary refs log tree commit diff
path: root/extra-lib.mk
diff options
context:
space:
mode:
Diffstat (limited to 'extra-lib.mk')
-rw-r--r--extra-lib.mk26
1 files changed, 21 insertions, 5 deletions
diff --git a/extra-lib.mk b/extra-lib.mk
index 5428523e06..775eb23cdd 100644
--- a/extra-lib.mk
+++ b/extra-lib.mk
@@ -11,6 +11,12 @@ extra-libs-left := $(filter-out $(lib),$(extra-libs-left))
 
 object-suffixes-$(lib) := $(filter-out $($(lib)-inhibit-o),$(object-suffixes))
 
+ifneq (,$($(lib)-static-only-routines))
+ifneq (,$(filter yesyes%,$(build-shared)$(elf)$($(lib).so-version)))
+object-suffixes-$(lib) += $(filter-out $($(lib)-inhibit-o),.oS)
+endif
+endif
+
 ifneq (,$(object-suffixes-$(lib)))
 
 # Make sure these are simply-expanded variables before we append to them,
@@ -23,7 +29,7 @@ all-$(lib)-routines := $($(lib)-routines) $($(lib)-sysdep_routines)
 
 # Add each flavor of library to the lists of things to build and install.
 install-lib += $(foreach o,$(object-suffixes-$(lib)),$(lib:lib%=$(libtype$o)))
-extra-objs += $(foreach o,$(object-suffixes-$(lib):.os=),\
+extra-objs += $(foreach o,$(filter-out .os .oS,$(object-suffixes-$(lib))),\
 			$(patsubst %,%$o,$(filter-out \
 					   $($(lib)-shared-only-routines),\
 					   $(all-$(lib)-routines))))
@@ -51,7 +57,7 @@ endif
 
 
 # Use o-iterator.mk to generate a rule for each flavor of library.
-ifneq (,$(filter-out .os,$(object-suffixes-$(lib))))
+ifneq (,$(filter-out .os .oS,$(object-suffixes-$(lib))))
 define o-iterator-doit
 $(objpfx)$(patsubst %,$(libtype$o),$(lib:lib%=%)): \
   $(patsubst %,$(objpfx)%$o,\
@@ -59,13 +65,23 @@ $(objpfx)$(patsubst %,$(libtype$o),$(lib:lib%=%)): \
 			  $(all-$(lib)-routines))); \
 	$$(build-extra-lib)
 endef
-object-suffixes-left = $(object-suffixes-$(lib):.os=)
-include $(patsubst %,$(..)o-iterator.mk,$(object-suffixes-$(lib):.os=))
+object-suffixes-left = $(filter-out .os .oS,$(object-suffixes-$(lib)))
+include $(patsubst %,$(..)o-iterator.mk,$(object-suffixes-left))
 endif
 
 ifneq (,$(filter .os,$(object-suffixes-$(lib))))
 $(objpfx)$(patsubst %,$(libtype.os),$(lib:lib%=%)): \
-  $(all-$(lib)-routines:%=$(objpfx)%.os)
+  $(patsubst %,$(objpfx)%.os,\
+	     $(filter-out $($(lib)-static-only-routines),\
+			  $(all-$(lib)-routines)))
+	$(build-extra-lib)
+endif
+
+ifneq (,$(filter .oS,$(object-suffixes-$(lib))))
+$(objpfx)$(patsubst %,$(libtype.oS),$(lib:lib%=%)): \
+  $(patsubst %,$(objpfx)%.oS,\
+	     $(filter $($(lib)-static-only-routines),\
+		      $(all-$(lib)-routines)))
 	$(build-extra-lib)
 endif