about summary refs log tree commit diff
path: root/mk/programs.mk
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2014-08-20T16·44+0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2014-08-20T16·44+0200
commitc93690a68abdc6e39f2790d7960420bba46da555 (patch)
tree7b6456adc44fbaa05e5be8817b751c144cd2a19e /mk/programs.mk
parentf0610e28e8d4da86b90d10bfb85bbfc72219cf28 (diff)
parent2aa93858afee22e0c32d8f4366970976374091ac (diff)
Merge commit '2aa93858afee22e0c32d8f4366970976374091ac'
Diffstat (limited to 'mk/programs.mk')
-rw-r--r--mk/programs.mk10
1 files changed, 10 insertions, 0 deletions
diff --git a/mk/programs.mk b/mk/programs.mk
index b6de0689404c..72afdf95251b 100644
--- a/mk/programs.mk
+++ b/mk/programs.mk
@@ -12,6 +12,9 @@ programs-list :=
 #
 # - $(1)_CXXFLAGS: additional C++ compiler flags.
 #
+# - $(1)_ORDER_AFTER: a set of targets on which the object files of
+#   this program will have an order-only dependency.
+#
 # - $(1)_LIBS: the symbolic names of libraries on which this program
 #   depends.
 #
@@ -59,6 +62,13 @@ define build-program
   # Make each object file depend on the common dependencies.
   $$(foreach obj, $$($(1)_OBJS), $$(eval $$(obj): $$($(1)_COMMON_DEPS) $$(GLOBAL_COMMON_DEPS)))
 
+  # Make each object file have order-only dependencies on the common
+  # order-only dependencies. This includes the order-only dependencies
+  # of libraries we're depending on.
+  $(1)_ORDER_AFTER_CLOSED = $$($(1)_ORDER_AFTER) $$(foreach lib, $$($(1)_LIBS), $$($$(lib)_ORDER_AFTER_CLOSED))
+
+  $$(foreach obj, $$($(1)_OBJS), $$(eval $$(obj): | $$($(1)_ORDER_AFTER_CLOSED) $$(GLOBAL_ORDER_AFTER)))
+
   # Include .dep files, if they exist.
   $(1)_DEPS := $$(foreach fn, $$($(1)_OBJS), $$(call filename-to-dep, $$(fn)))
   -include $$($(1)_DEPS)