[CRIU] [PATCH 2/2] makefile: drop DEBUG variable

Dmitry Safonov dsafonov at virtuozzo.com
Fri Feb 12 10:47:36 PST 2016


Seems like, it always worked not as expected: with the following diff
(made before my last commits HEAD~10 to be sure),
output of make GCOV=1 attached:

diff --git a/Makefile b/Makefile
index dcc9492..15b5dfa 100644
--- a/Makefile
+++ b/Makefile
@@ -77,6 +77,7 @@ ifeq ($(ARCH),ia32)
 	export PROTOUFIX ldflags-y
 endif

+$(warning GCOV is $(GCOV))
 ifeq ($(GCOV),1)
 	LDFLAGS += -lgcov
 	DEBUG = 1	# disable optimization if we want to measure code coverage
@@ -157,10 +158,13 @@ ifneq ($(WERROR),0)
 	WARNINGS += -Werror
 endif

+$(warning DEBUG is a$(DEBUG)a)
 ifeq ($(DEBUG),1)
+$(warning follow the white rabbit)
 	DEFINES += -DCR_DEBUG
 	CFLAGS	+= -O0 -ggdb3
 else
+$(warning somehow made my way here)
 	CFLAGS	+= -O2 -g
 endif

Output (warning to protobuf/Makefile omitted to reduce commit message):
[criu]$ make GCOV=1 1>/dev/null
Makefile:80: GCOV is 1
Makefile:161: DEBUG is a1	a
Makefile:167: somehow made my way here
protobuf/Makefile:92: my CFLAGS  -O2 -g -Wall -Werror -DCONFIG_X86_64 -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -DCONFIG_HAS_LIBBSD -Iprotobuf/

DEBUG variable contains trailing tab - we really should be
more careful with makefile variables.
I think, for this case the variable may be omitted.

Signed-off-by: Dmitry Safonov <dsafonov at virtuozzo.com>
---
 Makefile | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/Makefile b/Makefile
index d88c1d0..460804b 100644
--- a/Makefile
+++ b/Makefile
@@ -79,8 +79,12 @@ endif
 
 ifeq ($(GCOV),1)
 	LDFLAGS += -lgcov
-	DEBUG := 1	# disable optimization if we want to measure code coverage
+	# disable optimization if we want to measure code coverage
+	DEFINES += -DCR_DEBUG
+	CFLAGS	+= -O0 -ggdb3
 %.o $(PROGRAM): override CFLAGS += --coverage -fno-exceptions -fno-inline
+else
+	CFLAGS	+= -O2 -g
 endif
 
 ifeq ($(shell echo $(ARCH) | sed -e 's/arm.*/arm/'),arm)
@@ -156,13 +160,6 @@ ifneq ($(WERROR),0)
 	WARNINGS += -Werror
 endif
 
-ifeq ($(DEBUG),1)
-	DEFINES += -DCR_DEBUG
-	CFLAGS	+= -O0 -ggdb3
-else
-	CFLAGS	+= -O2 -g
-endif
-
 ifeq ($(GMON),1)
 	CFLAGS	+= -pg
 	GMONLDOPT := -pg
-- 
2.7.1



More information about the CRIU mailing list