diff options
Diffstat (limited to 'tools/perf/Makefile')
-rw-r--r-- | tools/perf/Makefile | 76 |
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') | |||
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. |
168 | 175 | ||
169 | CFLAGS = $(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 | |||
180 | EXTRA_WARNINGS := -Wformat | ||
181 | EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wformat-security | ||
182 | EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wformat-y2k | ||
183 | EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wshadow | ||
184 | EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Winit-self | ||
185 | EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wpacked | ||
186 | EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wredundant-decls | ||
187 | EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wstack-protector | ||
188 | EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wstrict-aliasing=3 | ||
189 | EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wswitch-default | ||
190 | EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wswitch-enum | ||
191 | EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wno-system-headers | ||
192 | EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wundef | ||
193 | EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wvolatile-register-var | ||
194 | EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wwrite-strings | ||
195 | EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wbad-function-cast | ||
196 | EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wmissing-declarations | ||
197 | EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wmissing-prototypes | ||
198 | EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wnested-externs | ||
199 | EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wold-style-definition | ||
200 | EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wstrict-prototypes | ||
201 | EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wdeclaration-after-statement | ||
202 | |||
203 | CFLAGS = $(MBITS) -ggdb3 -Wall -Wextra -std=gnu99 -Werror -O6 -fstack-protector-all -D_FORTIFY_SOURCE=2 $(EXTRA_WARNINGS) | ||
170 | LDFLAGS = -lpthread -lrt -lelf -lm | 204 | LDFLAGS = -lpthread -lrt -lelf -lm |
171 | ALL_CFLAGS = $(CFLAGS) | 205 | ALL_CFLAGS = $(CFLAGS) |
172 | ALL_LDFLAGS = $(LDFLAGS) | 206 | ALL_LDFLAGS = $(LDFLAGS) |
@@ -290,7 +324,7 @@ export PERL_PATH | |||
290 | 324 | ||
291 | LIB_FILE=libperf.a | 325 | LIB_FILE=libperf.a |
292 | 326 | ||
293 | LIB_H += ../../include/linux/perf_counter.h | 327 | LIB_H += ../../include/linux/perf_event.h |
294 | LIB_H += ../../include/linux/rbtree.h | 328 | LIB_H += ../../include/linux/rbtree.h |
295 | LIB_H += ../../include/linux/list.h | 329 | LIB_H += ../../include/linux/list.h |
296 | LIB_H += util/include/linux/list.h | 330 | LIB_H += util/include/linux/list.h |
@@ -310,6 +344,7 @@ LIB_H += util/sigchain.h | |||
310 | LIB_H += util/symbol.h | 344 | LIB_H += util/symbol.h |
311 | LIB_H += util/module.h | 345 | LIB_H += util/module.h |
312 | LIB_H += util/color.h | 346 | LIB_H += util/color.h |
347 | LIB_H += util/values.h | ||
313 | 348 | ||
314 | LIB_OBJS += util/abspath.o | 349 | LIB_OBJS += util/abspath.o |
315 | LIB_OBJS += util/alias.o | 350 | LIB_OBJS += util/alias.o |
@@ -337,14 +372,25 @@ LIB_OBJS += util/color.o | |||
337 | LIB_OBJS += util/pager.o | 372 | LIB_OBJS += util/pager.o |
338 | LIB_OBJS += util/header.o | 373 | LIB_OBJS += util/header.o |
339 | LIB_OBJS += util/callchain.o | 374 | LIB_OBJS += util/callchain.o |
375 | LIB_OBJS += util/values.o | ||
376 | LIB_OBJS += util/debug.o | ||
377 | LIB_OBJS += util/map.o | ||
378 | LIB_OBJS += util/thread.o | ||
379 | LIB_OBJS += util/trace-event-parse.o | ||
380 | LIB_OBJS += util/trace-event-read.o | ||
381 | LIB_OBJS += util/trace-event-info.o | ||
382 | LIB_OBJS += util/svghelper.o | ||
340 | 383 | ||
341 | BUILTIN_OBJS += builtin-annotate.o | 384 | BUILTIN_OBJS += builtin-annotate.o |
342 | BUILTIN_OBJS += builtin-help.o | 385 | BUILTIN_OBJS += builtin-help.o |
386 | BUILTIN_OBJS += builtin-sched.o | ||
343 | BUILTIN_OBJS += builtin-list.o | 387 | BUILTIN_OBJS += builtin-list.o |
344 | BUILTIN_OBJS += builtin-record.o | 388 | BUILTIN_OBJS += builtin-record.o |
345 | BUILTIN_OBJS += builtin-report.o | 389 | BUILTIN_OBJS += builtin-report.o |
346 | BUILTIN_OBJS += builtin-stat.o | 390 | BUILTIN_OBJS += builtin-stat.o |
391 | BUILTIN_OBJS += builtin-timechart.o | ||
347 | BUILTIN_OBJS += builtin-top.o | 392 | BUILTIN_OBJS += builtin-top.o |
393 | BUILTIN_OBJS += builtin-trace.o | ||
348 | 394 | ||
349 | PERFLIBS = $(LIB_FILE) | 395 | PERFLIBS = $(LIB_FILE) |
350 | 396 | ||
@@ -375,8 +421,12 @@ ifeq ($(uname_S),Darwin) | |||
375 | PTHREAD_LIBS = | 421 | PTHREAD_LIBS = |
376 | endif | 422 | endif |
377 | 423 | ||
378 | 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) | 424 | 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) > /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 | ||
428 | else | ||
429 | msg := $(error No libelf.h/libelf found, please install libelf-dev/elfutils-libelf-devel and glibc-dev[el]); | ||
380 | endif | 430 | endif |
381 | 431 | ||
382 | ifdef NO_DEMANGLE | 432 | ifdef 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 | ||
726 | builtin-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 | |||
682 | common-cmds.h: util/generate-cmdlist.sh command-list.txt | 738 | common-cmds.h: util/generate-cmdlist.sh command-list.txt |
683 | 739 | ||
684 | common-cmds.h: $(wildcard Documentation/perf-*.txt) | 740 | common-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) $@ $@+ && \ |