aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/Makefile')
-rw-r--r--tools/perf/Makefile76
1 files changed, 66 insertions, 10 deletions
diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index c045b4271e57..7e190d522cd5 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -157,16 +157,50 @@ uname_R := $(shell sh -c 'uname -r 2>/dev/null || echo not')
157uname_P := $(shell sh -c 'uname -p 2>/dev/null || echo not') 157uname_P := $(shell sh -c 'uname -p 2>/dev/null || echo not')
158uname_V := $(shell sh -c 'uname -v 2>/dev/null || echo not') 158uname_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#
161ifndef NO_64BIT 161# Add -m32 for cross-builds:
162 ifneq ($(patsubst %64,%,$(uname_M)),$(uname_M)) 162#
163 M64 := -m64 163ifdef NO_64BIT
164 endif 164 MBITS := -m32
165else
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
165endif 172endif
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.
168 175
169CFLAGS = $(M64) -ggdb3 -Wall -Wextra -Wstrict-prototypes -Wmissing-declarations -Wmissing-prototypes -std=gnu99 -Wdeclaration-after-statement -Werror -O6 176#
177# Include saner warnings here, which can catch bugs:
178#
179
180EXTRA_WARNINGS := -Wformat
181EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wformat-security
182EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wformat-y2k
183EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wshadow
184EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Winit-self
185EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wpacked
186EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wredundant-decls
187EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wstack-protector
188EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wstrict-aliasing=3
189EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wswitch-default
190EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wswitch-enum
191EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wno-system-headers
192EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wundef
193EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wvolatile-register-var
194EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wwrite-strings
195EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wbad-function-cast
196EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wmissing-declarations
197EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wmissing-prototypes
198EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wnested-externs
199EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wold-style-definition
200EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wstrict-prototypes
201EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wdeclaration-after-statement
202
203CFLAGS = $(MBITS) -ggdb3 -Wall -Wextra -std=gnu99 -Werror -O6 -fstack-protector-all -D_FORTIFY_SOURCE=2 $(EXTRA_WARNINGS)
170LDFLAGS = -lpthread -lrt -lelf -lm 204LDFLAGS = -lpthread -lrt -lelf -lm
171ALL_CFLAGS = $(CFLAGS) 205ALL_CFLAGS = $(CFLAGS)
172ALL_LDFLAGS = $(LDFLAGS) 206ALL_LDFLAGS = $(LDFLAGS)
@@ -290,7 +324,7 @@ export PERL_PATH
290 324
291LIB_FILE=libperf.a 325LIB_FILE=libperf.a
292 326
293LIB_H += ../../include/linux/perf_counter.h 327LIB_H += ../../include/linux/perf_event.h
294LIB_H += ../../include/linux/rbtree.h 328LIB_H += ../../include/linux/rbtree.h
295LIB_H += ../../include/linux/list.h 329LIB_H += ../../include/linux/list.h
296LIB_H += util/include/linux/list.h 330LIB_H += util/include/linux/list.h
@@ -310,6 +344,7 @@ LIB_H += util/sigchain.h
310LIB_H += util/symbol.h 344LIB_H += util/symbol.h
311LIB_H += util/module.h 345LIB_H += util/module.h
312LIB_H += util/color.h 346LIB_H += util/color.h
347LIB_H += util/values.h
313 348
314LIB_OBJS += util/abspath.o 349LIB_OBJS += util/abspath.o
315LIB_OBJS += util/alias.o 350LIB_OBJS += util/alias.o
@@ -337,14 +372,25 @@ LIB_OBJS += util/color.o
337LIB_OBJS += util/pager.o 372LIB_OBJS += util/pager.o
338LIB_OBJS += util/header.o 373LIB_OBJS += util/header.o
339LIB_OBJS += util/callchain.o 374LIB_OBJS += util/callchain.o
375LIB_OBJS += util/values.o
376LIB_OBJS += util/debug.o
377LIB_OBJS += util/map.o
378LIB_OBJS += util/thread.o
379LIB_OBJS += util/trace-event-parse.o
380LIB_OBJS += util/trace-event-read.o
381LIB_OBJS += util/trace-event-info.o
382LIB_OBJS += util/svghelper.o
340 383
341BUILTIN_OBJS += builtin-annotate.o 384BUILTIN_OBJS += builtin-annotate.o
342BUILTIN_OBJS += builtin-help.o 385BUILTIN_OBJS += builtin-help.o
386BUILTIN_OBJS += builtin-sched.o
343BUILTIN_OBJS += builtin-list.o 387BUILTIN_OBJS += builtin-list.o
344BUILTIN_OBJS += builtin-record.o 388BUILTIN_OBJS += builtin-record.o
345BUILTIN_OBJS += builtin-report.o 389BUILTIN_OBJS += builtin-report.o
346BUILTIN_OBJS += builtin-stat.o 390BUILTIN_OBJS += builtin-stat.o
391BUILTIN_OBJS += builtin-timechart.o
347BUILTIN_OBJS += builtin-top.o 392BUILTIN_OBJS += builtin-top.o
393BUILTIN_OBJS += builtin-trace.o
348 394
349PERFLIBS = $(LIB_FILE) 395PERFLIBS = $(LIB_FILE)
350 396
@@ -375,8 +421,12 @@ ifeq ($(uname_S),Darwin)
375 PTHREAD_LIBS = 421 PTHREAD_LIBS =
376endif 422endif
377 423
378ifneq ($(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) 424ifeq ($(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) > /dev/null 2>&1 && echo y"), y)
379 msg := $(error No libelf.h/libelf found, please install libelf-dev/elfutils-libelf-devel); 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)
426 BASIC_CFLAGS += -DLIBELF_NO_MMAP
427 endif
428else
429 msg := $(error No libelf.h/libelf found, please install libelf-dev/elfutils-libelf-devel and glibc-dev[el]);
380endif 430endif
381 431
382ifdef NO_DEMANGLE 432ifdef NO_DEMANGLE
@@ -673,6 +723,12 @@ builtin-help.o: builtin-help.c common-cmds.h PERF-CFLAGS
673 '-DPERF_MAN_PATH="$(mandir_SQ)"' \ 723 '-DPERF_MAN_PATH="$(mandir_SQ)"' \
674 '-DPERF_INFO_PATH="$(infodir_SQ)"' $< 724 '-DPERF_INFO_PATH="$(infodir_SQ)"' $<
675 725
726builtin-timechart.o: builtin-timechart.c common-cmds.h PERF-CFLAGS
727 $(QUIET_CC)$(CC) -o $*.o -c $(ALL_CFLAGS) \
728 '-DPERF_HTML_PATH="$(htmldir_SQ)"' \
729 '-DPERF_MAN_PATH="$(mandir_SQ)"' \
730 '-DPERF_INFO_PATH="$(infodir_SQ)"' $<
731
676$(BUILT_INS): perf$X 732$(BUILT_INS): perf$X
677 $(QUIET_BUILT_IN)$(RM) $@ && \ 733 $(QUIET_BUILT_IN)$(RM) $@ && \
678 ln perf$X $@ 2>/dev/null || \ 734 ln perf$X $@ 2>/dev/null || \
@@ -682,7 +738,7 @@ $(BUILT_INS): perf$X
682common-cmds.h: util/generate-cmdlist.sh command-list.txt 738common-cmds.h: util/generate-cmdlist.sh command-list.txt
683 739
684common-cmds.h: $(wildcard Documentation/perf-*.txt) 740common-cmds.h: $(wildcard Documentation/perf-*.txt)
685 $(QUIET_GEN)util/generate-cmdlist.sh > $@+ && mv $@+ $@ 741 $(QUIET_GEN). util/generate-cmdlist.sh > $@+ && mv $@+ $@
686 742
687$(patsubst %.sh,%,$(SCRIPT_SH)) : % : %.sh 743$(patsubst %.sh,%,$(SCRIPT_SH)) : % : %.sh
688 $(QUIET_GEN)$(RM) $@ $@+ && \ 744 $(QUIET_GEN)$(RM) $@ $@+ && \