about summary refs log tree commit diff
path: root/mk
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2013-11-25T16·38+0000
committerEelco Dolstra <eelco.dolstra@logicblox.com>2013-11-25T16·38+0000
commit9285f0aa2b44427afef7c50f0efae8f74307a7a5 (patch)
tree1679f4cef8c5f035b6810cb6138af9b74da81717 /mk
parent8f08046606c147004642a7569f78bc61ab450419 (diff)
Add a Makefile for the Perl stuff
Diffstat (limited to 'mk')
-rw-r--r--mk/lib.mk2
-rw-r--r--mk/libraries.mk17
2 files changed, 13 insertions, 6 deletions
diff --git a/mk/lib.mk b/mk/lib.mk
index a1634bc002..107a5af3f7 100644
--- a/mk/lib.mk
+++ b/mk/lib.mk
@@ -58,4 +58,4 @@ $(foreach script, $(noinst_SCRIPTS), $(eval programs_list += $(script)))
 $(foreach template, $(template_files), $(eval $(call instantiate-template,$(template))))
 
 
-all: $(programs_list)
+all: $(programs_list) $(libs_list)
diff --git a/mk/libraries.mk b/mk/libraries.mk
index 633bfdba81..58c67063be 100644
--- a/mk/libraries.mk
+++ b/mk/libraries.mk
@@ -22,11 +22,14 @@ libs_list :=
 # - $(1)_LDFLAGS_PROPAGATED: additional linker flags, also propagated
 #   to the linking of programs/libraries that use this library.
 #
+# - $(1)_FORCE_INSTALL: if defined, the library will be installed even
+#   if it's not needed (i.e. dynamically linked) by a program.
+#
+# - $(1)_INSTALL_DIR: the directory where the library will be
+#   installed.  Defaults to $(libdir).
+#
 # - BUILD_SHARED_LIBS: if equal to ‘1’, a dynamic library will be
 #   built, otherwise a static library.
-#
-# - libdir: the directory where the library will be installed (if
-#   required).
 define build-library =
   $(1)_NAME ?= $(1)
   _d := $$(strip $$($(1)_DIR))
@@ -34,6 +37,8 @@ define build-library =
   $(1)_OBJS := $$(addsuffix .o, $$(basename $$(_srcs)))
   _libs := $$(foreach lib, $$($(1)_LIBS), $$($$(lib)_PATH))
 
+  $(1)_INSTALL_DIR ?= $$(libdir)
+
   $(1)_LDFLAGS_USE :=
   $(1)_LDFLAGS_USE_INSTALLED :=
 
@@ -50,8 +55,6 @@ define build-library =
 
     $(1)_LDFLAGS_USE += -L$$(_d) -Wl,-rpath,$$(abspath $$(_d)) -l$$(patsubst lib%,%,$$(strip $$($(1)_NAME)))
 
-    $(1)_INSTALL_DIR := $$(libdir)
-
     $(1)_INSTALL_PATH := $$($(1)_INSTALL_DIR)/$$($(1)_NAME).so
 
     _libs_final := $$(foreach lib, $$($(1)_LIBS), $$($$(lib)_INSTALL_PATH))
@@ -63,6 +66,10 @@ define build-library =
 
     $(1)_LDFLAGS_USE_INSTALLED += -L$$($(1)_INSTALL_DIR) -Wl,-rpath,$$($(1)_INSTALL_DIR) -l$$(patsubst lib%,%,$$(strip $$($(1)_NAME)))
 
+    ifdef $(1)_FORCE_INSTALL
+      install: $$($(1)_INSTALL_PATH)
+    endif
+
   else
 
     $(1)_PATH := $$(_d)/$$($(1)_NAME).a