diff options
Diffstat (limited to 'tools/perf/Makefile')
-rw-r--r-- | tools/perf/Makefile | 388 |
1 files changed, 220 insertions, 168 deletions
diff --git a/tools/perf/Makefile b/tools/perf/Makefile index bc0f670a8338..3d8f31ed771d 100644 --- a/tools/perf/Makefile +++ b/tools/perf/Makefile | |||
@@ -1,3 +1,7 @@ | |||
1 | ifeq ("$(origin O)", "command line") | ||
2 | OUTPUT := $(O)/ | ||
3 | endif | ||
4 | |||
1 | # The default target of this Makefile is... | 5 | # The default target of this Makefile is... |
2 | all:: | 6 | all:: |
3 | 7 | ||
@@ -150,10 +154,17 @@ all:: | |||
150 | # Define LDFLAGS=-static to build a static binary. | 154 | # Define LDFLAGS=-static to build a static binary. |
151 | # | 155 | # |
152 | # Define EXTRA_CFLAGS=-m64 or EXTRA_CFLAGS=-m32 as appropriate for cross-builds. | 156 | # Define EXTRA_CFLAGS=-m64 or EXTRA_CFLAGS=-m32 as appropriate for cross-builds. |
157 | # | ||
158 | # Define NO_DWARF if you do not want debug-info analysis feature at all. | ||
153 | 159 | ||
154 | PERF-VERSION-FILE: .FORCE-PERF-VERSION-FILE | 160 | $(shell sh -c 'mkdir -p $(OUTPUT)scripts/python/Perf-Trace-Util/' 2> /dev/null) |
155 | @$(SHELL_PATH) util/PERF-VERSION-GEN | 161 | $(shell sh -c 'mkdir -p $(OUTPUT)scripts/perl/Perf-Trace-Util/' 2> /dev/null) |
156 | -include PERF-VERSION-FILE | 162 | $(shell sh -c 'mkdir -p $(OUTPUT)util/scripting-engines/' 2> /dev/null) |
163 | $(shell sh -c 'mkdir $(OUTPUT)bench' 2> /dev/null) | ||
164 | |||
165 | $(OUTPUT)PERF-VERSION-FILE: .FORCE-PERF-VERSION-FILE | ||
166 | @$(SHELL_PATH) util/PERF-VERSION-GEN $(OUTPUT) | ||
167 | -include $(OUTPUT)PERF-VERSION-FILE | ||
157 | 168 | ||
158 | uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not') | 169 | uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not') |
159 | uname_M := $(shell sh -c 'uname -m 2>/dev/null || echo not') | 170 | uname_M := $(shell sh -c 'uname -m 2>/dev/null || echo not') |
@@ -162,6 +173,22 @@ uname_R := $(shell sh -c 'uname -r 2>/dev/null || echo not') | |||
162 | uname_P := $(shell sh -c 'uname -p 2>/dev/null || echo not') | 173 | uname_P := $(shell sh -c 'uname -p 2>/dev/null || echo not') |
163 | uname_V := $(shell sh -c 'uname -v 2>/dev/null || echo not') | 174 | uname_V := $(shell sh -c 'uname -v 2>/dev/null || echo not') |
164 | 175 | ||
176 | ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \ | ||
177 | -e s/arm.*/arm/ -e s/sa110/arm/ \ | ||
178 | -e s/s390x/s390/ -e s/parisc64/parisc/ \ | ||
179 | -e s/ppc.*/powerpc/ -e s/mips.*/mips/ \ | ||
180 | -e s/sh[234].*/sh/ ) | ||
181 | |||
182 | # Additional ARCH settings for x86 | ||
183 | ifeq ($(ARCH),i386) | ||
184 | ARCH := x86 | ||
185 | endif | ||
186 | ifeq ($(ARCH),x86_64) | ||
187 | ARCH := x86 | ||
188 | endif | ||
189 | |||
190 | $(shell sh -c 'mkdir -p $(OUTPUT)arch/$(ARCH)/util/' 2> /dev/null) | ||
191 | |||
165 | # CFLAGS and LDFLAGS are for the users to override from the command line. | 192 | # CFLAGS and LDFLAGS are for the users to override from the command line. |
166 | 193 | ||
167 | # | 194 | # |
@@ -274,7 +301,7 @@ endif | |||
274 | # Those must not be GNU-specific; they are shared with perl/ which may | 301 | # Those must not be GNU-specific; they are shared with perl/ which may |
275 | # be built by a different compiler. (Note that this is an artifact now | 302 | # be built by a different compiler. (Note that this is an artifact now |
276 | # but it still might be nice to keep that distinction.) | 303 | # but it still might be nice to keep that distinction.) |
277 | BASIC_CFLAGS = -Iutil/include | 304 | BASIC_CFLAGS = -Iutil/include -Iarch/$(ARCH)/include |
278 | BASIC_LDFLAGS = | 305 | BASIC_LDFLAGS = |
279 | 306 | ||
280 | # Guard against environment variables | 307 | # Guard against environment variables |
@@ -308,7 +335,7 @@ PROGRAMS += $(EXTRA_PROGRAMS) | |||
308 | # | 335 | # |
309 | # Single 'perf' binary right now: | 336 | # Single 'perf' binary right now: |
310 | # | 337 | # |
311 | PROGRAMS += perf | 338 | PROGRAMS += $(OUTPUT)perf |
312 | 339 | ||
313 | # List built-in command $C whose implementation cmd_$C() is not in | 340 | # List built-in command $C whose implementation cmd_$C() is not in |
314 | # builtin-$C.o but is linked in as part of some other command. | 341 | # builtin-$C.o but is linked in as part of some other command. |
@@ -318,7 +345,7 @@ PROGRAMS += perf | |||
318 | ALL_PROGRAMS = $(PROGRAMS) $(SCRIPTS) | 345 | ALL_PROGRAMS = $(PROGRAMS) $(SCRIPTS) |
319 | 346 | ||
320 | # what 'all' will build but not install in perfexecdir | 347 | # what 'all' will build but not install in perfexecdir |
321 | OTHER_PROGRAMS = perf$X | 348 | OTHER_PROGRAMS = $(OUTPUT)perf$X |
322 | 349 | ||
323 | # Set paths to tools early so that they can be used for version tests. | 350 | # Set paths to tools early so that they can be used for version tests. |
324 | ifndef SHELL_PATH | 351 | ifndef SHELL_PATH |
@@ -330,7 +357,7 @@ endif | |||
330 | 357 | ||
331 | export PERL_PATH | 358 | export PERL_PATH |
332 | 359 | ||
333 | LIB_FILE=libperf.a | 360 | LIB_FILE=$(OUTPUT)libperf.a |
334 | 361 | ||
335 | LIB_H += ../../include/linux/perf_event.h | 362 | LIB_H += ../../include/linux/perf_event.h |
336 | LIB_H += ../../include/linux/rbtree.h | 363 | LIB_H += ../../include/linux/rbtree.h |
@@ -350,12 +377,13 @@ LIB_H += util/include/linux/rbtree.h | |||
350 | LIB_H += util/include/linux/string.h | 377 | LIB_H += util/include/linux/string.h |
351 | LIB_H += util/include/linux/types.h | 378 | LIB_H += util/include/linux/types.h |
352 | LIB_H += util/include/asm/asm-offsets.h | 379 | LIB_H += util/include/asm/asm-offsets.h |
353 | LIB_H += util/include/asm/bitops.h | ||
354 | LIB_H += util/include/asm/bug.h | 380 | LIB_H += util/include/asm/bug.h |
355 | LIB_H += util/include/asm/byteorder.h | 381 | LIB_H += util/include/asm/byteorder.h |
382 | LIB_H += util/include/asm/hweight.h | ||
356 | LIB_H += util/include/asm/swab.h | 383 | LIB_H += util/include/asm/swab.h |
357 | LIB_H += util/include/asm/system.h | 384 | LIB_H += util/include/asm/system.h |
358 | LIB_H += util/include/asm/uaccess.h | 385 | LIB_H += util/include/asm/uaccess.h |
386 | LIB_H += util/include/dwarf-regs.h | ||
359 | LIB_H += perf.h | 387 | LIB_H += perf.h |
360 | LIB_H += util/cache.h | 388 | LIB_H += util/cache.h |
361 | LIB_H += util/callchain.h | 389 | LIB_H += util/callchain.h |
@@ -375,7 +403,6 @@ LIB_H += util/header.h | |||
375 | LIB_H += util/help.h | 403 | LIB_H += util/help.h |
376 | LIB_H += util/session.h | 404 | LIB_H += util/session.h |
377 | LIB_H += util/strbuf.h | 405 | LIB_H += util/strbuf.h |
378 | LIB_H += util/string.h | ||
379 | LIB_H += util/strlist.h | 406 | LIB_H += util/strlist.h |
380 | LIB_H += util/svghelper.h | 407 | LIB_H += util/svghelper.h |
381 | LIB_H += util/run-command.h | 408 | LIB_H += util/run-command.h |
@@ -389,79 +416,83 @@ LIB_H += util/thread.h | |||
389 | LIB_H += util/trace-event.h | 416 | LIB_H += util/trace-event.h |
390 | LIB_H += util/probe-finder.h | 417 | LIB_H += util/probe-finder.h |
391 | LIB_H += util/probe-event.h | 418 | LIB_H += util/probe-event.h |
419 | LIB_H += util/pstack.h | ||
392 | LIB_H += util/cpumap.h | 420 | LIB_H += util/cpumap.h |
393 | 421 | ||
394 | LIB_OBJS += util/abspath.o | 422 | LIB_OBJS += $(OUTPUT)util/abspath.o |
395 | LIB_OBJS += util/alias.o | 423 | LIB_OBJS += $(OUTPUT)util/alias.o |
396 | LIB_OBJS += util/build-id.o | 424 | LIB_OBJS += $(OUTPUT)util/build-id.o |
397 | LIB_OBJS += util/config.o | 425 | LIB_OBJS += $(OUTPUT)util/config.o |
398 | LIB_OBJS += util/ctype.o | 426 | LIB_OBJS += $(OUTPUT)util/ctype.o |
399 | LIB_OBJS += util/debugfs.o | 427 | LIB_OBJS += $(OUTPUT)util/debugfs.o |
400 | LIB_OBJS += util/environment.o | 428 | LIB_OBJS += $(OUTPUT)util/environment.o |
401 | LIB_OBJS += util/event.o | 429 | LIB_OBJS += $(OUTPUT)util/event.o |
402 | LIB_OBJS += util/exec_cmd.o | 430 | LIB_OBJS += $(OUTPUT)util/exec_cmd.o |
403 | LIB_OBJS += util/help.o | 431 | LIB_OBJS += $(OUTPUT)util/help.o |
404 | LIB_OBJS += util/levenshtein.o | 432 | LIB_OBJS += $(OUTPUT)util/levenshtein.o |
405 | LIB_OBJS += util/parse-options.o | 433 | LIB_OBJS += $(OUTPUT)util/parse-options.o |
406 | LIB_OBJS += util/parse-events.o | 434 | LIB_OBJS += $(OUTPUT)util/parse-events.o |
407 | LIB_OBJS += util/path.o | 435 | LIB_OBJS += $(OUTPUT)util/path.o |
408 | LIB_OBJS += util/rbtree.o | 436 | LIB_OBJS += $(OUTPUT)util/rbtree.o |
409 | LIB_OBJS += util/bitmap.o | 437 | LIB_OBJS += $(OUTPUT)util/bitmap.o |
410 | LIB_OBJS += util/hweight.o | 438 | LIB_OBJS += $(OUTPUT)util/hweight.o |
411 | LIB_OBJS += util/find_next_bit.o | 439 | LIB_OBJS += $(OUTPUT)util/run-command.o |
412 | LIB_OBJS += util/run-command.o | 440 | LIB_OBJS += $(OUTPUT)util/quote.o |
413 | LIB_OBJS += util/quote.o | 441 | LIB_OBJS += $(OUTPUT)util/strbuf.o |
414 | LIB_OBJS += util/strbuf.o | 442 | LIB_OBJS += $(OUTPUT)util/string.o |
415 | LIB_OBJS += util/string.o | 443 | LIB_OBJS += $(OUTPUT)util/strlist.o |
416 | LIB_OBJS += util/strlist.o | 444 | LIB_OBJS += $(OUTPUT)util/usage.o |
417 | LIB_OBJS += util/usage.o | 445 | LIB_OBJS += $(OUTPUT)util/wrapper.o |
418 | LIB_OBJS += util/wrapper.o | 446 | LIB_OBJS += $(OUTPUT)util/sigchain.o |
419 | LIB_OBJS += util/sigchain.o | 447 | LIB_OBJS += $(OUTPUT)util/symbol.o |
420 | LIB_OBJS += util/symbol.o | 448 | LIB_OBJS += $(OUTPUT)util/color.o |
421 | LIB_OBJS += util/color.o | 449 | LIB_OBJS += $(OUTPUT)util/pager.o |
422 | LIB_OBJS += util/pager.o | 450 | LIB_OBJS += $(OUTPUT)util/header.o |
423 | LIB_OBJS += util/header.o | 451 | LIB_OBJS += $(OUTPUT)util/callchain.o |
424 | LIB_OBJS += util/callchain.o | 452 | LIB_OBJS += $(OUTPUT)util/values.o |
425 | LIB_OBJS += util/values.o | 453 | LIB_OBJS += $(OUTPUT)util/debug.o |
426 | LIB_OBJS += util/debug.o | 454 | LIB_OBJS += $(OUTPUT)util/map.o |
427 | LIB_OBJS += util/map.o | 455 | LIB_OBJS += $(OUTPUT)util/pstack.o |
428 | LIB_OBJS += util/session.o | 456 | LIB_OBJS += $(OUTPUT)util/session.o |
429 | LIB_OBJS += util/thread.o | 457 | LIB_OBJS += $(OUTPUT)util/thread.o |
430 | LIB_OBJS += util/trace-event-parse.o | 458 | LIB_OBJS += $(OUTPUT)util/trace-event-parse.o |
431 | LIB_OBJS += util/trace-event-read.o | 459 | LIB_OBJS += $(OUTPUT)util/trace-event-read.o |
432 | LIB_OBJS += util/trace-event-info.o | 460 | LIB_OBJS += $(OUTPUT)util/trace-event-info.o |
433 | LIB_OBJS += util/trace-event-scripting.o | 461 | LIB_OBJS += $(OUTPUT)util/trace-event-scripting.o |
434 | LIB_OBJS += util/svghelper.o | 462 | LIB_OBJS += $(OUTPUT)util/svghelper.o |
435 | LIB_OBJS += util/sort.o | 463 | LIB_OBJS += $(OUTPUT)util/sort.o |
436 | LIB_OBJS += util/hist.o | 464 | LIB_OBJS += $(OUTPUT)util/hist.o |
437 | LIB_OBJS += util/probe-event.o | 465 | LIB_OBJS += $(OUTPUT)util/probe-event.o |
438 | LIB_OBJS += util/util.o | 466 | LIB_OBJS += $(OUTPUT)util/util.o |
439 | LIB_OBJS += util/cpumap.o | 467 | LIB_OBJS += $(OUTPUT)util/cpumap.o |
440 | 468 | ||
441 | BUILTIN_OBJS += builtin-annotate.o | 469 | BUILTIN_OBJS += $(OUTPUT)builtin-annotate.o |
442 | 470 | ||
443 | BUILTIN_OBJS += builtin-bench.o | 471 | BUILTIN_OBJS += $(OUTPUT)builtin-bench.o |
444 | 472 | ||
445 | # Benchmark modules | 473 | # Benchmark modules |
446 | BUILTIN_OBJS += bench/sched-messaging.o | 474 | BUILTIN_OBJS += $(OUTPUT)bench/sched-messaging.o |
447 | BUILTIN_OBJS += bench/sched-pipe.o | 475 | BUILTIN_OBJS += $(OUTPUT)bench/sched-pipe.o |
448 | BUILTIN_OBJS += bench/mem-memcpy.o | 476 | BUILTIN_OBJS += $(OUTPUT)bench/mem-memcpy.o |
449 | 477 | ||
450 | BUILTIN_OBJS += builtin-diff.o | 478 | BUILTIN_OBJS += $(OUTPUT)builtin-diff.o |
451 | BUILTIN_OBJS += builtin-help.o | 479 | BUILTIN_OBJS += $(OUTPUT)builtin-help.o |
452 | BUILTIN_OBJS += builtin-sched.o | 480 | BUILTIN_OBJS += $(OUTPUT)builtin-sched.o |
453 | BUILTIN_OBJS += builtin-buildid-list.o | 481 | BUILTIN_OBJS += $(OUTPUT)builtin-buildid-list.o |
454 | BUILTIN_OBJS += builtin-buildid-cache.o | 482 | BUILTIN_OBJS += $(OUTPUT)builtin-buildid-cache.o |
455 | BUILTIN_OBJS += builtin-list.o | 483 | BUILTIN_OBJS += $(OUTPUT)builtin-list.o |
456 | BUILTIN_OBJS += builtin-record.o | 484 | BUILTIN_OBJS += $(OUTPUT)builtin-record.o |
457 | BUILTIN_OBJS += builtin-report.o | 485 | BUILTIN_OBJS += $(OUTPUT)builtin-report.o |
458 | BUILTIN_OBJS += builtin-stat.o | 486 | BUILTIN_OBJS += $(OUTPUT)builtin-stat.o |
459 | BUILTIN_OBJS += builtin-timechart.o | 487 | BUILTIN_OBJS += $(OUTPUT)builtin-timechart.o |
460 | BUILTIN_OBJS += builtin-top.o | 488 | BUILTIN_OBJS += $(OUTPUT)builtin-top.o |
461 | BUILTIN_OBJS += builtin-trace.o | 489 | BUILTIN_OBJS += $(OUTPUT)builtin-trace.o |
462 | BUILTIN_OBJS += builtin-probe.o | 490 | BUILTIN_OBJS += $(OUTPUT)builtin-probe.o |
463 | BUILTIN_OBJS += builtin-kmem.o | 491 | BUILTIN_OBJS += $(OUTPUT)builtin-kmem.o |
464 | BUILTIN_OBJS += builtin-lock.o | 492 | BUILTIN_OBJS += $(OUTPUT)builtin-lock.o |
493 | BUILTIN_OBJS += $(OUTPUT)builtin-kvm.o | ||
494 | BUILTIN_OBJS += $(OUTPUT)builtin-test.o | ||
495 | BUILTIN_OBJS += $(OUTPUT)builtin-inject.o | ||
465 | 496 | ||
466 | PERFLIBS = $(LIB_FILE) | 497 | PERFLIBS = $(LIB_FILE) |
467 | 498 | ||
@@ -476,6 +507,15 @@ PERFLIBS = $(LIB_FILE) | |||
476 | -include config.mak.autogen | 507 | -include config.mak.autogen |
477 | -include config.mak | 508 | -include config.mak |
478 | 509 | ||
510 | ifndef NO_DWARF | ||
511 | ifneq ($(shell sh -c "(echo '\#include <dwarf.h>'; echo '\#include <libdw.h>'; echo '\#include <version.h>'; echo '\#ifndef _ELFUTILS_PREREQ'; echo '\#error'; echo '\#endif'; echo 'int main(void) { Dwarf *dbg; dbg = dwarf_begin(0, DWARF_C_READ); return (long)dbg; }') | $(CC) -x c - $(ALL_CFLAGS) -I/usr/include/elfutils -ldw -lelf -o $(BITBUCKET) $(ALL_LDFLAGS) $(EXTLIBS) "$(QUIET_STDERR)" && echo y"), y) | ||
512 | msg := $(warning No libdw.h found or old libdw.h found or elfutils is older than 0.138, disables dwarf support. Please install new elfutils-devel/libdw-dev); | ||
513 | NO_DWARF := 1 | ||
514 | endif # Dwarf support | ||
515 | endif # NO_DWARF | ||
516 | |||
517 | -include arch/$(ARCH)/Makefile | ||
518 | |||
479 | ifeq ($(uname_S),Darwin) | 519 | ifeq ($(uname_S),Darwin) |
480 | ifndef NO_FINK | 520 | ifndef NO_FINK |
481 | ifeq ($(shell test -d /sw/lib && echo y),y) | 521 | ifeq ($(shell test -d /sw/lib && echo y),y) |
@@ -492,6 +532,10 @@ ifeq ($(uname_S),Darwin) | |||
492 | PTHREAD_LIBS = | 532 | PTHREAD_LIBS = |
493 | endif | 533 | endif |
494 | 534 | ||
535 | ifneq ($(OUTPUT),) | ||
536 | BASIC_CFLAGS += -I$(OUTPUT) | ||
537 | endif | ||
538 | |||
495 | 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) -o $(BITBUCKET) $(ALL_LDFLAGS) $(EXTLIBS) "$(QUIET_STDERR)" && echo y"), y) | 539 | 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) -o $(BITBUCKET) $(ALL_LDFLAGS) $(EXTLIBS) "$(QUIET_STDERR)" && echo y"), y) |
496 | 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) -o $(BITBUCKET) $(ALL_LDFLAGS) $(EXTLIBS) "$(QUIET_STDERR)" && echo y"), y) | 540 | 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) -o $(BITBUCKET) $(ALL_LDFLAGS) $(EXTLIBS) "$(QUIET_STDERR)" && echo y"), y) |
497 | msg := $(error No gnu/libc-version.h found, please install glibc-dev[el]/glibc-static); | 541 | msg := $(error No gnu/libc-version.h found, please install glibc-dev[el]/glibc-static); |
@@ -504,14 +548,29 @@ else | |||
504 | msg := $(error No libelf.h/libelf found, please install libelf-dev/elfutils-libelf-devel and glibc-dev[el]); | 548 | msg := $(error No libelf.h/libelf found, please install libelf-dev/elfutils-libelf-devel and glibc-dev[el]); |
505 | endif | 549 | endif |
506 | 550 | ||
507 | ifneq ($(shell sh -c "(echo '\#include <dwarf.h>'; echo '\#include <libdw.h>'; echo 'int main(void) { Dwarf *dbg; dbg = dwarf_begin(0, DWARF_C_READ); return (long)dbg; }') | $(CC) -x c - $(ALL_CFLAGS) -I/usr/include/elfutils -ldw -lelf -o $(BITBUCKET) $(ALL_LDFLAGS) $(EXTLIBS) "$(QUIET_STDERR)" && echo y"), y) | 551 | ifndef NO_DWARF |
508 | msg := $(warning No libdw.h found or old libdw.h found, disables dwarf support. Please install elfutils-devel/elfutils-dev); | 552 | ifeq ($(origin PERF_HAVE_DWARF_REGS), undefined) |
509 | BASIC_CFLAGS += -DNO_DWARF_SUPPORT | 553 | msg := $(warning DWARF register mappings have not been defined for architecture $(ARCH), DWARF support disabled); |
510 | else | 554 | else |
511 | BASIC_CFLAGS += -I/usr/include/elfutils | 555 | BASIC_CFLAGS += -I/usr/include/elfutils -DDWARF_SUPPORT |
512 | EXTLIBS += -lelf -ldw | 556 | EXTLIBS += -lelf -ldw |
513 | LIB_OBJS += util/probe-finder.o | 557 | LIB_OBJS += $(OUTPUT)util/probe-finder.o |
558 | endif # PERF_HAVE_DWARF_REGS | ||
559 | endif # NO_DWARF | ||
560 | |||
561 | ifdef NO_NEWT | ||
562 | BASIC_CFLAGS += -DNO_NEWT_SUPPORT | ||
563 | else | ||
564 | ifneq ($(shell sh -c "(echo '\#include <newt.h>'; echo 'int main(void) { newtInit(); newtCls(); return newtFinished(); }') | $(CC) -x c - $(ALL_CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -lnewt -o $(BITBUCKET) $(ALL_LDFLAGS) $(EXTLIBS) "$(QUIET_STDERR)" && echo y"), y) | ||
565 | msg := $(warning newt not found, disables TUI support. Please install newt-devel or libnewt-dev); | ||
566 | BASIC_CFLAGS += -DNO_NEWT_SUPPORT | ||
567 | else | ||
568 | # Fedora has /usr/include/slang/slang.h, but ubuntu /usr/include/slang.h | ||
569 | BASIC_CFLAGS += -I/usr/include/slang | ||
570 | EXTLIBS += -lnewt -lslang | ||
571 | LIB_OBJS += $(OUTPUT)util/newt.o | ||
514 | endif | 572 | endif |
573 | endif # NO_NEWT | ||
515 | 574 | ||
516 | ifndef NO_LIBPERL | 575 | ifndef NO_LIBPERL |
517 | PERL_EMBED_LDOPTS = `perl -MExtUtils::Embed -e ldopts 2>/dev/null` | 576 | PERL_EMBED_LDOPTS = `perl -MExtUtils::Embed -e ldopts 2>/dev/null` |
@@ -522,8 +581,8 @@ ifneq ($(shell sh -c "(echo '\#include <EXTERN.h>'; echo '\#include <perl.h>'; e | |||
522 | BASIC_CFLAGS += -DNO_LIBPERL | 581 | BASIC_CFLAGS += -DNO_LIBPERL |
523 | else | 582 | else |
524 | ALL_LDFLAGS += $(PERL_EMBED_LDOPTS) | 583 | ALL_LDFLAGS += $(PERL_EMBED_LDOPTS) |
525 | LIB_OBJS += util/scripting-engines/trace-event-perl.o | 584 | LIB_OBJS += $(OUTPUT)util/scripting-engines/trace-event-perl.o |
526 | LIB_OBJS += scripts/perl/Perf-Trace-Util/Context.o | 585 | LIB_OBJS += $(OUTPUT)scripts/perl/Perf-Trace-Util/Context.o |
527 | endif | 586 | endif |
528 | 587 | ||
529 | ifndef NO_LIBPYTHON | 588 | ifndef NO_LIBPYTHON |
@@ -531,16 +590,19 @@ PYTHON_EMBED_LDOPTS = `python-config --ldflags 2>/dev/null` | |||
531 | PYTHON_EMBED_CCOPTS = `python-config --cflags 2>/dev/null` | 590 | PYTHON_EMBED_CCOPTS = `python-config --cflags 2>/dev/null` |
532 | endif | 591 | endif |
533 | 592 | ||
534 | ifneq ($(shell sh -c "(echo '\#include <Python.h>'; echo 'int main(void) { Py_Initialize(); return 0; }') | $(CC) -x c - $(PYTHON_EMBED_CCOPTS) -o /dev/null $(PYTHON_EMBED_LDOPTS) > /dev/null 2>&1 && echo y"), y) | 593 | ifneq ($(shell sh -c "(echo '\#include <Python.h>'; echo 'int main(void) { Py_Initialize(); return 0; }') | $(CC) -x c - $(PYTHON_EMBED_CCOPTS) -o $(BITBUCKET) $(PYTHON_EMBED_LDOPTS) > /dev/null 2>&1 && echo y"), y) |
535 | BASIC_CFLAGS += -DNO_LIBPYTHON | 594 | BASIC_CFLAGS += -DNO_LIBPYTHON |
536 | else | 595 | else |
537 | ALL_LDFLAGS += $(PYTHON_EMBED_LDOPTS) | 596 | ALL_LDFLAGS += $(PYTHON_EMBED_LDOPTS) |
538 | LIB_OBJS += util/scripting-engines/trace-event-python.o | 597 | LIB_OBJS += $(OUTPUT)util/scripting-engines/trace-event-python.o |
539 | LIB_OBJS += scripts/python/Perf-Trace-Util/Context.o | 598 | LIB_OBJS += $(OUTPUT)scripts/python/Perf-Trace-Util/Context.o |
540 | endif | 599 | endif |
541 | 600 | ||
542 | ifdef NO_DEMANGLE | 601 | ifdef NO_DEMANGLE |
543 | BASIC_CFLAGS += -DNO_DEMANGLE | 602 | BASIC_CFLAGS += -DNO_DEMANGLE |
603 | else ifdef HAVE_CPLUS_DEMANGLE | ||
604 | EXTLIBS += -liberty | ||
605 | BASIC_CFLAGS += -DHAVE_CPLUS_DEMANGLE | ||
544 | else | 606 | else |
545 | 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") | 607 | 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") |
546 | 608 | ||
@@ -607,53 +669,53 @@ ifdef NO_C99_FORMAT | |||
607 | endif | 669 | endif |
608 | ifdef SNPRINTF_RETURNS_BOGUS | 670 | ifdef SNPRINTF_RETURNS_BOGUS |
609 | COMPAT_CFLAGS += -DSNPRINTF_RETURNS_BOGUS | 671 | COMPAT_CFLAGS += -DSNPRINTF_RETURNS_BOGUS |
610 | COMPAT_OBJS += compat/snprintf.o | 672 | COMPAT_OBJS += $(OUTPUT)compat/snprintf.o |
611 | endif | 673 | endif |
612 | ifdef FREAD_READS_DIRECTORIES | 674 | ifdef FREAD_READS_DIRECTORIES |
613 | COMPAT_CFLAGS += -DFREAD_READS_DIRECTORIES | 675 | COMPAT_CFLAGS += -DFREAD_READS_DIRECTORIES |
614 | COMPAT_OBJS += compat/fopen.o | 676 | COMPAT_OBJS += $(OUTPUT)compat/fopen.o |
615 | endif | 677 | endif |
616 | ifdef NO_SYMLINK_HEAD | 678 | ifdef NO_SYMLINK_HEAD |
617 | BASIC_CFLAGS += -DNO_SYMLINK_HEAD | 679 | BASIC_CFLAGS += -DNO_SYMLINK_HEAD |
618 | endif | 680 | endif |
619 | ifdef NO_STRCASESTR | 681 | ifdef NO_STRCASESTR |
620 | COMPAT_CFLAGS += -DNO_STRCASESTR | 682 | COMPAT_CFLAGS += -DNO_STRCASESTR |
621 | COMPAT_OBJS += compat/strcasestr.o | 683 | COMPAT_OBJS += $(OUTPUT)compat/strcasestr.o |
622 | endif | 684 | endif |
623 | ifdef NO_STRTOUMAX | 685 | ifdef NO_STRTOUMAX |
624 | COMPAT_CFLAGS += -DNO_STRTOUMAX | 686 | COMPAT_CFLAGS += -DNO_STRTOUMAX |
625 | COMPAT_OBJS += compat/strtoumax.o | 687 | COMPAT_OBJS += $(OUTPUT)compat/strtoumax.o |
626 | endif | 688 | endif |
627 | ifdef NO_STRTOULL | 689 | ifdef NO_STRTOULL |
628 | COMPAT_CFLAGS += -DNO_STRTOULL | 690 | COMPAT_CFLAGS += -DNO_STRTOULL |
629 | endif | 691 | endif |
630 | ifdef NO_SETENV | 692 | ifdef NO_SETENV |
631 | COMPAT_CFLAGS += -DNO_SETENV | 693 | COMPAT_CFLAGS += -DNO_SETENV |
632 | COMPAT_OBJS += compat/setenv.o | 694 | COMPAT_OBJS += $(OUTPUT)compat/setenv.o |
633 | endif | 695 | endif |
634 | ifdef NO_MKDTEMP | 696 | ifdef NO_MKDTEMP |
635 | COMPAT_CFLAGS += -DNO_MKDTEMP | 697 | COMPAT_CFLAGS += -DNO_MKDTEMP |
636 | COMPAT_OBJS += compat/mkdtemp.o | 698 | COMPAT_OBJS += $(OUTPUT)compat/mkdtemp.o |
637 | endif | 699 | endif |
638 | ifdef NO_UNSETENV | 700 | ifdef NO_UNSETENV |
639 | COMPAT_CFLAGS += -DNO_UNSETENV | 701 | COMPAT_CFLAGS += -DNO_UNSETENV |
640 | COMPAT_OBJS += compat/unsetenv.o | 702 | COMPAT_OBJS += $(OUTPUT)compat/unsetenv.o |
641 | endif | 703 | endif |
642 | ifdef NO_SYS_SELECT_H | 704 | ifdef NO_SYS_SELECT_H |
643 | BASIC_CFLAGS += -DNO_SYS_SELECT_H | 705 | BASIC_CFLAGS += -DNO_SYS_SELECT_H |
644 | endif | 706 | endif |
645 | ifdef NO_MMAP | 707 | ifdef NO_MMAP |
646 | COMPAT_CFLAGS += -DNO_MMAP | 708 | COMPAT_CFLAGS += -DNO_MMAP |
647 | COMPAT_OBJS += compat/mmap.o | 709 | COMPAT_OBJS += $(OUTPUT)compat/mmap.o |
648 | else | 710 | else |
649 | ifdef USE_WIN32_MMAP | 711 | ifdef USE_WIN32_MMAP |
650 | COMPAT_CFLAGS += -DUSE_WIN32_MMAP | 712 | COMPAT_CFLAGS += -DUSE_WIN32_MMAP |
651 | COMPAT_OBJS += compat/win32mmap.o | 713 | COMPAT_OBJS += $(OUTPUT)compat/win32mmap.o |
652 | endif | 714 | endif |
653 | endif | 715 | endif |
654 | ifdef NO_PREAD | 716 | ifdef NO_PREAD |
655 | COMPAT_CFLAGS += -DNO_PREAD | 717 | COMPAT_CFLAGS += -DNO_PREAD |
656 | COMPAT_OBJS += compat/pread.o | 718 | COMPAT_OBJS += $(OUTPUT)compat/pread.o |
657 | endif | 719 | endif |
658 | ifdef NO_FAST_WORKING_DIRECTORY | 720 | ifdef NO_FAST_WORKING_DIRECTORY |
659 | BASIC_CFLAGS += -DNO_FAST_WORKING_DIRECTORY | 721 | BASIC_CFLAGS += -DNO_FAST_WORKING_DIRECTORY |
@@ -675,10 +737,10 @@ else | |||
675 | endif | 737 | endif |
676 | endif | 738 | endif |
677 | ifdef NO_INET_NTOP | 739 | ifdef NO_INET_NTOP |
678 | LIB_OBJS += compat/inet_ntop.o | 740 | LIB_OBJS += $(OUTPUT)compat/inet_ntop.o |
679 | endif | 741 | endif |
680 | ifdef NO_INET_PTON | 742 | ifdef NO_INET_PTON |
681 | LIB_OBJS += compat/inet_pton.o | 743 | LIB_OBJS += $(OUTPUT)compat/inet_pton.o |
682 | endif | 744 | endif |
683 | 745 | ||
684 | ifdef NO_ICONV | 746 | ifdef NO_ICONV |
@@ -695,15 +757,15 @@ endif | |||
695 | 757 | ||
696 | ifdef PPC_SHA1 | 758 | ifdef PPC_SHA1 |
697 | SHA1_HEADER = "ppc/sha1.h" | 759 | SHA1_HEADER = "ppc/sha1.h" |
698 | LIB_OBJS += ppc/sha1.o ppc/sha1ppc.o | 760 | LIB_OBJS += $(OUTPUT)ppc/sha1.o ppc/sha1ppc.o |
699 | else | 761 | else |
700 | ifdef ARM_SHA1 | 762 | ifdef ARM_SHA1 |
701 | SHA1_HEADER = "arm/sha1.h" | 763 | SHA1_HEADER = "arm/sha1.h" |
702 | LIB_OBJS += arm/sha1.o arm/sha1_arm.o | 764 | LIB_OBJS += $(OUTPUT)arm/sha1.o $(OUTPUT)arm/sha1_arm.o |
703 | else | 765 | else |
704 | ifdef MOZILLA_SHA1 | 766 | ifdef MOZILLA_SHA1 |
705 | SHA1_HEADER = "mozilla-sha1/sha1.h" | 767 | SHA1_HEADER = "mozilla-sha1/sha1.h" |
706 | LIB_OBJS += mozilla-sha1/sha1.o | 768 | LIB_OBJS += $(OUTPUT)mozilla-sha1/sha1.o |
707 | else | 769 | else |
708 | SHA1_HEADER = <openssl/sha.h> | 770 | SHA1_HEADER = <openssl/sha.h> |
709 | EXTLIBS += $(LIB_4_CRYPTO) | 771 | EXTLIBS += $(LIB_4_CRYPTO) |
@@ -715,15 +777,15 @@ ifdef NO_PERL_MAKEMAKER | |||
715 | endif | 777 | endif |
716 | ifdef NO_HSTRERROR | 778 | ifdef NO_HSTRERROR |
717 | COMPAT_CFLAGS += -DNO_HSTRERROR | 779 | COMPAT_CFLAGS += -DNO_HSTRERROR |
718 | COMPAT_OBJS += compat/hstrerror.o | 780 | COMPAT_OBJS += $(OUTPUT)compat/hstrerror.o |
719 | endif | 781 | endif |
720 | ifdef NO_MEMMEM | 782 | ifdef NO_MEMMEM |
721 | COMPAT_CFLAGS += -DNO_MEMMEM | 783 | COMPAT_CFLAGS += -DNO_MEMMEM |
722 | COMPAT_OBJS += compat/memmem.o | 784 | COMPAT_OBJS += $(OUTPUT)compat/memmem.o |
723 | endif | 785 | endif |
724 | ifdef INTERNAL_QSORT | 786 | ifdef INTERNAL_QSORT |
725 | COMPAT_CFLAGS += -DINTERNAL_QSORT | 787 | COMPAT_CFLAGS += -DINTERNAL_QSORT |
726 | COMPAT_OBJS += compat/qsort.o | 788 | COMPAT_OBJS += $(OUTPUT)compat/qsort.o |
727 | endif | 789 | endif |
728 | ifdef RUNTIME_PREFIX | 790 | ifdef RUNTIME_PREFIX |
729 | COMPAT_CFLAGS += -DRUNTIME_PREFIX | 791 | COMPAT_CFLAGS += -DRUNTIME_PREFIX |
@@ -803,7 +865,7 @@ export TAR INSTALL DESTDIR SHELL_PATH | |||
803 | 865 | ||
804 | SHELL = $(SHELL_PATH) | 866 | SHELL = $(SHELL_PATH) |
805 | 867 | ||
806 | all:: .perf.dev.null shell_compatibility_test $(ALL_PROGRAMS) $(BUILT_INS) $(OTHER_PROGRAMS) PERF-BUILD-OPTIONS | 868 | all:: .perf.dev.null shell_compatibility_test $(ALL_PROGRAMS) $(BUILT_INS) $(OTHER_PROGRAMS) $(OUTPUT)PERF-BUILD-OPTIONS |
807 | ifneq (,$X) | 869 | ifneq (,$X) |
808 | $(foreach p,$(patsubst %$X,%,$(filter %$X,$(ALL_PROGRAMS) $(BUILT_INS) perf$X)), test '$p' -ef '$p$X' || $(RM) '$p';) | 870 | $(foreach p,$(patsubst %$X,%,$(filter %$X,$(ALL_PROGRAMS) $(BUILT_INS) perf$X)), test '$p' -ef '$p$X' || $(RM) '$p';) |
809 | endif | 871 | endif |
@@ -815,39 +877,39 @@ please_set_SHELL_PATH_to_a_more_modern_shell: | |||
815 | 877 | ||
816 | shell_compatibility_test: please_set_SHELL_PATH_to_a_more_modern_shell | 878 | shell_compatibility_test: please_set_SHELL_PATH_to_a_more_modern_shell |
817 | 879 | ||
818 | strip: $(PROGRAMS) perf$X | 880 | strip: $(PROGRAMS) $(OUTPUT)perf$X |
819 | $(STRIP) $(STRIP_OPTS) $(PROGRAMS) perf$X | 881 | $(STRIP) $(STRIP_OPTS) $(PROGRAMS) $(OUTPUT)perf$X |
820 | 882 | ||
821 | perf.o: perf.c common-cmds.h PERF-CFLAGS | 883 | $(OUTPUT)perf.o: perf.c $(OUTPUT)common-cmds.h $(OUTPUT)PERF-CFLAGS |
822 | $(QUIET_CC)$(CC) -DPERF_VERSION='"$(PERF_VERSION)"' \ | 884 | $(QUIET_CC)$(CC) -DPERF_VERSION='"$(PERF_VERSION)"' \ |
823 | '-DPERF_HTML_PATH="$(htmldir_SQ)"' \ | 885 | '-DPERF_HTML_PATH="$(htmldir_SQ)"' \ |
824 | $(ALL_CFLAGS) -c $(filter %.c,$^) | 886 | $(ALL_CFLAGS) -c $(filter %.c,$^) -o $@ |
825 | 887 | ||
826 | perf$X: perf.o $(BUILTIN_OBJS) $(PERFLIBS) | 888 | $(OUTPUT)perf$X: $(OUTPUT)perf.o $(BUILTIN_OBJS) $(PERFLIBS) |
827 | $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ perf.o \ | 889 | $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(OUTPUT)perf.o \ |
828 | $(BUILTIN_OBJS) $(ALL_LDFLAGS) $(LIBS) | 890 | $(BUILTIN_OBJS) $(ALL_LDFLAGS) $(LIBS) |
829 | 891 | ||
830 | builtin-help.o: builtin-help.c common-cmds.h PERF-CFLAGS | 892 | $(OUTPUT)builtin-help.o: builtin-help.c $(OUTPUT)common-cmds.h $(OUTPUT)PERF-CFLAGS |
831 | $(QUIET_CC)$(CC) -o $*.o -c $(ALL_CFLAGS) \ | 893 | $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) \ |
832 | '-DPERF_HTML_PATH="$(htmldir_SQ)"' \ | 894 | '-DPERF_HTML_PATH="$(htmldir_SQ)"' \ |
833 | '-DPERF_MAN_PATH="$(mandir_SQ)"' \ | 895 | '-DPERF_MAN_PATH="$(mandir_SQ)"' \ |
834 | '-DPERF_INFO_PATH="$(infodir_SQ)"' $< | 896 | '-DPERF_INFO_PATH="$(infodir_SQ)"' $< |
835 | 897 | ||
836 | builtin-timechart.o: builtin-timechart.c common-cmds.h PERF-CFLAGS | 898 | $(OUTPUT)builtin-timechart.o: builtin-timechart.c $(OUTPUT)common-cmds.h $(OUTPUT)PERF-CFLAGS |
837 | $(QUIET_CC)$(CC) -o $*.o -c $(ALL_CFLAGS) \ | 899 | $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) \ |
838 | '-DPERF_HTML_PATH="$(htmldir_SQ)"' \ | 900 | '-DPERF_HTML_PATH="$(htmldir_SQ)"' \ |
839 | '-DPERF_MAN_PATH="$(mandir_SQ)"' \ | 901 | '-DPERF_MAN_PATH="$(mandir_SQ)"' \ |
840 | '-DPERF_INFO_PATH="$(infodir_SQ)"' $< | 902 | '-DPERF_INFO_PATH="$(infodir_SQ)"' $< |
841 | 903 | ||
842 | $(BUILT_INS): perf$X | 904 | $(BUILT_INS): $(OUTPUT)perf$X |
843 | $(QUIET_BUILT_IN)$(RM) $@ && \ | 905 | $(QUIET_BUILT_IN)$(RM) $@ && \ |
844 | ln perf$X $@ 2>/dev/null || \ | 906 | ln perf$X $@ 2>/dev/null || \ |
845 | ln -s perf$X $@ 2>/dev/null || \ | 907 | ln -s perf$X $@ 2>/dev/null || \ |
846 | cp perf$X $@ | 908 | cp perf$X $@ |
847 | 909 | ||
848 | common-cmds.h: util/generate-cmdlist.sh command-list.txt | 910 | $(OUTPUT)common-cmds.h: util/generate-cmdlist.sh command-list.txt |
849 | 911 | ||
850 | common-cmds.h: $(wildcard Documentation/perf-*.txt) | 912 | $(OUTPUT)common-cmds.h: $(wildcard Documentation/perf-*.txt) |
851 | $(QUIET_GEN). util/generate-cmdlist.sh > $@+ && mv $@+ $@ | 913 | $(QUIET_GEN). util/generate-cmdlist.sh > $@+ && mv $@+ $@ |
852 | 914 | ||
853 | $(patsubst %.sh,%,$(SCRIPT_SH)) : % : %.sh | 915 | $(patsubst %.sh,%,$(SCRIPT_SH)) : % : %.sh |
@@ -859,7 +921,7 @@ $(patsubst %.sh,%,$(SCRIPT_SH)) : % : %.sh | |||
859 | -e 's/@@NO_CURL@@/$(NO_CURL)/g' \ | 921 | -e 's/@@NO_CURL@@/$(NO_CURL)/g' \ |
860 | $@.sh >$@+ && \ | 922 | $@.sh >$@+ && \ |
861 | chmod +x $@+ && \ | 923 | chmod +x $@+ && \ |
862 | mv $@+ $@ | 924 | mv $@+ $(OUTPUT)$@ |
863 | 925 | ||
864 | configure: configure.ac | 926 | configure: configure.ac |
865 | $(QUIET_GEN)$(RM) $@ $<+ && \ | 927 | $(QUIET_GEN)$(RM) $@ $<+ && \ |
@@ -869,60 +931,50 @@ configure: configure.ac | |||
869 | $(RM) $<+ | 931 | $(RM) $<+ |
870 | 932 | ||
871 | # These can record PERF_VERSION | 933 | # These can record PERF_VERSION |
872 | perf.o perf.spec \ | 934 | $(OUTPUT)perf.o perf.spec \ |
873 | $(patsubst %.sh,%,$(SCRIPT_SH)) \ | 935 | $(patsubst %.sh,%,$(SCRIPT_SH)) \ |
874 | $(patsubst %.perl,%,$(SCRIPT_PERL)) \ | 936 | $(patsubst %.perl,%,$(SCRIPT_PERL)) \ |
875 | : PERF-VERSION-FILE | 937 | : $(OUTPUT)PERF-VERSION-FILE |
876 | 938 | ||
877 | %.o: %.c PERF-CFLAGS | 939 | $(OUTPUT)%.o: %.c $(OUTPUT)PERF-CFLAGS |
878 | $(QUIET_CC)$(CC) -o $*.o -c $(ALL_CFLAGS) $< | 940 | $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) $< |
879 | %.s: %.c PERF-CFLAGS | 941 | $(OUTPUT)%.s: %.c $(OUTPUT)PERF-CFLAGS |
880 | $(QUIET_CC)$(CC) -S $(ALL_CFLAGS) $< | 942 | $(QUIET_CC)$(CC) -S $(ALL_CFLAGS) $< |
881 | %.o: %.S | 943 | $(OUTPUT)%.o: %.S |
882 | $(QUIET_CC)$(CC) -o $*.o -c $(ALL_CFLAGS) $< | 944 | $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) $< |
883 | 945 | ||
884 | util/exec_cmd.o: util/exec_cmd.c PERF-CFLAGS | 946 | $(OUTPUT)util/exec_cmd.o: util/exec_cmd.c $(OUTPUT)PERF-CFLAGS |
885 | $(QUIET_CC)$(CC) -o $*.o -c $(ALL_CFLAGS) \ | 947 | $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) \ |
886 | '-DPERF_EXEC_PATH="$(perfexecdir_SQ)"' \ | 948 | '-DPERF_EXEC_PATH="$(perfexecdir_SQ)"' \ |
887 | '-DBINDIR="$(bindir_relative_SQ)"' \ | 949 | '-DBINDIR="$(bindir_relative_SQ)"' \ |
888 | '-DPREFIX="$(prefix_SQ)"' \ | 950 | '-DPREFIX="$(prefix_SQ)"' \ |
889 | $< | 951 | $< |
890 | 952 | ||
891 | builtin-init-db.o: builtin-init-db.c PERF-CFLAGS | 953 | $(OUTPUT)builtin-init-db.o: builtin-init-db.c $(OUTPUT)PERF-CFLAGS |
892 | $(QUIET_CC)$(CC) -o $*.o -c $(ALL_CFLAGS) -DDEFAULT_PERF_TEMPLATE_DIR='"$(template_dir_SQ)"' $< | 954 | $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -DDEFAULT_PERF_TEMPLATE_DIR='"$(template_dir_SQ)"' $< |
893 | |||
894 | util/config.o: util/config.c PERF-CFLAGS | ||
895 | $(QUIET_CC)$(CC) -o $*.o -c $(ALL_CFLAGS) -DETC_PERFCONFIG='"$(ETC_PERFCONFIG_SQ)"' $< | ||
896 | |||
897 | util/rbtree.o: ../../lib/rbtree.c PERF-CFLAGS | ||
898 | $(QUIET_CC)$(CC) -o util/rbtree.o -c $(ALL_CFLAGS) -DETC_PERFCONFIG='"$(ETC_PERFCONFIG_SQ)"' $< | ||
899 | |||
900 | # some perf warning policies can't fit to lib/bitmap.c, eg: it warns about variable shadowing | ||
901 | # from <string.h> that comes from kernel headers wrapping. | ||
902 | KBITMAP_FLAGS=`echo $(ALL_CFLAGS) | sed s/-Wshadow// | sed s/-Wswitch-default// | sed s/-Wextra//` | ||
903 | 955 | ||
904 | util/bitmap.o: ../../lib/bitmap.c PERF-CFLAGS | 956 | $(OUTPUT)util/config.o: util/config.c $(OUTPUT)PERF-CFLAGS |
905 | $(QUIET_CC)$(CC) -o util/bitmap.o -c $(KBITMAP_FLAGS) -DETC_PERFCONFIG='"$(ETC_PERFCONFIG_SQ)"' $< | 957 | $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -DETC_PERFCONFIG='"$(ETC_PERFCONFIG_SQ)"' $< |
906 | 958 | ||
907 | util/hweight.o: ../../lib/hweight.c PERF-CFLAGS | 959 | $(OUTPUT)util/newt.o: util/newt.c $(OUTPUT)PERF-CFLAGS |
908 | $(QUIET_CC)$(CC) -o util/hweight.o -c $(ALL_CFLAGS) -DETC_PERFCONFIG='"$(ETC_PERFCONFIG_SQ)"' $< | 960 | $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -DENABLE_SLFUTURE_CONST $< |
909 | 961 | ||
910 | util/find_next_bit.o: ../../lib/find_next_bit.c PERF-CFLAGS | 962 | $(OUTPUT)util/rbtree.o: ../../lib/rbtree.c $(OUTPUT)PERF-CFLAGS |
911 | $(QUIET_CC)$(CC) -o util/find_next_bit.o -c $(ALL_CFLAGS) -DETC_PERFCONFIG='"$(ETC_PERFCONFIG_SQ)"' $< | 963 | $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -DETC_PERFCONFIG='"$(ETC_PERFCONFIG_SQ)"' $< |
912 | 964 | ||
913 | util/scripting-engines/trace-event-perl.o: util/scripting-engines/trace-event-perl.c PERF-CFLAGS | 965 | $(OUTPUT)util/scripting-engines/trace-event-perl.o: util/scripting-engines/trace-event-perl.c $(OUTPUT)PERF-CFLAGS |
914 | $(QUIET_CC)$(CC) -o util/scripting-engines/trace-event-perl.o -c $(ALL_CFLAGS) $(PERL_EMBED_CCOPTS) -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter -Wno-shadow $< | 966 | $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) $(PERL_EMBED_CCOPTS) -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter -Wno-shadow $< |
915 | 967 | ||
916 | scripts/perl/Perf-Trace-Util/Context.o: scripts/perl/Perf-Trace-Util/Context.c PERF-CFLAGS | 968 | $(OUTPUT)scripts/perl/Perf-Trace-Util/Context.o: scripts/perl/Perf-Trace-Util/Context.c $(OUTPUT)PERF-CFLAGS |
917 | $(QUIET_CC)$(CC) -o scripts/perl/Perf-Trace-Util/Context.o -c $(ALL_CFLAGS) $(PERL_EMBED_CCOPTS) -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter -Wno-nested-externs $< | 969 | $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) $(PERL_EMBED_CCOPTS) -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter -Wno-nested-externs $< |
918 | 970 | ||
919 | util/scripting-engines/trace-event-python.o: util/scripting-engines/trace-event-python.c PERF-CFLAGS | 971 | $(OUTPUT)util/scripting-engines/trace-event-python.o: util/scripting-engines/trace-event-python.c $(OUTPUT)PERF-CFLAGS |
920 | $(QUIET_CC)$(CC) -o util/scripting-engines/trace-event-python.o -c $(ALL_CFLAGS) $(PYTHON_EMBED_CCOPTS) -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter -Wno-shadow $< | 972 | $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) $(PYTHON_EMBED_CCOPTS) -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter -Wno-shadow $< |
921 | 973 | ||
922 | scripts/python/Perf-Trace-Util/Context.o: scripts/python/Perf-Trace-Util/Context.c PERF-CFLAGS | 974 | $(OUTPUT)scripts/python/Perf-Trace-Util/Context.o: scripts/python/Perf-Trace-Util/Context.c $(OUTPUT)PERF-CFLAGS |
923 | $(QUIET_CC)$(CC) -o scripts/python/Perf-Trace-Util/Context.o -c $(ALL_CFLAGS) $(PYTHON_EMBED_CCOPTS) -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter -Wno-nested-externs $< | 975 | $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) $(PYTHON_EMBED_CCOPTS) -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter -Wno-nested-externs $< |
924 | 976 | ||
925 | perf-%$X: %.o $(PERFLIBS) | 977 | $(OUTPUT)perf-%$X: %.o $(PERFLIBS) |
926 | $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS) | 978 | $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS) |
927 | 979 | ||
928 | $(LIB_OBJS) $(BUILTIN_OBJS): $(LIB_H) | 980 | $(LIB_OBJS) $(BUILTIN_OBJS): $(LIB_H) |
@@ -963,17 +1015,17 @@ cscope: | |||
963 | TRACK_CFLAGS = $(subst ','\'',$(ALL_CFLAGS)):\ | 1015 | TRACK_CFLAGS = $(subst ','\'',$(ALL_CFLAGS)):\ |
964 | $(bindir_SQ):$(perfexecdir_SQ):$(template_dir_SQ):$(prefix_SQ) | 1016 | $(bindir_SQ):$(perfexecdir_SQ):$(template_dir_SQ):$(prefix_SQ) |
965 | 1017 | ||
966 | PERF-CFLAGS: .FORCE-PERF-CFLAGS | 1018 | $(OUTPUT)PERF-CFLAGS: .FORCE-PERF-CFLAGS |
967 | @FLAGS='$(TRACK_CFLAGS)'; \ | 1019 | @FLAGS='$(TRACK_CFLAGS)'; \ |
968 | if test x"$$FLAGS" != x"`cat PERF-CFLAGS 2>/dev/null`" ; then \ | 1020 | if test x"$$FLAGS" != x"`cat $(OUTPUT)PERF-CFLAGS 2>/dev/null`" ; then \ |
969 | echo 1>&2 " * new build flags or prefix"; \ | 1021 | echo 1>&2 " * new build flags or prefix"; \ |
970 | echo "$$FLAGS" >PERF-CFLAGS; \ | 1022 | echo "$$FLAGS" >$(OUTPUT)PERF-CFLAGS; \ |
971 | fi | 1023 | fi |
972 | 1024 | ||
973 | # We need to apply sq twice, once to protect from the shell | 1025 | # We need to apply sq twice, once to protect from the shell |
974 | # that runs PERF-BUILD-OPTIONS, and then again to protect it | 1026 | # that runs $(OUTPUT)PERF-BUILD-OPTIONS, and then again to protect it |
975 | # and the first level quoting from the shell that runs "echo". | 1027 | # and the first level quoting from the shell that runs "echo". |
976 | PERF-BUILD-OPTIONS: .FORCE-PERF-BUILD-OPTIONS | 1028 | $(OUTPUT)PERF-BUILD-OPTIONS: .FORCE-PERF-BUILD-OPTIONS |
977 | @echo SHELL_PATH=\''$(subst ','\'',$(SHELL_PATH_SQ))'\' >$@ | 1029 | @echo SHELL_PATH=\''$(subst ','\'',$(SHELL_PATH_SQ))'\' >$@ |
978 | @echo TAR=\''$(subst ','\'',$(subst ','\'',$(TAR)))'\' >>$@ | 1030 | @echo TAR=\''$(subst ','\'',$(subst ','\'',$(TAR)))'\' >>$@ |
979 | @echo NO_CURL=\''$(subst ','\'',$(subst ','\'',$(NO_CURL)))'\' >>$@ | 1031 | @echo NO_CURL=\''$(subst ','\'',$(subst ','\'',$(NO_CURL)))'\' >>$@ |
@@ -994,7 +1046,7 @@ all:: $(TEST_PROGRAMS) | |||
994 | 1046 | ||
995 | export NO_SVN_TESTS | 1047 | export NO_SVN_TESTS |
996 | 1048 | ||
997 | check: common-cmds.h | 1049 | check: $(OUTPUT)common-cmds.h |
998 | if sparse; \ | 1050 | if sparse; \ |
999 | then \ | 1051 | then \ |
1000 | for i in *.c */*.c; \ | 1052 | for i in *.c */*.c; \ |
@@ -1028,10 +1080,10 @@ export perfexec_instdir | |||
1028 | 1080 | ||
1029 | install: all | 1081 | install: all |
1030 | $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(bindir_SQ)' | 1082 | $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(bindir_SQ)' |
1031 | $(INSTALL) perf$X '$(DESTDIR_SQ)$(bindir_SQ)' | 1083 | $(INSTALL) $(OUTPUT)perf$X '$(DESTDIR_SQ)$(bindir_SQ)' |
1032 | $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/Perf-Trace-Util/lib/Perf/Trace' | 1084 | $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/Perf-Trace-Util/lib/Perf/Trace' |
1033 | $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/bin' | 1085 | $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/bin' |
1034 | $(INSTALL) perf-archive -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)' | 1086 | $(INSTALL) $(OUTPUT)perf-archive -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)' |
1035 | $(INSTALL) scripts/perl/Perf-Trace-Util/lib/Perf/Trace/* -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/Perf-Trace-Util/lib/Perf/Trace' | 1087 | $(INSTALL) scripts/perl/Perf-Trace-Util/lib/Perf/Trace/* -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/Perf-Trace-Util/lib/Perf/Trace' |
1036 | $(INSTALL) scripts/perl/*.pl -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl' | 1088 | $(INSTALL) scripts/perl/*.pl -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl' |
1037 | $(INSTALL) scripts/perl/bin/* -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/bin' | 1089 | $(INSTALL) scripts/perl/bin/* -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/bin' |
@@ -1045,7 +1097,7 @@ ifdef BUILT_INS | |||
1045 | $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)' | 1097 | $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)' |
1046 | $(INSTALL) $(BUILT_INS) '$(DESTDIR_SQ)$(perfexec_instdir_SQ)' | 1098 | $(INSTALL) $(BUILT_INS) '$(DESTDIR_SQ)$(perfexec_instdir_SQ)' |
1047 | ifneq (,$X) | 1099 | ifneq (,$X) |
1048 | $(foreach p,$(patsubst %$X,%,$(filter %$X,$(ALL_PROGRAMS) $(BUILT_INS) perf$X)), $(RM) '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/$p';) | 1100 | $(foreach p,$(patsubst %$X,%,$(filter %$X,$(ALL_PROGRAMS) $(BUILT_INS) $(OUTPUT)perf$X)), $(RM) '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/$p';) |
1049 | endif | 1101 | endif |
1050 | endif | 1102 | endif |
1051 | 1103 | ||
@@ -1129,14 +1181,14 @@ clean: | |||
1129 | $(RM) *.o */*.o */*/*.o */*/*/*.o $(LIB_FILE) | 1181 | $(RM) *.o */*.o */*/*.o */*/*/*.o $(LIB_FILE) |
1130 | $(RM) $(ALL_PROGRAMS) $(BUILT_INS) perf$X | 1182 | $(RM) $(ALL_PROGRAMS) $(BUILT_INS) perf$X |
1131 | $(RM) $(TEST_PROGRAMS) | 1183 | $(RM) $(TEST_PROGRAMS) |
1132 | $(RM) *.spec *.pyc *.pyo */*.pyc */*.pyo common-cmds.h TAGS tags cscope* | 1184 | $(RM) *.spec *.pyc *.pyo */*.pyc */*.pyo $(OUTPUT)common-cmds.h TAGS tags cscope* |
1133 | $(RM) -r autom4te.cache | 1185 | $(RM) -r autom4te.cache |
1134 | $(RM) config.log config.mak.autogen config.mak.append config.status config.cache | 1186 | $(RM) config.log config.mak.autogen config.mak.append config.status config.cache |
1135 | $(RM) -r $(PERF_TARNAME) .doc-tmp-dir | 1187 | $(RM) -r $(PERF_TARNAME) .doc-tmp-dir |
1136 | $(RM) $(PERF_TARNAME).tar.gz perf-core_$(PERF_VERSION)-*.tar.gz | 1188 | $(RM) $(PERF_TARNAME).tar.gz perf-core_$(PERF_VERSION)-*.tar.gz |
1137 | $(RM) $(htmldocs).tar.gz $(manpages).tar.gz | 1189 | $(RM) $(htmldocs).tar.gz $(manpages).tar.gz |
1138 | $(MAKE) -C Documentation/ clean | 1190 | $(MAKE) -C Documentation/ clean |
1139 | $(RM) PERF-VERSION-FILE PERF-CFLAGS PERF-BUILD-OPTIONS | 1191 | $(RM) $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)PERF-CFLAGS $(OUTPUT)PERF-BUILD-OPTIONS |
1140 | 1192 | ||
1141 | .PHONY: all install clean strip | 1193 | .PHONY: all install clean strip |
1142 | .PHONY: shell_compatibility_test please_set_SHELL_PATH_to_a_more_modern_shell | 1194 | .PHONY: shell_compatibility_test please_set_SHELL_PATH_to_a_more_modern_shell |