summaryrefslogtreecommitdiff
path: root/build-aux/Makefile.once.head/10-lt.mk
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@sbcglobal.net>2016-10-30 19:31:24 -0400
committerLuke Shumaker <lukeshu@sbcglobal.net>2016-10-30 19:31:24 -0400
commita01dcec5398007387f008102030838449e75a4c4 (patch)
tree36f93acabd930023124eda52f4ada7e6ee39d782 /build-aux/Makefile.once.head/10-lt.mk
parent2032840792362c62781dd2661506c5afcc7f9fe7 (diff)
at: lt: document, fix extra DESTDIR ref
Diffstat (limited to 'build-aux/Makefile.once.head/10-lt.mk')
-rw-r--r--build-aux/Makefile.once.head/10-lt.mk40
1 files changed, 38 insertions, 2 deletions
diff --git a/build-aux/Makefile.once.head/10-lt.mk b/build-aux/Makefile.once.head/10-lt.mk
index 355a5b4343..2841bfe214 100644
--- a/build-aux/Makefile.once.head/10-lt.mk
+++ b/build-aux/Makefile.once.head/10-lt.mk
@@ -1,13 +1,49 @@
mod.lt.description = (systemd) Easy handling of libtool dependencies
-mod.lt.deps += files quote
+mod.lt.depends += files
+define mod.lt.doc
+# Inputs:
+# - Global variable : `$(.LIBPATTERNS)`
+# - Directory variable : `$(files.sys)`
+# - Target variable : `$@`
+# - Target variable : `$(@F)`
+# - Target variable : `$^`
+# Outputs:
+# - Target variable : `lt.lib.rpath` (`$(@D)`, `$(files.sys)`)
+# - Target variable : `lt.lib.files.all` (`$^`, `$(.LIBPATTERNS)`)
+# - Target variable : `lt.lib.files.ld` (`$(lt.lib.rpath)`, `$(lt.lib.files.all)`)
+# - Target variable : `lt.lib.post` (`$(lt.lib.rpath)`, `$(lt.lib.files.all)`)
+# - Target variable : `lt.exe.files.all` (`$^`, `$(.LIBPATTERNS)`)
+# - Target variable : `lt.exe.files.ld` (an alias for `lt.exe.files.all`)
+#
+# A set of variables to make interacting with libtool a little easier.
+#
+# libtool tries to abstract away the difference between static libraries
+# and dynamic libraries. But, it does a crappy job. If one library
+# depends on another library, you have to care about which of them are
+# static and which are dynamic, or you'll either end up with missing
+# symbols, or duplicate symbols. Either way, it will fail to link your
+# executable.
+#
+# So, our workaround: don't pass any .la libraries to libtool/ld when
+# linking a convenience library, but then run a post-libtool command to
+# insert them into the .la file's dependency_libs. This uses the
+# emptiness of lt.lib.rpath to determine if a library is a static
+# convenience library or not.
+endef
+mod.lt.doc := $(value mod.lt.doc)
_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)
+# Usage: $(call _lt.dedup,ITEM1 ITEM2 ITEM3)
+# Removes duplicate items while keeping the order the same (the leftmost of a duplicate is used).
_lt.dedup = $(if $1,$(if $(filter $(firstword $1),$(call _lt.rest,$1)),,$(firstword $1) )$(call _lt.dedup,$(call _lt.rest,$1)))
+# Usage: $(call _lt.dependency_libs,LIB1.la OBJ.lo LIB2.la)
+# => LIB1.la LIB1.la:dependency_libs OBJ.lo LIB2.la LIB2.la:dependency_libs
+# Insert a .la library's dependency_libs after the library itself in the list.
_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.rpath = $(dir $(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),\