aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIrina Tirdea <irina.tirdea@intel.com>2012-10-08 02:43:27 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2012-10-08 16:42:16 -0400
commitd816ec2d1bea55cfeac373f0ab0ab8a3105e49b4 (patch)
tree5b4ea9fab5c4b0b1364ce1f5dcf722d04b134b43
parent78da39faf7c903bb6e3c20a726fde1bf98d10af8 (diff)
perf tools: Update Makefile for Android
For cross-compiling on Android, some specific changes are needed in the Makefile. Update the Makefile to support cross-compiling for Android. The original ideea for this was send by Bernhard Rosenkraenzer in https://lkml.org/lkml/2012/8/23/316, but this is a rewrite. Changes: () support bionic in addition to glibc () remove rt and pthread libraries that do not exist in Android () use $(CFLAGS) when detecting initial compiler flags. This is needed when setting CFLAGS as an argument of make (e.g. for setting --sysroot). () include perf's local directory when building for Android to be able to find relative paths if using --sysroot (e.g.: ../../include/linux/perf_event.h) Signed-off-by: Irina Tirdea <irina.tirdea@intel.com> Cc: Bernhard Rosenkraenzer <Bernhard.Rosenkranzer@linaro.org> Cc: David Ahern <dsahern@gmail.com> Cc: Ingo Molnar <mingo@kernel.org> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Paul Mackerras <paulus@samba.org> Cc: Pekka Enberg <penberg@kernel.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Steven Rostedt <rostedt@goodmis.org> Link: http://lkml.kernel.org/r/1349678613-7045-3-git-send-email-irina.tirdea@gmail.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rw-r--r--tools/perf/Makefile25
-rw-r--r--tools/perf/config/feature-tests.mak9
2 files changed, 28 insertions, 6 deletions
diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index a7d8745e0ab2..318bec8e14e4 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -155,15 +155,15 @@ SPARSE_FLAGS = -D__BIG_ENDIAN__ -D__powerpc__
155 155
156-include config/feature-tests.mak 156-include config/feature-tests.mak
157 157
158ifeq ($(call try-cc,$(SOURCE_HELLO),-Werror -fstack-protector-all),y) 158ifeq ($(call try-cc,$(SOURCE_HELLO),$(CFLAGS) -Werror -fstack-protector-all),y)
159 CFLAGS := $(CFLAGS) -fstack-protector-all 159 CFLAGS := $(CFLAGS) -fstack-protector-all
160endif 160endif
161 161
162ifeq ($(call try-cc,$(SOURCE_HELLO),-Werror -Wstack-protector),y) 162ifeq ($(call try-cc,$(SOURCE_HELLO),$(CFLAGS) -Werror -Wstack-protector),y)
163 CFLAGS := $(CFLAGS) -Wstack-protector 163 CFLAGS := $(CFLAGS) -Wstack-protector
164endif 164endif
165 165
166ifeq ($(call try-cc,$(SOURCE_HELLO),-Werror -Wvolatile-register-var),y) 166ifeq ($(call try-cc,$(SOURCE_HELLO),$(CFLAGS) -Werror -Wvolatile-register-var),y)
167 CFLAGS := $(CFLAGS) -Wvolatile-register-var 167 CFLAGS := $(CFLAGS) -Wvolatile-register-var
168endif 168endif
169 169
@@ -172,6 +172,13 @@ endif
172BASIC_CFLAGS = -Iutil/include -Iarch/$(ARCH)/include -I$(OUTPUT)util -I$(TRACE_EVENT_DIR) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE 172BASIC_CFLAGS = -Iutil/include -Iarch/$(ARCH)/include -I$(OUTPUT)util -I$(TRACE_EVENT_DIR) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE
173BASIC_LDFLAGS = 173BASIC_LDFLAGS =
174 174
175ifeq ($(call try-cc,$(SOURCE_BIONIC),$(CFLAGS)),y)
176 BIONIC := 1
177 EXTLIBS := $(filter-out -lrt,$(EXTLIBS))
178 EXTLIBS := $(filter-out -lpthread,$(EXTLIBS))
179 BASIC_CFLAGS += -I.
180endif
181
175# Guard against environment variables 182# Guard against environment variables
176BUILTIN_OBJS = 183BUILTIN_OBJS =
177LIB_H = 184LIB_H =
@@ -469,12 +476,18 @@ else
469FLAGS_LIBELF=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) 476FLAGS_LIBELF=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS)
470ifneq ($(call try-cc,$(SOURCE_LIBELF),$(FLAGS_LIBELF)),y) 477ifneq ($(call try-cc,$(SOURCE_LIBELF),$(FLAGS_LIBELF)),y)
471 FLAGS_GLIBC=$(ALL_CFLAGS) $(ALL_LDFLAGS) 478 FLAGS_GLIBC=$(ALL_CFLAGS) $(ALL_LDFLAGS)
472 ifneq ($(call try-cc,$(SOURCE_GLIBC),$(FLAGS_GLIBC)),y) 479 ifeq ($(call try-cc,$(SOURCE_GLIBC),$(FLAGS_GLIBC)),y)
473 msg := $(error No gnu/libc-version.h found, please install glibc-dev[el]/glibc-static); 480 LIBC_SUPPORT := 1
474 else 481 endif
482 ifeq ($(BIONIC),1)
483 LIBC_SUPPORT := 1
484 endif
485 ifeq ($(LIBC_SUPPORT),1)
475 NO_LIBELF := 1 486 NO_LIBELF := 1
476 NO_DWARF := 1 487 NO_DWARF := 1
477 NO_DEMANGLE := 1 488 NO_DEMANGLE := 1
489 else
490 msg := $(error No gnu/libc-version.h found, please install glibc-dev[el]/glibc-static);
478 endif 491 endif
479else 492else
480 FLAGS_DWARF=$(ALL_CFLAGS) -ldw -lelf $(ALL_LDFLAGS) $(EXTLIBS) 493 FLAGS_DWARF=$(ALL_CFLAGS) -ldw -lelf $(ALL_LDFLAGS) $(EXTLIBS)
diff --git a/tools/perf/config/feature-tests.mak b/tools/perf/config/feature-tests.mak
index eaeb0fd6f395..3ef5ec9cdff8 100644
--- a/tools/perf/config/feature-tests.mak
+++ b/tools/perf/config/feature-tests.mak
@@ -43,6 +43,15 @@ int main(void)
43} 43}
44endef 44endef
45 45
46define SOURCE_BIONIC
47#include <android/api-level.h>
48
49int main(void)
50{
51 return __ANDROID_API__;
52}
53endef
54
46define SOURCE_ELF_MMAP 55define SOURCE_ELF_MMAP
47#include <libelf.h> 56#include <libelf.h>
48int main(void) 57int main(void)