diff options
Diffstat (limited to 'tools/perf/Makefile')
-rw-r--r-- | tools/perf/Makefile | 52 |
1 files changed, 36 insertions, 16 deletions
diff --git a/tools/perf/Makefile b/tools/perf/Makefile index 4390d225686d..2e7fa3a06806 100644 --- a/tools/perf/Makefile +++ b/tools/perf/Makefile | |||
@@ -250,7 +250,19 @@ PTHREAD_LIBS = -lpthread | |||
250 | # explicitly what architecture to check for. Fix this up for yours.. | 250 | # explicitly what architecture to check for. Fix this up for yours.. |
251 | SPARSE_FLAGS = -D__BIG_ENDIAN__ -D__powerpc__ | 251 | SPARSE_FLAGS = -D__BIG_ENDIAN__ -D__powerpc__ |
252 | 252 | ||
253 | ifeq ($(shell sh -c "echo 'int foo(void) {char X[2]; return 3;}' | $(CC) -x c -c -Werror -fstack-protector-all - -o /dev/null "$(QUIET_STDERR)" && echo y"), y) | 253 | ifeq ($(V), 2) |
254 | QUIET_STDERR = ">/dev/null" | ||
255 | else | ||
256 | QUIET_STDERR = ">/dev/null 2>&1" | ||
257 | endif | ||
258 | |||
259 | BITBUCKET = "/dev/null" | ||
260 | |||
261 | ifneq ($(shell sh -c "(echo '\#include <stdio.h>'; echo 'int main(void) { return puts(\"hi\"); }') | $(CC) -x c - $(ALL_CFLAGS) -o $(BITBUCKET) "$(QUIET_STDERR)" && echo y"), y) | ||
262 | BITBUCKET = .perf.dev.null | ||
263 | endif | ||
264 | |||
265 | ifeq ($(shell sh -c "echo 'int foo(void) {char X[2]; return 3;}' | $(CC) -x c -c -Werror -fstack-protector-all - -o $(BITBUCKET) "$(QUIET_STDERR)" && echo y"), y) | ||
254 | CFLAGS := $(CFLAGS) -fstack-protector-all | 266 | CFLAGS := $(CFLAGS) -fstack-protector-all |
255 | endif | 267 | endif |
256 | 268 | ||
@@ -343,13 +355,18 @@ LIB_H += util/include/linux/string.h | |||
343 | LIB_H += util/include/linux/types.h | 355 | LIB_H += util/include/linux/types.h |
344 | LIB_H += util/include/asm/asm-offsets.h | 356 | LIB_H += util/include/asm/asm-offsets.h |
345 | LIB_H += util/include/asm/bitops.h | 357 | LIB_H += util/include/asm/bitops.h |
358 | LIB_H += util/include/asm/bug.h | ||
346 | LIB_H += util/include/asm/byteorder.h | 359 | LIB_H += util/include/asm/byteorder.h |
347 | LIB_H += util/include/asm/swab.h | 360 | LIB_H += util/include/asm/swab.h |
348 | LIB_H += util/include/asm/system.h | 361 | LIB_H += util/include/asm/system.h |
349 | LIB_H += util/include/asm/uaccess.h | 362 | LIB_H += util/include/asm/uaccess.h |
350 | LIB_H += perf.h | 363 | LIB_H += perf.h |
364 | LIB_H += util/cache.h | ||
365 | LIB_H += util/callchain.h | ||
366 | LIB_H += util/debug.h | ||
351 | LIB_H += util/debugfs.h | 367 | LIB_H += util/debugfs.h |
352 | LIB_H += util/event.h | 368 | LIB_H += util/event.h |
369 | LIB_H += util/exec_cmd.h | ||
353 | LIB_H += util/types.h | 370 | LIB_H += util/types.h |
354 | LIB_H += util/levenshtein.h | 371 | LIB_H += util/levenshtein.h |
355 | LIB_H += util/parse-options.h | 372 | LIB_H += util/parse-options.h |
@@ -362,6 +379,7 @@ LIB_H += util/session.h | |||
362 | LIB_H += util/strbuf.h | 379 | LIB_H += util/strbuf.h |
363 | LIB_H += util/string.h | 380 | LIB_H += util/string.h |
364 | LIB_H += util/strlist.h | 381 | LIB_H += util/strlist.h |
382 | LIB_H += util/svghelper.h | ||
365 | LIB_H += util/run-command.h | 383 | LIB_H += util/run-command.h |
366 | LIB_H += util/sigchain.h | 384 | LIB_H += util/sigchain.h |
367 | LIB_H += util/symbol.h | 385 | LIB_H += util/symbol.h |
@@ -370,6 +388,8 @@ LIB_H += util/values.h | |||
370 | LIB_H += util/sort.h | 388 | LIB_H += util/sort.h |
371 | LIB_H += util/hist.h | 389 | LIB_H += util/hist.h |
372 | LIB_H += util/thread.h | 390 | LIB_H += util/thread.h |
391 | LIB_H += util/trace-event.h | ||
392 | LIB_H += util/trace-event-perl.h | ||
373 | LIB_H += util/probe-finder.h | 393 | LIB_H += util/probe-finder.h |
374 | LIB_H += util/probe-event.h | 394 | LIB_H += util/probe-event.h |
375 | 395 | ||
@@ -443,11 +463,6 @@ BUILTIN_OBJS += builtin-kmem.o | |||
443 | 463 | ||
444 | PERFLIBS = $(LIB_FILE) | 464 | PERFLIBS = $(LIB_FILE) |
445 | 465 | ||
446 | ifeq ($(V), 2) | ||
447 | QUIET_STDERR = ">/dev/null" | ||
448 | else | ||
449 | QUIET_STDERR = ">/dev/null 2>&1" | ||
450 | endif | ||
451 | # | 466 | # |
452 | # Platform specific tweaks | 467 | # Platform specific tweaks |
453 | # | 468 | # |
@@ -475,19 +490,19 @@ ifeq ($(uname_S),Darwin) | |||
475 | PTHREAD_LIBS = | 490 | PTHREAD_LIBS = |
476 | endif | 491 | endif |
477 | 492 | ||
478 | ifeq ($(shell sh -c "(echo '\#include <libelf.h>'; echo 'int main(void) { Elf * elf = elf_begin(0, ELF_C_READ, 0); return (long)elf; }') | $(CC) -x c - $(ALL_CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -o /dev/null $(ALL_LDFLAGS) $(EXTLIBS) "$(QUIET_STDERR)" && echo y"), y) | 493 | ifeq ($(shell sh -c "(echo '\#include <libelf.h>'; echo 'int main(void) { Elf * elf = elf_begin(0, ELF_C_READ, 0); return (long)elf; }') | $(CC) -x c - $(ALL_CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -o $(BITBUCKET) $(ALL_LDFLAGS) $(EXTLIBS) "$(QUIET_STDERR)" && echo y"), y) |
479 | ifneq ($(shell sh -c "(echo '\#include <gnu/libc-version.h>'; echo 'int main(void) { const char * version = gnu_get_libc_version(); return (long)version; }') | $(CC) -x c - $(ALL_CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -o /dev/null $(ALL_LDFLAGS) $(EXTLIBS) "$(QUIET_STDERR)" && echo y"), y) | 494 | ifneq ($(shell sh -c "(echo '\#include <gnu/libc-version.h>'; echo 'int main(void) { const char * version = gnu_get_libc_version(); return (long)version; }') | $(CC) -x c - $(ALL_CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -o $(BITBUCKET) $(ALL_LDFLAGS) $(EXTLIBS) "$(QUIET_STDERR)" && echo y"), y) |
480 | msg := $(error No gnu/libc-version.h found, please install glibc-dev[el]/glibc-static); | 495 | msg := $(error No gnu/libc-version.h found, please install glibc-dev[el]/glibc-static); |
481 | endif | 496 | endif |
482 | 497 | ||
483 | 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) $(EXTLIBS) "$(QUIET_STDERR)" && echo y"), y) | 498 | 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 $(BITBUCKET) $(ALL_LDFLAGS) $(EXTLIBS) "$(QUIET_STDERR)" && echo y"), y) |
484 | BASIC_CFLAGS += -DLIBELF_NO_MMAP | 499 | BASIC_CFLAGS += -DLIBELF_NO_MMAP |
485 | endif | 500 | endif |
486 | else | 501 | else |
487 | msg := $(error No libelf.h/libelf found, please install libelf-dev/elfutils-libelf-devel and glibc-dev[el]); | 502 | msg := $(error No libelf.h/libelf found, please install libelf-dev/elfutils-libelf-devel and glibc-dev[el]); |
488 | endif | 503 | endif |
489 | 504 | ||
490 | ifneq ($(shell sh -c "(echo '\#ifndef _MIPS_SZLONG'; echo '\#define _MIPS_SZLONG 0'; echo '\#endif'; echo '\#include <dwarf.h>'; echo '\#include <libdwarf.h>'; echo 'int main(void) { Dwarf_Debug dbg; Dwarf_Error err; Dwarf_Ranges *rng; dwarf_init(0, DW_DLC_READ, 0, 0, &dbg, &err); dwarf_get_ranges(dbg, 0, &rng, 0, 0, &err); return (long)dbg; }') | $(CC) -x c - $(ALL_CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/libdwarf -ldwarf -lelf -o /dev/null $(ALL_LDFLAGS) $(EXTLIBS) "$(QUIET_STDERR)" && echo y"), y) | 505 | ifneq ($(shell sh -c "(echo '\#ifndef _MIPS_SZLONG'; echo '\#define _MIPS_SZLONG 0'; echo '\#endif'; echo '\#include <dwarf.h>'; echo '\#include <libdwarf.h>'; echo 'int main(void) { Dwarf_Debug dbg; Dwarf_Error err; Dwarf_Ranges *rng; dwarf_init(0, DW_DLC_READ, 0, 0, &dbg, &err); dwarf_get_ranges(dbg, 0, &rng, 0, 0, &err); return (long)dbg; }') | $(CC) -x c - $(ALL_CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/libdwarf -ldwarf -lelf -o $(BITBUCKET) $(ALL_LDFLAGS) $(EXTLIBS) "$(QUIET_STDERR)" && echo y"), y) |
491 | msg := $(warning No libdwarf.h found or old libdwarf.h found, disables dwarf support. Please install libdwarf-dev/libdwarf-devel >= 20081231); | 506 | msg := $(warning No libdwarf.h found or old libdwarf.h found, disables dwarf support. Please install libdwarf-dev/libdwarf-devel >= 20081231); |
492 | BASIC_CFLAGS += -DNO_LIBDWARF | 507 | BASIC_CFLAGS += -DNO_LIBDWARF |
493 | else | 508 | else |
@@ -501,7 +516,7 @@ PERL_EMBED_LDOPTS = `perl -MExtUtils::Embed -e ldopts 2>/dev/null` | |||
501 | PERL_EMBED_CCOPTS = `perl -MExtUtils::Embed -e ccopts 2>/dev/null` | 516 | PERL_EMBED_CCOPTS = `perl -MExtUtils::Embed -e ccopts 2>/dev/null` |
502 | endif | 517 | endif |
503 | 518 | ||
504 | ifneq ($(shell sh -c "(echo '\#include <EXTERN.h>'; echo '\#include <perl.h>'; echo 'int main(void) { perl_alloc(); return 0; }') | $(CC) -x c - $(PERL_EMBED_CCOPTS) -o /dev/null $(PERL_EMBED_LDOPTS) > /dev/null 2>&1 && echo y"), y) | 519 | ifneq ($(shell sh -c "(echo '\#include <EXTERN.h>'; echo '\#include <perl.h>'; echo 'int main(void) { perl_alloc(); return 0; }') | $(CC) -x c - $(PERL_EMBED_CCOPTS) -o $(BITBUCKET) $(PERL_EMBED_LDOPTS) > /dev/null 2>&1 && echo y"), y) |
505 | BASIC_CFLAGS += -DNO_LIBPERL | 520 | BASIC_CFLAGS += -DNO_LIBPERL |
506 | else | 521 | else |
507 | ALL_LDFLAGS += $(PERL_EMBED_LDOPTS) | 522 | ALL_LDFLAGS += $(PERL_EMBED_LDOPTS) |
@@ -511,20 +526,20 @@ endif | |||
511 | ifdef NO_DEMANGLE | 526 | ifdef NO_DEMANGLE |
512 | BASIC_CFLAGS += -DNO_DEMANGLE | 527 | BASIC_CFLAGS += -DNO_DEMANGLE |
513 | else | 528 | else |
514 | has_bfd := $(shell sh -c "(echo '\#include <bfd.h>'; echo 'int main(void) { bfd_demangle(0, 0, 0); return 0; }') | $(CC) -x c - $(ALL_CFLAGS) -o /dev/null $(ALL_LDFLAGS) $(EXTLIBS) -lbfd "$(QUIET_STDERR)" && echo y") | 529 | has_bfd := $(shell sh -c "(echo '\#include <bfd.h>'; echo 'int main(void) { bfd_demangle(0, 0, 0); return 0; }') | $(CC) -x c - $(ALL_CFLAGS) -o $(BITBUCKET) $(ALL_LDFLAGS) $(EXTLIBS) -lbfd "$(QUIET_STDERR)" && echo y") |
515 | 530 | ||
516 | ifeq ($(has_bfd),y) | 531 | ifeq ($(has_bfd),y) |
517 | EXTLIBS += -lbfd | 532 | EXTLIBS += -lbfd |
518 | else | 533 | else |
519 | has_bfd_iberty := $(shell sh -c "(echo '\#include <bfd.h>'; echo 'int main(void) { bfd_demangle(0, 0, 0); return 0; }') | $(CC) -x c - $(ALL_CFLAGS) -o /dev/null $(ALL_LDFLAGS) $(EXTLIBS) -lbfd -liberty "$(QUIET_STDERR)" && echo y") | 534 | has_bfd_iberty := $(shell sh -c "(echo '\#include <bfd.h>'; echo 'int main(void) { bfd_demangle(0, 0, 0); return 0; }') | $(CC) -x c - $(ALL_CFLAGS) -o $(BITBUCKET) $(ALL_LDFLAGS) $(EXTLIBS) -lbfd -liberty "$(QUIET_STDERR)" && echo y") |
520 | ifeq ($(has_bfd_iberty),y) | 535 | ifeq ($(has_bfd_iberty),y) |
521 | EXTLIBS += -lbfd -liberty | 536 | EXTLIBS += -lbfd -liberty |
522 | else | 537 | else |
523 | has_bfd_iberty_z := $(shell sh -c "(echo '\#include <bfd.h>'; echo 'int main(void) { bfd_demangle(0, 0, 0); return 0; }') | $(CC) -x c - $(ALL_CFLAGS) -o /dev/null $(ALL_LDFLAGS) $(EXTLIBS) -lbfd -liberty -lz "$(QUIET_STDERR)" && echo y") | 538 | has_bfd_iberty_z := $(shell sh -c "(echo '\#include <bfd.h>'; echo 'int main(void) { bfd_demangle(0, 0, 0); return 0; }') | $(CC) -x c - $(ALL_CFLAGS) -o $(BITBUCKET) $(ALL_LDFLAGS) $(EXTLIBS) -lbfd -liberty -lz "$(QUIET_STDERR)" && echo y") |
524 | ifeq ($(has_bfd_iberty_z),y) | 539 | ifeq ($(has_bfd_iberty_z),y) |
525 | EXTLIBS += -lbfd -liberty -lz | 540 | EXTLIBS += -lbfd -liberty -lz |
526 | else | 541 | else |
527 | has_cplus_demangle := $(shell sh -c "(echo 'extern char *cplus_demangle(const char *, int);'; echo 'int main(void) { cplus_demangle(0, 0); return 0; }') | $(CC) -x c - $(ALL_CFLAGS) -o /dev/null $(ALL_LDFLAGS) $(EXTLIBS) -liberty "$(QUIET_STDERR)" && echo y") | 542 | has_cplus_demangle := $(shell sh -c "(echo 'extern char *cplus_demangle(const char *, int);'; echo 'int main(void) { cplus_demangle(0, 0); return 0; }') | $(CC) -x c - $(ALL_CFLAGS) -o $(BITBUCKET) $(ALL_LDFLAGS) $(EXTLIBS) -liberty "$(QUIET_STDERR)" && echo y") |
528 | ifeq ($(has_cplus_demangle),y) | 543 | ifeq ($(has_cplus_demangle),y) |
529 | EXTLIBS += -liberty | 544 | EXTLIBS += -liberty |
530 | BASIC_CFLAGS += -DHAVE_CPLUS_DEMANGLE | 545 | BASIC_CFLAGS += -DHAVE_CPLUS_DEMANGLE |
@@ -772,7 +787,7 @@ export TAR INSTALL DESTDIR SHELL_PATH | |||
772 | 787 | ||
773 | SHELL = $(SHELL_PATH) | 788 | SHELL = $(SHELL_PATH) |
774 | 789 | ||
775 | all:: shell_compatibility_test $(ALL_PROGRAMS) $(BUILT_INS) $(OTHER_PROGRAMS) PERF-BUILD-OPTIONS | 790 | all:: .perf.dev.null shell_compatibility_test $(ALL_PROGRAMS) $(BUILT_INS) $(OTHER_PROGRAMS) PERF-BUILD-OPTIONS |
776 | ifneq (,$X) | 791 | ifneq (,$X) |
777 | $(foreach p,$(patsubst %$X,%,$(filter %$X,$(ALL_PROGRAMS) $(BUILT_INS) perf$X)), test '$p' -ef '$p$X' || $(RM) '$p';) | 792 | $(foreach p,$(patsubst %$X,%,$(filter %$X,$(ALL_PROGRAMS) $(BUILT_INS) perf$X)), test '$p' -ef '$p$X' || $(RM) '$p';) |
778 | endif | 793 | endif |
@@ -1099,6 +1114,11 @@ clean: | |||
1099 | .PHONY: .FORCE-PERF-VERSION-FILE TAGS tags cscope .FORCE-PERF-CFLAGS | 1114 | .PHONY: .FORCE-PERF-VERSION-FILE TAGS tags cscope .FORCE-PERF-CFLAGS |
1100 | .PHONY: .FORCE-PERF-BUILD-OPTIONS | 1115 | .PHONY: .FORCE-PERF-BUILD-OPTIONS |
1101 | 1116 | ||
1117 | .perf.dev.null: | ||
1118 | touch .perf.dev.null | ||
1119 | |||
1120 | .INTERMEDIATE: .perf.dev.null | ||
1121 | |||
1102 | ### Make sure built-ins do not have dups and listed in perf.c | 1122 | ### Make sure built-ins do not have dups and listed in perf.c |
1103 | # | 1123 | # |
1104 | check-builtins:: | 1124 | check-builtins:: |