summaryrefslogtreecommitdiffstats
path: root/tools/perf/config/utilities.mak
diff options
context:
space:
mode:
authorMartin Liska <mliska@suse.cz>2015-05-26 12:23:24 -0300
committerArnaldo Carvalho de Melo <acme@redhat.com>2015-05-27 12:21:45 -0300
commite8b7ea4356fdd3c4de5478f3418eb84f8dce2b61 (patch)
treed2bf5a7559f566ed71f93ae81671360eac42cd3d /tools/perf/config/utilities.mak
parent5bcaaca3e4d15ce39008a0b9c431c0ac4be784bd (diff)
downloadop-kernel-dev-e8b7ea4356fdd3c4de5478f3418eb84f8dce2b61.zip
op-kernel-dev-e8b7ea4356fdd3c4de5478f3418eb84f8dce2b61.tar.gz
perf tools: Improve setting of gcc debug option
Correct debugging experience is given by passing -Og to compiler. Do it in a way that supports older compilers Signed-off-by: Martin Liska <mliska@suse.cz> Acked-by: Ingo Molnar <mingo@kernel.org> Link: http://lkml.kernel.org/r/5564393C.1090104@suse.cz Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/config/utilities.mak')
-rw-r--r--tools/perf/config/utilities.mak19
1 files changed, 19 insertions, 0 deletions
diff --git a/tools/perf/config/utilities.mak b/tools/perf/config/utilities.mak
index c16ce83..0ebef09 100644
--- a/tools/perf/config/utilities.mak
+++ b/tools/perf/config/utilities.mak
@@ -177,3 +177,22 @@ $(if $($(1)),$(call _ge_attempt,$($(1)),$(1)),$(call _ge_attempt,$(2)))
endef
_ge_attempt = $(if $(get-executable),$(get-executable),$(call _gea_err,$(2)))
_gea_err = $(if $(1),$(error Please set '$(1)' appropriately))
+
+# try-run
+# Usage: option = $(call try-run, $(CC)...-o "$$TMP",option-ok,otherwise)
+# Exit code chooses option. "$$TMP" is can be used as temporary file and
+# is automatically cleaned up.
+try-run = $(shell set -e; \
+ TMP="$(TMPOUT).$$$$.tmp"; \
+ TMPO="$(TMPOUT).$$$$.o"; \
+ if ($(1)) >/dev/null 2>&1; \
+ then echo "$(2)"; \
+ else echo "$(3)"; \
+ fi; \
+ rm -f "$$TMP" "$$TMPO")
+
+# cc-option
+# Usage: cflags-y += $(call cc-option,-march=winchip-c6,-march=i586)
+
+cc-option = $(call try-run,\
+ $(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) $(1) -c -x c /dev/null -o "$$TMP",$(1),$(2))
OpenPOWER on IntegriCloud