Skip to content

Commit

Permalink
tools/perf/build: Pass through DEBUG parameter
Browse files Browse the repository at this point in the history
Arnaldo reported that 'make DEBUG=1' does not work anymore.

The reason is that 'Makefile' only passes it through to
'Makefile.perf' via the environment, but 'Makefile.perf'
checks that it's a command line option:

    ifeq ("$(origin DEBUG)", "command line")
      PERF_DEBUG = $(DEBUG)
    endif

So pass it through properly, and also clean up DEBUG parameter
handling while at it and fix a couple of annoyances:

 - DEBUG=0 used to be interpreted as 'debugging on'. Turn it
   into 'debugging off' instead.

 - Same was the case for 'DEBUG=' - turn that into debug-off
   as well.

 - Pass in just a clean, sanitized 'DEBUG' value and get rid of
   the intermediate, unnecessary PERF_DEBUG variable.

Reported-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
  • Loading branch information
Ingo Molnar authored and Arnaldo Carvalho de Melo committed Oct 14, 2013
1 parent 3fb6633 commit fcf9258
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
15 changes: 14 additions & 1 deletion tools/perf/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,25 @@ ifneq ($(O),)
FULL_O := $(shell readlink -f $(O) || echo $(O))
endif

#
# Only accept the 'DEBUG' variable from the command line:
#
ifeq ("$(origin DEBUG)", "command line")
ifeq ($(DEBUG),)
override DEBUG = 0
else
SET_DEBUG = "DEBUG=$(DEBUG)"
endif
else
override DEBUG = 0
endif

define print_msg
@printf ' BUILD: Doing '\''make \033[33m-j'$(JOBS)'\033[m'\'' parallel build\n'
endef

define make
@$(MAKE) -f Makefile.perf --no-print-directory -j$(JOBS) O=$(FULL_O) $@
@$(MAKE) -f Makefile.perf --no-print-directory -j$(JOBS) O=$(FULL_O) $(SET_DEBUG) $@
endef

#
Expand Down
7 changes: 2 additions & 5 deletions tools/perf/config/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,7 @@ ifneq ($(WERROR),0)
CFLAGS += -Werror
endif

ifeq ("$(origin DEBUG)", "command line")
PERF_DEBUG = $(DEBUG)
endif
ifndef PERF_DEBUG
ifeq ($(DEBUG),0)
CFLAGS += -O6
endif

Expand Down Expand Up @@ -210,7 +207,7 @@ ifeq ($(feature-volatile-register-var), 1)
CFLAGS += -Wvolatile-register-var
endif

ifndef PERF_DEBUG
ifeq ($(DEBUG),0)
ifeq ($(feature-fortify-source), 1)
CFLAGS += -D_FORTIFY_SOURCE=2
endif
Expand Down

0 comments on commit fcf9258

Please sign in to comment.