[CRIU] [PATCH 2/2] makefile: drop DEBUG variable
Dmitry Safonov
dsafonov at virtuozzo.com
Mon Feb 15 03:32:10 PST 2016
On 02/12/2016 09:47 PM, Dmitry Safonov wrote:
> 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.
Scratch this, I think, we may try a better way:
add a new target, something like 'debug' which will build criu
without optimizations and with coverage support.
It shall look nice, like:
$ make debug
$ make test
$ make gcov
Instead of makefile variable GCOV=1.
Will send a new patch nearly soon instead of this.
> 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
--
Regards,
Dmitry Safonov
More information about the CRIU
mailing list