[CRIU] [PATCH 06/10] nmk: build.mk -- Shrink gen-cc-rules

Cyrill Gorcunov gorcunov at openvz.org
Tue Mar 22 12:15:32 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 | 35 ++++++++++++++++++-----------------
 1 file changed, 18 insertions(+), 17 deletions(-)

diff --git a/scripts/nmk/scripts/build.mk b/scripts/nmk/scripts/build.mk
index 150e7dc29cb4..3c35f9daafc3 100644
--- a/scripts/nmk/scripts/build.mk
+++ b/scripts/nmk/scripts/build.mk
@@ -4,6 +4,7 @@ ifndef ____nmk_defined__build
 # General helpers for simplified Makefiles.
 #
 src		:= $(obj)
+src-makefile	:= $(call objectify,$(makefile))
 obj-y		:=
 lib-y		:=
 target          :=
@@ -31,33 +32,33 @@ define nmk-asflags
         $(CFLAGS) $(AFLAGS) $(asflags-y) $(AFLAGS_$(@F))
 endef
 
+
 #
 # General rules.
 define gen-cc-rules
-$(1).o: $(2).c $(3)
+$(1).o: $(2).c $(src-makefile)
 	$$(call msg-cc, $$@)
-	$$(Q) $$(CC) -c $$(strip $$(nmk-ccflags)) $(4) $$< -o $$@
-$(1).i: $(2).c $(3)
+	$$(Q) $$(CC) -c $$(strip $$(nmk-ccflags)) $$< -o $$@
+$(1).i: $(2).c $(src-makefile)
 	$$(call msg-cc, $$@)
-	$$(Q) $$(CC) -E $$(strip $$(nmk-ccflags)) $(4) $$< -o $$@
-$(1).s: $(2).c $(3)
+	$$(Q) $$(CC) -E $$(strip $$(nmk-ccflags)) $$< -o $$@
+$(1).s: $(2).c $(src-makefile)
 	$$(call msg-cc, $$@)
-	$$(Q) $$(CC) -S -fverbose-asm $$(strip $$(nmk-ccflags)) $(4) $$< -o $$@
-$(1).d: $(2).c $(3)
+	$$(Q) $$(CC) -S -fverbose-asm $$(strip $$(nmk-ccflags)) $$< -o $$@
+$(1).d: $(2).c $(src-makefile)
 	$$(call msg-dep, $$@)
-	$$(Q) $$(CC) -M -MT $$@ -MT $$(patsubst %.d,%.o,$$@) $$(strip $$(nmk-ccflags)) $(4) $$< -o $$@
-$(1).o: $(2).S $(3)
+	$$(Q) $$(CC) -M -MT $$@ -MT $$(patsubst %.d,%.o,$$@) $$(strip $$(nmk-ccflags)) $$< -o $$@
+$(1).o: $(2).S $(src-makefile)
 	$$(call msg-cc, $$@)
-	$$(Q) $$(CC) -c $$(strip $$(nmk-asflags)) $(5) $$< -o $$@
-$(1).i: $(2).S $(3)
+	$$(Q) $$(CC) -c $$(strip $$(nmk-asflags)) $$< -o $$@
+$(1).i: $(2).S $(src-makefile)
 	$$(call msg-cc, $$@)
-	$$(Q) $$(CC) -E $$(strip $$(nmk-asflags)) $(5) $$< -o $$@
-$(1).d: $(2).S $(3)
+	$$(Q) $$(CC) -E $$(strip $$(nmk-asflags)) $$< -o $$@
+$(1).d: $(2).S $(src-makefile)
 	$$(call msg-dep, $$@)
-	$$(Q) $$(CC) -M -MT $$@ -MT $$(patsubst %.d,%.o,$$@) $$(strip $$(nmk-asflags)) $(5) $$< -o $$@
+	$$(Q) $$(CC) -M -MT $$@ -MT $$(patsubst %.d,%.o,$$@) $$(strip $$(nmk-asflags)) $$< -o $$@
 endef
 
-src-makefile	:= $(call objectify,$(makefile))
 include $(src-makefile)
 
 ifneq ($(strip $(target)),)
@@ -85,7 +86,7 @@ ld_flags	:= $(strip $(LDFLAGS) $(ldflags-y))
 
 #
 # $(obj) related rules.
-$(eval $(call gen-cc-rules,$(obj)/%,$(obj)/%,$(src-makefile)))
+$(eval $(call gen-cc-rules,$(obj)/%,$(obj)/%))
 
 #
 # Prepare targets.
@@ -183,7 +184,7 @@ $(foreach t,$(target),$(eval $(call gen-custom-target-rule,$(t))))
 #
 # Prepare rules for dirs other than (obj)/.
 objdirs := $(patsubst %/,%,$(filter-out $(obj)/,$(call uniq,$(objdirs))))
-$(foreach t,$(objdirs),$(eval $(call gen-cc-rules,$(t)/%,$(t)/%,$(src-makefile))))
+$(foreach t,$(objdirs),$(eval $(call gen-cc-rules,$(t)/%,$(t)/%)))
 
 #
 # Figure out if the target we're building needs deps to include.
-- 
2.5.0



More information about the CRIU mailing list