about summary refs log tree commit diff
path: root/mk/libraries.mk
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2013-12-16T15·49+0100
committerEelco Dolstra <eelco.dolstra@logicblox.com>2013-12-16T15·49+0100
commita630635d7f0e63a865ddd3b0a3cf2d44c603c0e5 (patch)
treec2e6c696dea0509f0a54c33ad4d8b289f4a5a91c /mk/libraries.mk
parent4da804651378b612313c8fb71688f71a4717a26e (diff)
No longer interpret $(..._SOURCES) relative to $(..._DIR)
Diffstat (limited to 'mk/libraries.mk')
-rw-r--r--mk/libraries.mk11
1 files changed, 8 insertions, 3 deletions
diff --git a/mk/libraries.mk b/mk/libraries.mk
index bea684490f7e..bc258b799f55 100644
--- a/mk/libraries.mk
+++ b/mk/libraries.mk
@@ -6,11 +6,13 @@ libs_list :=
 # - $(1)_NAME: the name of the library (e.g. ‘libfoo’); defaults to
 #   $(1).
 #
-# - $(1)_DIR: the directory containing the sources of the library, and
-#   where the (non-installed) library will be placed.
+# - $(1)_DIR: the directory where the (non-installed) library will be
+#   placed.
 #
 # - $(1)_SOURCES: the source files of the library.
 #
+# - $(1)_CXXFLAGS: additional C++ compiler flags.
+#
 # - $(1)_LIBS: the symbolic names of other libraries on which this
 #   library depends.
 #
@@ -33,7 +35,7 @@ libs_list :=
 define build-library =
   $(1)_NAME ?= $(1)
   _d := $$(strip $$($(1)_DIR))
-  _srcs := $$(foreach src, $$($(1)_SOURCES), $$(_d)/$$(src))
+  _srcs := $$(foreach src, $$($(1)_SOURCES), $$(src))
   $(1)_OBJS := $$(addsuffix .o, $$(basename $$(_srcs)))
   _libs := $$(foreach lib, $$($(1)_LIBS), $$($$(lib)_PATH))
 
@@ -89,6 +91,9 @@ define build-library =
   # Propagate CXXFLAGS to the individual object files.
   $$(foreach obj, $$($(1)_OBJS), $$(eval $$(obj)_CXXFLAGS=$$($(1)_CXXFLAGS)))
 
+  # Make each object file depend on the common dependencies.
+  $$(foreach obj, $$($(1)_OBJS), $$(eval $$(obj): $$($(1)_COMMON_DEPS)))
+
   # Include .dep files, if they exist.
   $(1)_DEPS := $$(addsuffix .dep, $$(basename $$(_srcs)))
   -include $$($(1)_DEPS)