summaryrefslogtreecommitdiff
path: root/build-aux/Makefile.once.head/10-lt.mk
diff options
context:
space:
mode:
Diffstat (limited to 'build-aux/Makefile.once.head/10-lt.mk')
-rw-r--r--build-aux/Makefile.once.head/10-lt.mk21
1 files changed, 21 insertions, 0 deletions
diff --git a/build-aux/Makefile.once.head/10-lt.mk b/build-aux/Makefile.once.head/10-lt.mk
new file mode 100644
index 0000000000..355a5b4343
--- /dev/null
+++ b/build-aux/Makefile.once.head/10-lt.mk
@@ -0,0 +1,21 @@
+mod.lt.description = (systemd) Easy handling of libtool dependencies
+mod.lt.deps += files quote
+
+_lt.patsubst-all = $(if $1,$(call _lt.patsubst-all,$(wordlist 2,$(words $1),$1),$2,$(patsubst $(firstword $1),$2,$3)),$3)
+_lt.unLIBPATTERNS = $(foreach _lt.tmp,$1,$(if $(filter $(.LIBPATTERNS),$(notdir $(_lt.tmp))),$(call _lt.patsubst-all,$(.LIBPATTERNS),-l%,$(notdir $(_lt.tmp))),$(_lt.tmp)))
+_lt.rest = $(wordlist 2,$(words $1),$1)
+_lt.dedup = $(if $1,$(if $(filter $(firstword $1),$(call _lt.rest,$1)),,$(firstword $1) )$(call _lt.dedup,$(call _lt.rest,$1)))
+_lt.dependency_libs = $(foreach _lt.tmp,$1,$(_lt.tmp)$(if $(filter %.la,$(_lt.tmp)), $(shell . $(_lt.tmp); echo $$dependency_libs)))
+
+ lt.lib.rpath = $(dir $(patsubst $(DESTDIR)%,%,$(filter %/$(@F),$(files.sys))))
+ lt.lib.files.all = $(filter %.lo %.la -l%,$(call _lt.unLIBPATTERNS,$^))
+ lt.lib.files.ld = $(strip $(if $(lt.lib.rpath),\
+ $(lt.lib.files.all),\
+ $(filter-out %.la,$(lt.lib.files.all))))
+_lt.lib.files.dep = $(strip $(call _lt.dedup,$(filter %.la -l%,$(call _lt.dependency_libs,$(lt.lib.files.all)))))
+ lt.lib.post = $(strip $(if $(lt.lib.rpath),\
+ true,\
+ sed -i 's|^dependency_libs=.*|dependency_libs='\''$(_lt.lib.files.dep)'\''|' $@))
+
+lt.exe.files.all = $(filter %.o %.la -l%,$(call _lt.unLIBPATTERNS,$^))
+lt.exe.files.ld = $(lt.exe.files.all)