[CRIU] [PATCH 02/10] nmk: Drop rules.mk

Cyrill Gorcunov gorcunov at openvz.org
Tue Mar 22 12:09:31 PDT 2016


From: Cyrill Gorcunov <gorcunov at gmail.com>

No much point in carrying it in a separate file.

Signed-off-by: Cyrill Gorcunov <gorcunov at gmail.com>
Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
 scripts/nmk/scripts/build.mk | 58 ++++++++++++++++++++++++++++++++++++++
 scripts/nmk/scripts/main.mk  |  1 -
 scripts/nmk/scripts/rules.mk | 66 --------------------------------------------
 3 files changed, 58 insertions(+), 67 deletions(-)
 delete mode 100644 scripts/nmk/scripts/rules.mk

diff --git a/scripts/nmk/scripts/build.mk b/scripts/nmk/scripts/build.mk
index 4e69f657ce3a..8006e73ef23a 100644
--- a/scripts/nmk/scripts/build.mk
+++ b/scripts/nmk/scripts/build.mk
@@ -20,6 +20,64 @@ ifndef obj
         $(error obj is undefined)
 endif
 
+#
+# Accumulate common flags.
+define nmk-ccflags
+        $(CFLAGS) $(ccflags-y) $(CFLAGS_$(@F))
+endef
+
+define nmk-asflags
+        $(CFLAGS) $(AFLAGS) $(asflags-y) $(AFLAGS_$(@F))
+endef
+
+#
+# General rules.
+define gen-rule-o-from-c-by-name
+$(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).i: $(2).S $(3)
+	$$(call msg-cc, $$@)
+	$$(Q) $$(CC) -E $$(strip $$(nmk-asflags)) $(4) $$< -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,%,%))
+
 src-makefile	:= $(call objectify,$(makefile))
 include $(src-makefile)
 
diff --git a/scripts/nmk/scripts/main.mk b/scripts/nmk/scripts/main.mk
index 7c86f95e7e6d..c6a6758fc444 100644
--- a/scripts/nmk/scripts/main.mk
+++ b/scripts/nmk/scripts/main.mk
@@ -20,7 +20,6 @@ endif
 
 $(eval $(call include-once,tools.mk))
 $(eval $(call include-once,utils.mk))
-$(eval $(call include-once,rules.mk))
 $(eval $(call include-once,build.mk))
 
 #
diff --git a/scripts/nmk/scripts/rules.mk b/scripts/nmk/scripts/rules.mk
deleted file mode 100644
index a5aa2155aecb..000000000000
--- a/scripts/nmk/scripts/rules.mk
+++ /dev/null
@@ -1,66 +0,0 @@
-ifndef ____nmk_defined__rules
-
-#
-# Accumulate common flags.
-define nmk-ccflags
-        $(CFLAGS) $(ccflags-y) $(CFLAGS_$(@F))
-endef
-
-define nmk-asflags
-        $(CFLAGS) $(AFLAGS) $(asflags-y) $(AFLAGS_$(@F))
-endef
-
-#
-# General rules.
-define gen-rule-o-from-c-by-name
-$(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).i: $(2).S $(3)
-	$$(call msg-cc, $$@)
-	$$(Q) $$(CC) -E $$(strip $$(nmk-asflags)) $(4) $$< -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,%,%))
-
-#
-# Footer.
-$(__nmk_dir)scripts/rules.mk:
-	@true
-____nmk_defined__rules = y
-endif
-- 
2.5.0



More information about the CRIU mailing list