[CRIU] [PATCH 1/2] nmk: scritps/macro.mk -- Enhance gen-built-in

Cyrill Gorcunov gorcunov at openvz.org
Thu Mar 17 15:58:02 PDT 2016


Add ability to specify prerequsites and phony targets.

Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
 scripts/nmk/scripts/macro.mk | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/scripts/nmk/scripts/macro.mk b/scripts/nmk/scripts/macro.mk
index be6bf0a5e03a..7471ce080efc 100644
--- a/scripts/nmk/scripts/macro.mk
+++ b/scripts/nmk/scripts/macro.mk
@@ -10,13 +10,21 @@ define include-once
 endef
 
 # Helper to build built-in target in directory.
-# $(eval $(call gen-built-in,<dir>))
+# $(eval $(call gen-built-in,<dir>,<prerequsite>,<phony>))
 define gen-built-in
-$(1)/%:
+$(1)/%: $(2)
 	$$(Q) $$(MAKE) $$(build)=$(1) $$@
-$(1):
+ifneq ($(3),)
+$(3): $(2)
 	$$(Q) $$(MAKE) $$(build)=$(1) all
+.PHONY: $(3)
+$(1)/built-in.o: $(3)
+else
+$(1): $(2)
+	$$(Q) $$(MAKE) $$(build)=$(1) all
+.PHONY: $(1)
 $(1)/built-in.o: $(1)
+endif
 endef
 
 #
-- 
2.5.0



More information about the CRIU mailing list