[CRIU] [PATCH 03/10] nmk: build.mk -- Squash gen-rule-x into gen-cc-rules

Cyrill Gorcunov gorcunov at openvz.org
Thu Mar 24 11:25:35 PDT 2016


From: Cyrill Gorcunov <gorcunov at gmail.com>

Signed-off-by: Cyrill Gorcunov <gorcunov at gmail.com>
Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
 scripts/nmk/scripts/build.mk | 44 ++++++++++----------------------------------
 1 file changed, 10 insertions(+), 34 deletions(-)

diff --git a/scripts/nmk/scripts/build.mk b/scripts/nmk/scripts/build.mk
index de47ff567da1..481ca4dbb5fb 100644
--- a/scripts/nmk/scripts/build.mk
+++ b/scripts/nmk/scripts/build.mk
@@ -33,51 +33,33 @@ endef
 
 #
 # General rules.
-define gen-rule-o-from-c-by-name
+define gen-cc-rules
 $(1).o: $(2).c $(3)
 	$$(call msg-cc, $$@)
 	$$(Q) $$(CC) -c $$(strip $$(nmk-ccflags)) $(4) $$< -o $$@
-endef
-define gen-rule-i-from-c-by-name
 $(1).i: $(2).c $(3)
 	$$(call msg-cc, $$@)
 	$$(Q) $$(CC) -E $$(strip $$(nmk-ccflags)) $(4) $$< -o $$@
-endef
-define gen-rule-s-from-c-by-name
 $(1).s: $(2).c $(3)
 	$$(call msg-cc, $$@)
 	$$(Q) $$(CC) -S -fverbose-asm $$(strip $$(nmk-ccflags)) $(4) $$< -o $$@
-endef
-define gen-rule-o-from-S-by-name
-$(1).o: $(2).S $(3)
-	$$(call msg-cc, $$@)
-	$$(Q) $$(CC) -c $$(strip $$(nmk-asflags)) $(4) $$< -o $$@
-endef
-define gen-rule-d-from-c-by-name
 $(1).d: $(2).c $(3)
 	$$(call msg-dep, $$@)
 	$$(Q) $$(CC) -M -MT $$@ -MT $$(patsubst %.d,%.o,$$@) $$(strip $$(nmk-ccflags)) $(4) $$< -o $$@
-endef
-define gen-rule-d-from-S-by-name
-$(1).d: $(2).S $(3)
-	$$(call msg-dep, $$@)
-	$$(Q) $$(CC) -M -MT $$@ -MT $$(patsubst %.d,%.o,$$@) $$(strip $$(nmk-asflags)) $(4) $$< -o $$@
-endef
-define gen-rule-i-from-S-by-name
+$(1).o: $(2).S $(3)
+	$$(call msg-cc, $$@)
+	$$(Q) $$(CC) -c $$(strip $$(nmk-asflags)) $(5) $$< -o $$@
 $(1).i: $(2).S $(3)
 	$$(call msg-cc, $$@)
-	$$(Q) $$(CC) -E $$(strip $$(nmk-asflags)) $(4) $$< -o $$@
+	$$(Q) $$(CC) -E $$(strip $$(nmk-asflags)) $(5) $$< -o $$@
+$(1).d: $(2).S $(3)
+	$$(call msg-dep, $$@)
+	$$(Q) $$(CC) -M -MT $$@ -MT $$(patsubst %.d,%.o,$$@) $$(strip $$(nmk-asflags)) $(5) $$< -o $$@
 endef
 
 #
 # Expand early which matched all implicits.
-$(eval $(call gen-rule-o-from-c-by-name,%,%))
-$(eval $(call gen-rule-i-from-c-by-name,%,%))
-$(eval $(call gen-rule-s-from-c-by-name,%,%))
-$(eval $(call gen-rule-o-from-S-by-name,%,%))
-$(eval $(call gen-rule-d-from-c-by-name,%,%))
-$(eval $(call gen-rule-d-from-S-by-name,%,%))
-$(eval $(call gen-rule-i-from-S-by-name,%,%))
+$(eval $(call gen-cc-rules,%,%))
 
 src-makefile	:= $(call objectify,$(makefile))
 include $(src-makefile)
@@ -107,13 +89,7 @@ ld_flags	:= $(strip $(LDFLAGS) $(ldflags-y))
 
 #
 # $(obj) related rules.
-$(eval $(call gen-rule-o-from-c-by-name,$(obj)/%,$(obj)/%,$(src-makefile)))
-$(eval $(call gen-rule-i-from-c-by-name,$(obj)/%,$(obj)/%,$(src-makefile)))
-$(eval $(call gen-rule-s-from-c-by-name,$(obj)/%,$(obj)/%,$(src-makefile)))
-$(eval $(call gen-rule-o-from-S-by-name,$(obj)/%,$(obj)/%,$(src-makefile)))
-$(eval $(call gen-rule-d-from-c-by-name,$(obj)/%,$(obj)/%,$(src-makefile)))
-$(eval $(call gen-rule-d-from-S-by-name,$(obj)/%,$(obj)/%,$(src-makefile)))
-$(eval $(call gen-rule-i-from-S-by-name,$(obj)/%,$(obj)/%,$(src-makefile)))
+$(eval $(call gen-cc-rules,$(obj)/%,$(obj)/%,$(src-makefile)))
 
 #
 # Prepare targets.
-- 
2.5.5



More information about the CRIU mailing list