diff options
Diffstat (limited to 'tools/perf/Makefile')
-rw-r--r-- | tools/perf/Makefile | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/tools/perf/Makefile b/tools/perf/Makefile index b5f1953b6144..742a32eee8fc 100644 --- a/tools/perf/Makefile +++ b/tools/perf/Makefile | |||
@@ -157,11 +157,18 @@ uname_R := $(shell sh -c 'uname -r 2>/dev/null || echo not') | |||
157 | uname_P := $(shell sh -c 'uname -p 2>/dev/null || echo not') | 157 | uname_P := $(shell sh -c 'uname -p 2>/dev/null || echo not') |
158 | uname_V := $(shell sh -c 'uname -v 2>/dev/null || echo not') | 158 | uname_V := $(shell sh -c 'uname -v 2>/dev/null || echo not') |
159 | 159 | ||
160 | # If we're on a 64-bit kernel, use -m64 | 160 | # |
161 | ifndef NO_64BIT | 161 | # Add -m32 for cross-builds: |
162 | ifneq ($(patsubst %64,%,$(uname_M)),$(uname_M)) | 162 | # |
163 | M64 := -m64 | 163 | ifdef NO_64BIT |
164 | endif | 164 | MBITS := -m32 |
165 | else | ||
166 | # | ||
167 | # If we're on a 64-bit kernel, use -m64: | ||
168 | # | ||
169 | ifneq ($(patsubst %64,%,$(uname_M)),$(uname_M)) | ||
170 | MBITS := -m64 | ||
171 | endif | ||
165 | endif | 172 | endif |
166 | 173 | ||
167 | # CFLAGS and LDFLAGS are for the users to override from the command line. | 174 | # CFLAGS and LDFLAGS are for the users to override from the command line. |
@@ -194,7 +201,7 @@ EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wold-style-definition | |||
194 | EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wstrict-prototypes | 201 | EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wstrict-prototypes |
195 | EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wdeclaration-after-statement | 202 | EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wdeclaration-after-statement |
196 | 203 | ||
197 | CFLAGS = $(M64) -ggdb3 -Wall -Wextra -std=gnu99 -Werror -O6 -fstack-protector-all -D_FORTIFY_SOURCE=2 $(EXTRA_WARNINGS) | 204 | CFLAGS = $(MBITS) -ggdb3 -Wall -Wextra -std=gnu99 -Werror -O6 -fstack-protector-all -D_FORTIFY_SOURCE=2 $(EXTRA_WARNINGS) |
198 | LDFLAGS = -lpthread -lrt -lelf -lm | 205 | LDFLAGS = -lpthread -lrt -lelf -lm |
199 | ALL_CFLAGS = $(CFLAGS) | 206 | ALL_CFLAGS = $(CFLAGS) |
200 | ALL_LDFLAGS = $(LDFLAGS) | 207 | ALL_LDFLAGS = $(LDFLAGS) |
@@ -416,7 +423,7 @@ ifeq ($(uname_S),Darwin) | |||
416 | endif | 423 | endif |
417 | 424 | ||
418 | ifneq ($(shell sh -c "(echo '\#include <libelf.h>'; echo 'int main(void) { Elf * elf = elf_begin(0, ELF_C_READ_MMAP, 0); return (long)elf; }') | $(CC) -x c - $(ALL_CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -o /dev/null $(ALL_LDFLAGS) > /dev/null 2>&1 && echo y"), y) | 425 | ifneq ($(shell sh -c "(echo '\#include <libelf.h>'; echo 'int main(void) { Elf * elf = elf_begin(0, ELF_C_READ_MMAP, 0); return (long)elf; }') | $(CC) -x c - $(ALL_CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -o /dev/null $(ALL_LDFLAGS) > /dev/null 2>&1 && echo y"), y) |
419 | msg := $(error No libelf.h/libelf found, please install libelf-dev/elfutils-libelf-devel); | 426 | msg := $(error No libelf.h/libelf found, please install libelf-dev/elfutils-libelf-devel and glibc-dev[el]); |
420 | endif | 427 | endif |
421 | 428 | ||
422 | ifdef NO_DEMANGLE | 429 | ifdef NO_DEMANGLE |
@@ -728,7 +735,7 @@ $(BUILT_INS): perf$X | |||
728 | common-cmds.h: util/generate-cmdlist.sh command-list.txt | 735 | common-cmds.h: util/generate-cmdlist.sh command-list.txt |
729 | 736 | ||
730 | common-cmds.h: $(wildcard Documentation/perf-*.txt) | 737 | common-cmds.h: $(wildcard Documentation/perf-*.txt) |
731 | $(QUIET_GEN)util/generate-cmdlist.sh > $@+ && mv $@+ $@ | 738 | $(QUIET_GEN). util/generate-cmdlist.sh > $@+ && mv $@+ $@ |
732 | 739 | ||
733 | $(patsubst %.sh,%,$(SCRIPT_SH)) : % : %.sh | 740 | $(patsubst %.sh,%,$(SCRIPT_SH)) : % : %.sh |
734 | $(QUIET_GEN)$(RM) $@ $@+ && \ | 741 | $(QUIET_GEN)$(RM) $@ $@+ && \ |