[CRIU] [PATCH 06/15] build/nmk: bring gen-rule-* back

Dmitry Safonov dsafonov at virtuozzo.com
Mon Apr 11 05:19:20 PDT 2016


Firstly, I think that way is more descriptive, but basically I used
them in my -obj-uniq, -lib-uniq rules (next patch) before they left.

Signed-off-by: Dmitry Safonov <dsafonov at virtuozzo.com>
---
 scripts/nmk/scripts/build.mk | 24 +++++++++++++++++++++++-
 1 file changed, 23 insertions(+), 1 deletion(-)

diff --git a/scripts/nmk/scripts/build.mk b/scripts/nmk/scripts/build.mk
index bd409441293e..cac72919a9df 100644
--- a/scripts/nmk/scripts/build.mk
+++ b/scripts/nmk/scripts/build.mk
@@ -40,30 +40,52 @@ endef
 
 #
 # General rules.
-define gen-cc-rules
+define gen-rule-o-from-c-by-name
 $(1).o: $(2).c $(src-makefile)
 	$$(call msg-cc, $$@)
 	$$(Q) $$(CC) -c $$(strip $$(nmk-ccflags)) $$< -o $$@
+endef
+define gen-rule-i-from-c-by-name
 $(1).i: $(2).c $(src-makefile)
 	$$(call msg-cc, $$@)
 	$$(Q) $$(CC) -E $$(strip $$(nmk-ccflags)) $$< -o $$@
+endef
+define gen-rule-s-from-c-by-name
 $(1).s: $(2).c $(src-makefile)
 	$$(call msg-cc, $$@)
 	$$(Q) $$(CC) -S -fverbose-asm $$(strip $$(nmk-ccflags)) $$< -o $$@
+endef
+define gen-rule-d-from-c-by-name
 $(1).d: $(2).c $(src-makefile)
 	$$(call msg-dep, $$@)
 	$$(Q) $$(CC) -M -MT $$@ -MT $$(patsubst %.d,%.o,$$@) $$(strip $$(nmk-ccflags)) $$< -o $$@
+endef
+define gen-rule-o-from-S-by-name
 $(1).o: $(2).S $(src-makefile)
 	$$(call msg-cc, $$@)
 	$$(Q) $$(CC) -c $$(strip $$(nmk-asflags)) $$< -o $$@
+endef
+define gen-rule-i-from-S-by-name
 $(1).i: $(2).S $(src-makefile)
 	$$(call msg-cc, $$@)
 	$$(Q) $$(CC) -E $$(strip $$(nmk-asflags)) $$< -o $$@
+endef
+define gen-rule-d-from-S-by-name
 $(1).d: $(2).S $(src-makefile)
 	$$(call msg-dep, $$@)
 	$$(Q) $$(CC) -M -MT $$@ -MT $$(patsubst %.d,%.o,$$@) $$(strip $$(nmk-asflags)) $$< -o $$@
 endef
 
+define gen-cc-rules
+        $(call gen-rule-o-from-c-by-name,$(1),$(2))
+        $(call gen-rule-i-from-c-by-name,$(1),$(2))
+        $(call gen-rule-s-from-c-by-name,$(1),$(2))
+        $(call gen-rule-d-from-c-by-name,$(1),$(2))
+        $(call gen-rule-o-from-S-by-name,$(1),$(2))
+        $(call gen-rule-i-from-S-by-name,$(1),$(2))
+        $(call gen-rule-d-from-S-by-name,$(1),$(2))
+endef
+
 include $(src-makefile)
 
 ifneq ($(strip $(target)),)
-- 
2.8.0



More information about the CRIU mailing list