[CRIU] [PATCH 05/10] nmk: build.mk -- Drop any-match rule
Cyrill Gorcunov
gorcunov at openvz.org
Tue Mar 22 12:09:34 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 | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/scripts/nmk/scripts/build.mk b/scripts/nmk/scripts/build.mk
index f2864babe9d9..150e7dc29cb4 100644
--- a/scripts/nmk/scripts/build.mk
+++ b/scripts/nmk/scripts/build.mk
@@ -13,6 +13,7 @@ builtin-name :=
lib-name :=
ld_flags :=
cleanup-y :=
+objdirs :=
MAKECMDGOALS := $(call uniq,$(MAKECMDGOALS))
@@ -56,10 +57,6 @@ $(1).d: $(2).S $(3)
$$(Q) $$(CC) -M -MT $$@ -MT $$(patsubst %.d,%.o,$$@) $$(strip $$(nmk-asflags)) $(5) $$< -o $$@
endef
-#
-# Expand early which matched all implicits.
-$(eval $(call gen-cc-rules,%,%))
-
src-makefile := $(call objectify,$(makefile))
include $(src-makefile)
@@ -102,6 +99,7 @@ ifneq ($(lib-y),)
cleanup-y += $(call cleanify,$(lib-y))
cleanup-y += $(lib-target)
all-y += $(lib-target)
+ objdirs += $(dir $(lib-y))
endif
ifneq ($(obj-y),)
@@ -114,6 +112,7 @@ ifneq ($(obj-y),)
cleanup-y += $(call cleanify,$(obj-y))
cleanup-y += $(builtin-target)
all-y += $(builtin-target)
+ objdirs += $(dir $(obj-y))
endif
#
@@ -162,6 +161,7 @@ define gen-custom-target-rule
all-y += $(obj)/$(1).built-in.o
cleanup-y += $(call cleanify,$(call objectify,$($(1)-obj-y)))
cleanup-y += $(obj)/$(1).built-in.o
+ objdirs += $(dir $(call objectify,$($(1)-obj-y)))
endif
ifneq ($($(1)-lib-y),)
$(eval $(call gen-ar-target-rule, \
@@ -174,12 +174,18 @@ define gen-custom-target-rule
all-y += $(obj)/$(1).lib.a
cleanup-y += $(call cleanify,$(call objectify,$($(1)-lib-y)))
cleanup-y += $(obj)/$(1).lib.a
+ objdirs += $(dir $(call objectify,$($(1)-lib-y)))
endif
endef
$(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))))
+
+#
# Figure out if the target we're building needs deps to include.
define collect-deps
ifneq ($(filter-out %.d,$(1)),)
--
2.5.0
More information about the CRIU
mailing list