[CRIU] [PATCH 2/2] nmk/script: rm bad code

Kir Kolyshkin kir at openvz.org
Mon Sep 19 13:58:02 PDT 2016


I discovered that the scripts/ suffix is added to __nmk_dir despite
the fact it already contains it, ending in obviously wrong filenames
like scripts/nmk/scripts/scripts/msg.mk. As those files are non-existent,
make tried to recreate every .mk file, spawninga child to execute 'true'
command, like this (part of "make -dr" output):

> Considering target file '../scripts/nmk/scripts/scripts/include.mk'.
>  File '../scripts/nmk/scripts/scripts/include.mk' does not exist.
>  Finished prerequisites of target file
> '../scripts/nmk/scripts/scripts/include.mk'.
> Must remake target '../scripts/nmk/scripts/scripts/include.mk'.
> Putting child 0x564ec1768740 (../scripts/nmk/scripts/scripts/include.mk)
> PID 21633 on the chain.
> Live child 0x564ec1768740 (../scripts/nmk/scripts/scripts/include.mk)
> PID 21633
> Reaping winning child 0x564ec1768740 PID 21633
> Removing child 0x564ec1768740 PID 21633 from chain.

The fix was to remove the extra scripts/, but once I did it, I found
out problem #2: these targets, being defined in contents that is often
included in the beginning of Makefiles, hijacks the default make
target (the first one in the Makefile), breaking the usual and
expected make behavior, and forcing to use .DEFAULT_GOAL.

Finally, I don't know why these targets are there, i.e. what purpose
do they serve. Maybe it was done to exclude any implicit rules to
re-make those files, but there are no such rules as far as I can see.

So, in order to address problem #2, I have removed these targets.
I don't see any harm in doing that; let me know if it breaks anything.

Cc: Cyrill Gorcunov <gorcunov at openvz.org>
Signed-off-by: Kir Kolyshkin <kir at openvz.org>
---
 scripts/nmk/scripts/build.mk   | 2 --
 scripts/nmk/scripts/include.mk | 2 --
 scripts/nmk/scripts/macro.mk   | 2 --
 scripts/nmk/scripts/main.mk    | 2 --
 scripts/nmk/scripts/msg.mk     | 2 --
 scripts/nmk/scripts/tools.mk   | 2 --
 scripts/nmk/scripts/utils.mk   | 2 --
 7 files changed, 14 deletions(-)

diff --git a/scripts/nmk/scripts/build.mk b/scripts/nmk/scripts/build.mk
index 87da2d9..f83b31d 100644
--- a/scripts/nmk/scripts/build.mk
+++ b/scripts/nmk/scripts/build.mk
@@ -293,7 +293,5 @@ mrproper: clean
 
 #
 # Footer.
-$(__nmk_dir)scripts/build.mk:
-	@true
 ____nmk_defined__build = y
 endif
diff --git a/scripts/nmk/scripts/include.mk b/scripts/nmk/scripts/include.mk
index 4c496f7..2d04d88 100644
--- a/scripts/nmk/scripts/include.mk
+++ b/scripts/nmk/scripts/include.mk
@@ -52,7 +52,5 @@ export build-as
 
 #
 # Footer.
-$(__nmk_dir)scripts/include.mk:
-	@true
 ____nmk_defined__include = y
 endif
diff --git a/scripts/nmk/scripts/macro.mk b/scripts/nmk/scripts/macro.mk
index 7471ce0..b36d5b2 100644
--- a/scripts/nmk/scripts/macro.mk
+++ b/scripts/nmk/scripts/macro.mk
@@ -29,7 +29,5 @@ endef
 
 #
 # Footer.
-$(__nmk_dir)scripts/macro.mk:
-	@true
 ____nmk_defined__macro = y
 endif
diff --git a/scripts/nmk/scripts/main.mk b/scripts/nmk/scripts/main.mk
index c6a6758..493a164 100644
--- a/scripts/nmk/scripts/main.mk
+++ b/scripts/nmk/scripts/main.mk
@@ -24,7 +24,5 @@ $(eval $(call include-once,build.mk))
 
 #
 # Footer
-$(__nmk_dir)scripts/main.mk:
-	@true
 ____nmk_defined__main = y
 endif
diff --git a/scripts/nmk/scripts/msg.mk b/scripts/nmk/scripts/msg.mk
index 543511a..d07f216 100644
--- a/scripts/nmk/scripts/msg.mk
+++ b/scripts/nmk/scripts/msg.mk
@@ -67,7 +67,5 @@ map = $(foreach x,$2,$(call $1,$x)$(newline))
 
 #
 # Footer.
-$(__nmk_dir)scripts/msg.mk:
-	@true
 ____nmk_defined__msg = y
 endif #____nmk_defined__msg
diff --git a/scripts/nmk/scripts/tools.mk b/scripts/nmk/scripts/tools.mk
index 0538dde..199a4ba 100644
--- a/scripts/nmk/scripts/tools.mk
+++ b/scripts/nmk/scripts/tools.mk
@@ -30,7 +30,5 @@ export NM SH MAKE MKDIR AWK PERL PYTHON SH CSCOPE
 
 #
 # Footer.
-$(__nmk_dir)scripts/tools.mk:
-	@true
 ____nmk_defined__tools = y
 endif
diff --git a/scripts/nmk/scripts/utils.mk b/scripts/nmk/scripts/utils.mk
index ec72a1c..3a8ad62 100644
--- a/scripts/nmk/scripts/utils.mk
+++ b/scripts/nmk/scripts/utils.mk
@@ -23,7 +23,5 @@ cleanify = $(foreach o,$(sort $(call uniq,$(1))),$(o) $(o:.o=.d) $(o:.o=.i) $(o:
 
 #
 # Footer.
-$(__nmk_dir)scripts/utils.mk:
-	@true
 ____nmk_defined__utils = y
 endif
-- 
2.7.4



More information about the CRIU mailing list