From: Irina Tirdea <irina.tirdea@gmail.com>
To: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>,
Ingo Molnar <mingo@kernel.org>,
Steven Rostedt <rostedt@goodmis.org>,
Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: LKML <linux-kernel@vger.kernel.org>,
Paul Mackerras <paulus@samba.org>,
David Ahern <dsahern@gmail.com>,
Namhyung Kim <namhyung@kernel.org>,
Pekka Enberg <penberg@kernel.org>, Jiri Olsa <jolsa@redhat.com>,
Irina Tirdea <irina.tirdea@intel.com>,
Bernhard Rosenkraenzer <Bernhard.Rosenkranzer@linaro.org>
Subject: [PATCH 2/8] perf tools: update Makefile for Android
Date: Mon, 8 Oct 2012 09:43:27 +0300 [thread overview]
Message-ID: <1349678613-7045-3-git-send-email-irina.tirdea@gmail.com> (raw)
In-Reply-To: <1349678613-7045-1-git-send-email-irina.tirdea@gmail.com>
From: Irina Tirdea <irina.tirdea@intel.com>
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: Bernhard Rosenkraenzer <Bernhard.Rosenkranzer@linaro.org>
Signed-off-by: Irina Tirdea <irina.tirdea@intel.com>
---
tools/perf/Makefile | 25 +++++++++++++++++++------
tools/perf/config/feature-tests.mak | 9 +++++++++
2 files changed, 28 insertions(+), 6 deletions(-)
diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 0e468b5..1a23118 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -155,15 +155,15 @@ SPARSE_FLAGS = -D__BIG_ENDIAN__ -D__powerpc__
-include config/feature-tests.mak
-ifeq ($(call try-cc,$(SOURCE_HELLO),-Werror -fstack-protector-all),y)
+ifeq ($(call try-cc,$(SOURCE_HELLO),$(CFLAGS) -Werror -fstack-protector-all),y)
CFLAGS := $(CFLAGS) -fstack-protector-all
endif
-ifeq ($(call try-cc,$(SOURCE_HELLO),-Werror -Wstack-protector),y)
+ifeq ($(call try-cc,$(SOURCE_HELLO),$(CFLAGS) -Werror -Wstack-protector),y)
CFLAGS := $(CFLAGS) -Wstack-protector
endif
-ifeq ($(call try-cc,$(SOURCE_HELLO),-Werror -Wvolatile-register-var),y)
+ifeq ($(call try-cc,$(SOURCE_HELLO),$(CFLAGS) -Werror -Wvolatile-register-var),y)
CFLAGS := $(CFLAGS) -Wvolatile-register-var
endif
@@ -172,6 +172,13 @@ endif
BASIC_CFLAGS = -Iutil/include -Iarch/$(ARCH)/include -I$(OUTPUT)util -I$(TRACE_EVENT_DIR) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE
BASIC_LDFLAGS =
+ifeq ($(call try-cc,$(SOURCE_BIONIC),$(CFLAGS)),y)
+ BIONIC := 1
+ EXTLIBS := $(filter-out -lrt,$(EXTLIBS))
+ EXTLIBS := $(filter-out -lpthread,$(EXTLIBS))
+ BASIC_CFLAGS += -I.
+endif
+
# Guard against environment variables
BUILTIN_OBJS =
LIB_H =
@@ -467,12 +474,18 @@ else
FLAGS_LIBELF=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS)
ifneq ($(call try-cc,$(SOURCE_LIBELF),$(FLAGS_LIBELF)),y)
FLAGS_GLIBC=$(ALL_CFLAGS) $(ALL_LDFLAGS)
- ifneq ($(call try-cc,$(SOURCE_GLIBC),$(FLAGS_GLIBC)),y)
- msg := $(error No gnu/libc-version.h found, please install glibc-dev[el]/glibc-static);
- else
+ ifeq ($(call try-cc,$(SOURCE_GLIBC),$(FLAGS_GLIBC)),y)
+ LIBC_SUPPORT := 1
+ endif
+ ifeq ($(BIONIC),1)
+ LIBC_SUPPORT := 1
+ endif
+ ifeq ($(LIBC_SUPPORT),1)
NO_LIBELF := 1
NO_DWARF := 1
NO_DEMANGLE := 1
+ else
+ msg := $(error No gnu/libc-version.h found, please install glibc-dev[el]/glibc-static);
endif
else
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 eaeb0fd..3ef5ec9 100644
--- a/tools/perf/config/feature-tests.mak
+++ b/tools/perf/config/feature-tests.mak
@@ -43,6 +43,15 @@ int main(void)
}
endef
+define SOURCE_BIONIC
+#include <android/api-level.h>
+
+int main(void)
+{
+ return __ANDROID_API__;
+}
+endef
+
define SOURCE_ELF_MMAP
#include <libelf.h>
int main(void)
--
1.7.9.5
next prev parent reply other threads:[~2012-10-08 6:45 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-08 6:43 [PATCH 0/8] perf tools: fixes " Irina Tirdea
2012-10-08 6:43 ` [PATCH 1/8] perf tools: add on_exit implementation Irina Tirdea
2012-10-09 17:41 ` [tip:perf/core] perf tools: Add " tip-bot for Bernhard Rosenkraenzer
2012-10-08 6:43 ` Irina Tirdea [this message]
2012-10-08 20:43 ` [PATCH 2/8] perf tools: update Makefile for Android Arnaldo Carvalho de Melo
2012-10-09 17:42 ` [tip:perf/core] perf tools: Update " tip-bot for Irina Tirdea
2012-10-08 6:43 ` [PATCH 3/8] Documentation: add documentation on compiling " Irina Tirdea
2012-10-09 17:43 ` [tip:perf/core] " tip-bot for Irina Tirdea
2012-10-08 6:43 ` [PATCH v3 4/8] perf tools: configure tmp path at build time Irina Tirdea
2012-10-08 20:50 ` Arnaldo Carvalho de Melo
2012-10-08 6:43 ` [PATCH v3 5/8] perf tools: configure shell path at compile time Irina Tirdea
2012-10-08 6:43 ` [PATCH v3 6/8] perf tools: Try to find cross-built objdump path Irina Tirdea
2012-10-08 21:03 ` Arnaldo Carvalho de Melo
2012-10-15 22:59 ` Irina Tirdea
2012-10-08 6:43 ` [PATCH v3 7/8] perf tools: configure addr2line for cross-compiling Irina Tirdea
2012-10-08 21:04 ` Arnaldo Carvalho de Melo
2012-10-08 6:43 ` [PATCH v3 8/8] perf stat: implement --big-num grouping Irina Tirdea
2012-10-08 21:11 ` Arnaldo Carvalho de Melo
2012-10-15 23:05 ` Irina Tirdea
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1349678613-7045-3-git-send-email-irina.tirdea@gmail.com \
--to=irina.tirdea@gmail.com \
--cc=Bernhard.Rosenkranzer@linaro.org \
--cc=a.p.zijlstra@chello.nl \
--cc=acme@ghostprotocols.net \
--cc=dsahern@gmail.com \
--cc=irina.tirdea@intel.com \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=namhyung@kernel.org \
--cc=paulus@samba.org \
--cc=penberg@kernel.org \
--cc=rostedt@goodmis.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®