aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/Makefile')
-rw-r--r--tools/perf/Makefile52
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..
251SPARSE_FLAGS = -D__BIG_ENDIAN__ -D__powerpc__ 251SPARSE_FLAGS = -D__BIG_ENDIAN__ -D__powerpc__
252 252
253ifeq ($(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) 253ifeq ($(V), 2)
254 QUIET_STDERR = ">/dev/null"
255else
256 QUIET_STDERR = ">/dev/null 2>&1"
257endif
258
259BITBUCKET = "/dev/null"
260
261ifneq ($(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
263endif
264
265ifeq ($(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
255endif 267endif
256 268
@@ -343,13 +355,18 @@ LIB_H += util/include/linux/string.h
343LIB_H += util/include/linux/types.h 355LIB_H += util/include/linux/types.h
344LIB_H += util/include/asm/asm-offsets.h 356LIB_H += util/include/asm/asm-offsets.h
345LIB_H += util/include/asm/bitops.h 357LIB_H += util/include/asm/bitops.h
358LIB_H += util/include/asm/bug.h
346LIB_H += util/include/asm/byteorder.h 359LIB_H += util/include/asm/byteorder.h
347LIB_H += util/include/asm/swab.h 360LIB_H += util/include/asm/swab.h
348LIB_H += util/include/asm/system.h 361LIB_H += util/include/asm/system.h
349LIB_H += util/include/asm/uaccess.h 362LIB_H += util/include/asm/uaccess.h
350LIB_H += perf.h 363LIB_H += perf.h
364LIB_H += util/cache.h
365LIB_H += util/callchain.h
366LIB_H += util/debug.h
351LIB_H += util/debugfs.h 367LIB_H += util/debugfs.h
352LIB_H += util/event.h 368LIB_H += util/event.h
369LIB_H += util/exec_cmd.h
353LIB_H += util/types.h 370LIB_H += util/types.h
354LIB_H += util/levenshtein.h 371LIB_H += util/levenshtein.h
355LIB_H += util/parse-options.h 372LIB_H += util/parse-options.h
@@ -362,6 +379,7 @@ LIB_H += util/session.h
362LIB_H += util/strbuf.h 379LIB_H += util/strbuf.h
363LIB_H += util/string.h 380LIB_H += util/string.h
364LIB_H += util/strlist.h 381LIB_H += util/strlist.h
382LIB_H += util/svghelper.h
365LIB_H += util/run-command.h 383LIB_H += util/run-command.h
366LIB_H += util/sigchain.h 384LIB_H += util/sigchain.h
367LIB_H += util/symbol.h 385LIB_H += util/symbol.h
@@ -370,6 +388,8 @@ LIB_H += util/values.h
370LIB_H += util/sort.h 388LIB_H += util/sort.h
371LIB_H += util/hist.h 389LIB_H += util/hist.h
372LIB_H += util/thread.h 390LIB_H += util/thread.h
391LIB_H += util/trace-event.h
392LIB_H += util/trace-event-perl.h
373LIB_H += util/probe-finder.h 393LIB_H += util/probe-finder.h
374LIB_H += util/probe-event.h 394LIB_H += util/probe-event.h
375 395
@@ -443,11 +463,6 @@ BUILTIN_OBJS += builtin-kmem.o
443 463
444PERFLIBS = $(LIB_FILE) 464PERFLIBS = $(LIB_FILE)
445 465
446ifeq ($(V), 2)
447 QUIET_STDERR = ">/dev/null"
448else
449 QUIET_STDERR = ">/dev/null 2>&1"
450endif
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 =
476endif 491endif
477 492
478ifeq ($(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) 493ifeq ($(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)
479ifneq ($(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) 494ifneq ($(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);
481endif 496endif
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
486else 501else
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]);
488endif 503endif
489 504
490ifneq ($(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) 505ifneq ($(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
493else 508else
@@ -501,7 +516,7 @@ PERL_EMBED_LDOPTS = `perl -MExtUtils::Embed -e ldopts 2>/dev/null`
501PERL_EMBED_CCOPTS = `perl -MExtUtils::Embed -e ccopts 2>/dev/null` 516PERL_EMBED_CCOPTS = `perl -MExtUtils::Embed -e ccopts 2>/dev/null`
502endif 517endif
503 518
504ifneq ($(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) 519ifneq ($(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
506else 521else
507 ALL_LDFLAGS += $(PERL_EMBED_LDOPTS) 522 ALL_LDFLAGS += $(PERL_EMBED_LDOPTS)
@@ -511,20 +526,20 @@ endif
511ifdef NO_DEMANGLE 526ifdef NO_DEMANGLE
512 BASIC_CFLAGS += -DNO_DEMANGLE 527 BASIC_CFLAGS += -DNO_DEMANGLE
513else 528else
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
773SHELL = $(SHELL_PATH) 788SHELL = $(SHELL_PATH)
774 789
775all:: shell_compatibility_test $(ALL_PROGRAMS) $(BUILT_INS) $(OTHER_PROGRAMS) PERF-BUILD-OPTIONS 790all:: .perf.dev.null shell_compatibility_test $(ALL_PROGRAMS) $(BUILT_INS) $(OTHER_PROGRAMS) PERF-BUILD-OPTIONS
776ifneq (,$X) 791ifneq (,$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';)
778endif 793endif
@@ -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#
1104check-builtins:: 1124check-builtins::