[CRIU] [PATCH] nmk/build: separate msg-* printing from .mk files

Dmitry Safonov dsafonov at virtuozzo.com
Wed Feb 17 07:37:25 PST 2016


This patch fixes accidental dropping of msg-gen, msg-link messages.
Just run make with another warn enabled:
[criu]$ make --warn-undefined-variable 2>&1 | grep msg
  PBCC     images/ipc-msg.pb-c.c
  DEP      images/ipc-msg.pb-c.d
  CC       images/ipc-msg.o
Makefile.config:17: warning: undefined variable 'msg-gen'
Makefile.version:20: warning: undefined variable 'msg-gen'
Makefile:120: warning: undefined variable 'msg-link'
Makefile:149: warning: undefined variable 'msg-link'
Makefile:15: warning: undefined variable 'msg-gen'

All these messages seems to be missed.
I think, for these places it's not needed to include full include.mk:
it will compute SUBARCH and other not needed variables, wasting time.

Cc: Cyrill Gorcunov <gorcunov at openvz.org>
Signed-off-by: Dmitry Safonov <dsafonov at virtuozzo.com>
---
 criu/Makefile                   |  4 ++++
 criu/Makefile.config            |  1 +
 criu/Makefile.version           |  2 ++
 lib/pycriu/images/Makefile      |  1 +
 scripts/nmk/scripts/include.mk  | 42 ++------------------------------------
 scripts/nmk/scripts/printmsg.mk | 45 +++++++++++++++++++++++++++++++++++++++++
 6 files changed, 55 insertions(+), 40 deletions(-)
 create mode 100644 scripts/nmk/scripts/printmsg.mk

diff --git a/criu/Makefile b/criu/Makefile
index b009c7b..2cfd810 100644
--- a/criu/Makefile
+++ b/criu/Makefile
@@ -85,6 +85,10 @@ ifneq ($(filter ia32 x86 ppc64,$(ARCH)),)
 endif
 
 #
+# msg-* nice printing
+include $(__nmk_dir)/printmsg.mk
+
+#
 # Version header file.
 include Makefile.version
 
diff --git a/criu/Makefile.config b/criu/Makefile.config
index a39f4cd..73b5ade 100644
--- a/criu/Makefile.config
+++ b/criu/Makefile.config
@@ -1,4 +1,5 @@
 include $(__nmk_dir)/utils.mk
+include $(__nmk_dir)/printmsg.mk
 include ../scripts/feature-tests.mak
 
 CONFIG_HEADER := include/config.h
diff --git a/criu/Makefile.version b/criu/Makefile.version
index 44dad6c..54f15fc 100644
--- a/criu/Makefile.version
+++ b/criu/Makefile.version
@@ -1,3 +1,5 @@
+include $(__nmk_dir)/printmsg.mk
+
 CRTOOLSVERSION		:= $(VERSION_MAJOR)$(if $(VERSION_MINOR),.$(VERSION_MINOR))$(if $(VERSION_SUBLEVEL),.$(VERSION_SUBLEVEL))
 VERSION_HEADER		:= include/version.h
 GITID_FILE		:= ../.gitid
diff --git a/lib/pycriu/images/Makefile b/lib/pycriu/images/Makefile
index c8a748e..a9526f7 100644
--- a/lib/pycriu/images/Makefile
+++ b/lib/pycriu/images/Makefile
@@ -1,3 +1,4 @@
+include $(__nmk_dir)/printmsg.mk
 all: pb.py images magic.py
 
 .PHONY: all images clean pb.py
diff --git a/scripts/nmk/scripts/include.mk b/scripts/nmk/scripts/include.mk
index 6216fea..2012e81 100644
--- a/scripts/nmk/scripts/include.mk
+++ b/scripts/nmk/scripts/include.mk
@@ -1,47 +1,9 @@
 ifndef ____nmk_defined__include
 
-#
-# Silent make rules.
-ifeq ($(strip $(V)),)
-        E := @echo
-        Q := @
-else
-        E := @\#
-        Q :=
+ifndef ____nmk_defined__printmsg
+        include $(__nmk_dir)printmsg.mk
 endif
 
-export E Q
-
-#
-# Message helpers.
-define msg-gen
-        $(E) "  GEN     " $(1)
-endef
-
-define msg-clean
-        $(E) "  CLEAN   " $(1)
-endef
-
-define msg-cc
-        $(E) "  CC      " $(1)
-endef
-
-define msg-dep
-        $(E) "  DEP     " $(1)
-endef
-
-define msg-link
-        $(E) "  LINK    " $(1)
-endef
-
-define msg-ar
-        $(E) "  AR      " $(1)
-endef
-
-define msg-build
-        $(E) "  BUILD   " $(1)
-endef
-
 #
 # Common vars.
 SUBARCH := $(shell uname -m | sed       \
diff --git a/scripts/nmk/scripts/printmsg.mk b/scripts/nmk/scripts/printmsg.mk
new file mode 100644
index 0000000..90787ab
--- /dev/null
+++ b/scripts/nmk/scripts/printmsg.mk
@@ -0,0 +1,45 @@
+ifndef ____nmk_defined__printmsg
+
+#
+# Silent make rules.
+ifeq ($(strip $(V)),)
+        E := @echo
+        Q := @
+else
+        E := @\#
+        Q :=
+endif
+
+export E Q
+
+#
+# Message helpers.
+define msg-gen
+        $(E) "  GEN     " $(1)
+endef
+
+define msg-clean
+        $(E) "  CLEAN   " $(1)
+endef
+
+define msg-cc
+        $(E) "  CC      " $(1)
+endef
+
+define msg-dep
+        $(E) "  DEP     " $(1)
+endef
+
+define msg-link
+        $(E) "  LINK    " $(1)
+endef
+
+define msg-ar
+        $(E) "  AR      " $(1)
+endef
+
+define msg-build
+        $(E) "  BUILD   " $(1)
+endef
+
+endif #____nmk_defined__printmsg
-- 
2.7.1



More information about the CRIU mailing list