aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/config
diff options
context:
space:
mode:
authorJiri Olsa <jolsa@redhat.com>2013-03-24 19:40:48 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2013-05-28 09:24:06 -0400
commit362493f0d63e25698018f6f36b2e02201342dbee (patch)
tree1aeb6f9c1580d480cf81ccae9052bc9715708f64 /tools/perf/config
parenta32f4936bc022fd82b08a350a5587bd5a7e500d1 (diff)
perf tools: Move compiler and linker flags check into config/Makefile
Moving compiler and linker flags check into config/Makefile. Signed-off-by: Jiri Olsa <jolsa@redhat.com> Cc: Borislav Petkov <bp@alien8.de> Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Sam Ravnborg <sam@ravnborg.org> Cc: Stephane Eranian <eranian@google.com> Link: http://lkml.kernel.org/r/1369398928-9809-5-git-send-email-jolsa@redhat.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/config')
-rw-r--r--tools/perf/config/Makefile66
1 files changed, 66 insertions, 0 deletions
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index 04bf8aceea5a..8acbcfec93f1 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -42,3 +42,69 @@ endif
42ifeq ($(call get-executable,$(BISON)),) 42ifeq ($(call get-executable,$(BISON)),)
43 dummy := $(error Error: $(BISON) is missing on this system, please install it) 43 dummy := $(error Error: $(BISON) is missing on this system, please install it)
44endif 44endif
45
46# Treat warnings as errors unless directed not to
47ifneq ($(WERROR),0)
48 CFLAGS_WERROR := -Werror
49endif
50
51ifeq ("$(origin DEBUG)", "command line")
52 PERF_DEBUG = $(DEBUG)
53endif
54ifndef PERF_DEBUG
55 CFLAGS_OPTIMIZE = -O6
56endif
57
58ifdef PARSER_DEBUG
59 PARSER_DEBUG_BISON := -t
60 PARSER_DEBUG_FLEX := -d
61 PARSER_DEBUG_CFLAGS := -DPARSER_DEBUG
62endif
63
64CFLAGS = -fno-omit-frame-pointer -ggdb3 -funwind-tables -Wall -Wextra -std=gnu99 $(CFLAGS_WERROR) $(CFLAGS_OPTIMIZE) $(EXTRA_WARNINGS) $(EXTRA_CFLAGS) $(PARSER_DEBUG_CFLAGS)
65EXTLIBS = -lpthread -lrt -lelf -lm
66ALL_CFLAGS = $(CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE
67ALL_LDFLAGS = $(LDFLAGS)
68
69ifeq ($(call try-cc,$(SOURCE_HELLO),$(CFLAGS) -Werror -fstack-protector-all,-fstack-protector-all),y)
70 CFLAGS := $(CFLAGS) -fstack-protector-all
71endif
72
73ifeq ($(call try-cc,$(SOURCE_HELLO),$(CFLAGS) -Werror -Wstack-protector,-Wstack-protector),y)
74 CFLAGS := $(CFLAGS) -Wstack-protector
75endif
76
77ifeq ($(call try-cc,$(SOURCE_HELLO),$(CFLAGS) -Werror -Wvolatile-register-var,-Wvolatile-register-var),y)
78 CFLAGS := $(CFLAGS) -Wvolatile-register-var
79endif
80
81ifndef PERF_DEBUG
82 ifeq ($(call try-cc,$(SOURCE_HELLO),$(CFLAGS) -D_FORTIFY_SOURCE=2,-D_FORTIFY_SOURCE=2),y)
83 CFLAGS := $(CFLAGS) -D_FORTIFY_SOURCE=2
84 endif
85endif
86
87BASIC_CFLAGS += \
88 -Iutil/include \
89 -Iarch/$(ARCH)/include \
90 $(if $(objtree),-I$(objtree)/arch/$(ARCH)/include/generated/uapi) \
91 -I$(srctree)/arch/$(ARCH)/include/uapi \
92 -I$(srctree)/arch/$(ARCH)/include \
93 $(if $(objtree),-I$(objtree)/include/generated/uapi) \
94 -I$(srctree)/include/uapi \
95 -I$(srctree)/include \
96 -I$(OUTPUT)util \
97 -Iutil \
98 -I. \
99 -I$(TRACE_EVENT_DIR) \
100 -I../lib/ \
101 -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE
102
103BASIC_LDFLAGS =
104
105ifeq ($(call try-cc,$(SOURCE_BIONIC),$(CFLAGS),bionic),y)
106 BIONIC := 1
107 EXTLIBS := $(filter-out -lrt,$(EXTLIBS))
108 EXTLIBS := $(filter-out -lpthread,$(EXTLIBS))
109 BASIC_CFLAGS += -I.
110endif