aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/Makefile')
-rw-r--r--tools/perf/Makefile388
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 @@
1ifeq ("$(origin O)", "command line")
2 OUTPUT := $(O)/
3endif
4
1# The default target of this Makefile is... 5# The default target of this Makefile is...
2all:: 6all::
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
154PERF-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
158uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not') 169uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')
159uname_M := $(shell sh -c 'uname -m 2>/dev/null || echo not') 170uname_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')
162uname_P := $(shell sh -c 'uname -p 2>/dev/null || echo not') 173uname_P := $(shell sh -c 'uname -p 2>/dev/null || echo not')
163uname_V := $(shell sh -c 'uname -v 2>/dev/null || echo not') 174uname_V := $(shell sh -c 'uname -v 2>/dev/null || echo not')
164 175
176ARCH ?= $(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
183ifeq ($(ARCH),i386)
184 ARCH := x86
185endif
186ifeq ($(ARCH),x86_64)
187 ARCH := x86
188endif
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.)
277BASIC_CFLAGS = -Iutil/include 304BASIC_CFLAGS = -Iutil/include -Iarch/$(ARCH)/include
278BASIC_LDFLAGS = 305BASIC_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#
311PROGRAMS += perf 338PROGRAMS += $(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
318ALL_PROGRAMS = $(PROGRAMS) $(SCRIPTS) 345ALL_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
321OTHER_PROGRAMS = perf$X 348OTHER_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.
324ifndef SHELL_PATH 351ifndef SHELL_PATH
@@ -330,7 +357,7 @@ endif
330 357
331export PERL_PATH 358export PERL_PATH
332 359
333LIB_FILE=libperf.a 360LIB_FILE=$(OUTPUT)libperf.a
334 361
335LIB_H += ../../include/linux/perf_event.h 362LIB_H += ../../include/linux/perf_event.h
336LIB_H += ../../include/linux/rbtree.h 363LIB_H += ../../include/linux/rbtree.h
@@ -350,12 +377,13 @@ LIB_H += util/include/linux/rbtree.h
350LIB_H += util/include/linux/string.h 377LIB_H += util/include/linux/string.h
351LIB_H += util/include/linux/types.h 378LIB_H += util/include/linux/types.h
352LIB_H += util/include/asm/asm-offsets.h 379LIB_H += util/include/asm/asm-offsets.h
353LIB_H += util/include/asm/bitops.h
354LIB_H += util/include/asm/bug.h 380LIB_H += util/include/asm/bug.h
355LIB_H += util/include/asm/byteorder.h 381LIB_H += util/include/asm/byteorder.h
382LIB_H += util/include/asm/hweight.h
356LIB_H += util/include/asm/swab.h 383LIB_H += util/include/asm/swab.h
357LIB_H += util/include/asm/system.h 384LIB_H += util/include/asm/system.h
358LIB_H += util/include/asm/uaccess.h 385LIB_H += util/include/asm/uaccess.h
386LIB_H += util/include/dwarf-regs.h
359LIB_H += perf.h 387LIB_H += perf.h
360LIB_H += util/cache.h 388LIB_H += util/cache.h
361LIB_H += util/callchain.h 389LIB_H += util/callchain.h
@@ -375,7 +403,6 @@ LIB_H += util/header.h
375LIB_H += util/help.h 403LIB_H += util/help.h
376LIB_H += util/session.h 404LIB_H += util/session.h
377LIB_H += util/strbuf.h 405LIB_H += util/strbuf.h
378LIB_H += util/string.h
379LIB_H += util/strlist.h 406LIB_H += util/strlist.h
380LIB_H += util/svghelper.h 407LIB_H += util/svghelper.h
381LIB_H += util/run-command.h 408LIB_H += util/run-command.h
@@ -389,79 +416,83 @@ LIB_H += util/thread.h
389LIB_H += util/trace-event.h 416LIB_H += util/trace-event.h
390LIB_H += util/probe-finder.h 417LIB_H += util/probe-finder.h
391LIB_H += util/probe-event.h 418LIB_H += util/probe-event.h
419LIB_H += util/pstack.h
392LIB_H += util/cpumap.h 420LIB_H += util/cpumap.h
393 421
394LIB_OBJS += util/abspath.o 422LIB_OBJS += $(OUTPUT)util/abspath.o
395LIB_OBJS += util/alias.o 423LIB_OBJS += $(OUTPUT)util/alias.o
396LIB_OBJS += util/build-id.o 424LIB_OBJS += $(OUTPUT)util/build-id.o
397LIB_OBJS += util/config.o 425LIB_OBJS += $(OUTPUT)util/config.o
398LIB_OBJS += util/ctype.o 426LIB_OBJS += $(OUTPUT)util/ctype.o
399LIB_OBJS += util/debugfs.o 427LIB_OBJS += $(OUTPUT)util/debugfs.o
400LIB_OBJS += util/environment.o 428LIB_OBJS += $(OUTPUT)util/environment.o
401LIB_OBJS += util/event.o 429LIB_OBJS += $(OUTPUT)util/event.o
402LIB_OBJS += util/exec_cmd.o 430LIB_OBJS += $(OUTPUT)util/exec_cmd.o
403LIB_OBJS += util/help.o 431LIB_OBJS += $(OUTPUT)util/help.o
404LIB_OBJS += util/levenshtein.o 432LIB_OBJS += $(OUTPUT)util/levenshtein.o
405LIB_OBJS += util/parse-options.o 433LIB_OBJS += $(OUTPUT)util/parse-options.o
406LIB_OBJS += util/parse-events.o 434LIB_OBJS += $(OUTPUT)util/parse-events.o
407LIB_OBJS += util/path.o 435LIB_OBJS += $(OUTPUT)util/path.o
408LIB_OBJS += util/rbtree.o 436LIB_OBJS += $(OUTPUT)util/rbtree.o
409LIB_OBJS += util/bitmap.o 437LIB_OBJS += $(OUTPUT)util/bitmap.o
410LIB_OBJS += util/hweight.o 438LIB_OBJS += $(OUTPUT)util/hweight.o
411LIB_OBJS += util/find_next_bit.o 439LIB_OBJS += $(OUTPUT)util/run-command.o
412LIB_OBJS += util/run-command.o 440LIB_OBJS += $(OUTPUT)util/quote.o
413LIB_OBJS += util/quote.o 441LIB_OBJS += $(OUTPUT)util/strbuf.o
414LIB_OBJS += util/strbuf.o 442LIB_OBJS += $(OUTPUT)util/string.o
415LIB_OBJS += util/string.o 443LIB_OBJS += $(OUTPUT)util/strlist.o
416LIB_OBJS += util/strlist.o 444LIB_OBJS += $(OUTPUT)util/usage.o
417LIB_OBJS += util/usage.o 445LIB_OBJS += $(OUTPUT)util/wrapper.o
418LIB_OBJS += util/wrapper.o 446LIB_OBJS += $(OUTPUT)util/sigchain.o
419LIB_OBJS += util/sigchain.o 447LIB_OBJS += $(OUTPUT)util/symbol.o
420LIB_OBJS += util/symbol.o 448LIB_OBJS += $(OUTPUT)util/color.o
421LIB_OBJS += util/color.o 449LIB_OBJS += $(OUTPUT)util/pager.o
422LIB_OBJS += util/pager.o 450LIB_OBJS += $(OUTPUT)util/header.o
423LIB_OBJS += util/header.o 451LIB_OBJS += $(OUTPUT)util/callchain.o
424LIB_OBJS += util/callchain.o 452LIB_OBJS += $(OUTPUT)util/values.o
425LIB_OBJS += util/values.o 453LIB_OBJS += $(OUTPUT)util/debug.o
426LIB_OBJS += util/debug.o 454LIB_OBJS += $(OUTPUT)util/map.o
427LIB_OBJS += util/map.o 455LIB_OBJS += $(OUTPUT)util/pstack.o
428LIB_OBJS += util/session.o 456LIB_OBJS += $(OUTPUT)util/session.o
429LIB_OBJS += util/thread.o 457LIB_OBJS += $(OUTPUT)util/thread.o
430LIB_OBJS += util/trace-event-parse.o 458LIB_OBJS += $(OUTPUT)util/trace-event-parse.o
431LIB_OBJS += util/trace-event-read.o 459LIB_OBJS += $(OUTPUT)util/trace-event-read.o
432LIB_OBJS += util/trace-event-info.o 460LIB_OBJS += $(OUTPUT)util/trace-event-info.o
433LIB_OBJS += util/trace-event-scripting.o 461LIB_OBJS += $(OUTPUT)util/trace-event-scripting.o
434LIB_OBJS += util/svghelper.o 462LIB_OBJS += $(OUTPUT)util/svghelper.o
435LIB_OBJS += util/sort.o 463LIB_OBJS += $(OUTPUT)util/sort.o
436LIB_OBJS += util/hist.o 464LIB_OBJS += $(OUTPUT)util/hist.o
437LIB_OBJS += util/probe-event.o 465LIB_OBJS += $(OUTPUT)util/probe-event.o
438LIB_OBJS += util/util.o 466LIB_OBJS += $(OUTPUT)util/util.o
439LIB_OBJS += util/cpumap.o 467LIB_OBJS += $(OUTPUT)util/cpumap.o
440 468
441BUILTIN_OBJS += builtin-annotate.o 469BUILTIN_OBJS += $(OUTPUT)builtin-annotate.o
442 470
443BUILTIN_OBJS += builtin-bench.o 471BUILTIN_OBJS += $(OUTPUT)builtin-bench.o
444 472
445# Benchmark modules 473# Benchmark modules
446BUILTIN_OBJS += bench/sched-messaging.o 474BUILTIN_OBJS += $(OUTPUT)bench/sched-messaging.o
447BUILTIN_OBJS += bench/sched-pipe.o 475BUILTIN_OBJS += $(OUTPUT)bench/sched-pipe.o
448BUILTIN_OBJS += bench/mem-memcpy.o 476BUILTIN_OBJS += $(OUTPUT)bench/mem-memcpy.o
449 477
450BUILTIN_OBJS += builtin-diff.o 478BUILTIN_OBJS += $(OUTPUT)builtin-diff.o
451BUILTIN_OBJS += builtin-help.o 479BUILTIN_OBJS += $(OUTPUT)builtin-help.o
452BUILTIN_OBJS += builtin-sched.o 480BUILTIN_OBJS += $(OUTPUT)builtin-sched.o
453BUILTIN_OBJS += builtin-buildid-list.o 481BUILTIN_OBJS += $(OUTPUT)builtin-buildid-list.o
454BUILTIN_OBJS += builtin-buildid-cache.o 482BUILTIN_OBJS += $(OUTPUT)builtin-buildid-cache.o
455BUILTIN_OBJS += builtin-list.o 483BUILTIN_OBJS += $(OUTPUT)builtin-list.o
456BUILTIN_OBJS += builtin-record.o 484BUILTIN_OBJS += $(OUTPUT)builtin-record.o
457BUILTIN_OBJS += builtin-report.o 485BUILTIN_OBJS += $(OUTPUT)builtin-report.o
458BUILTIN_OBJS += builtin-stat.o 486BUILTIN_OBJS += $(OUTPUT)builtin-stat.o
459BUILTIN_OBJS += builtin-timechart.o 487BUILTIN_OBJS += $(OUTPUT)builtin-timechart.o
460BUILTIN_OBJS += builtin-top.o 488BUILTIN_OBJS += $(OUTPUT)builtin-top.o
461BUILTIN_OBJS += builtin-trace.o 489BUILTIN_OBJS += $(OUTPUT)builtin-trace.o
462BUILTIN_OBJS += builtin-probe.o 490BUILTIN_OBJS += $(OUTPUT)builtin-probe.o
463BUILTIN_OBJS += builtin-kmem.o 491BUILTIN_OBJS += $(OUTPUT)builtin-kmem.o
464BUILTIN_OBJS += builtin-lock.o 492BUILTIN_OBJS += $(OUTPUT)builtin-lock.o
493BUILTIN_OBJS += $(OUTPUT)builtin-kvm.o
494BUILTIN_OBJS += $(OUTPUT)builtin-test.o
495BUILTIN_OBJS += $(OUTPUT)builtin-inject.o
465 496
466PERFLIBS = $(LIB_FILE) 497PERFLIBS = $(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
510ifndef NO_DWARF
511ifneq ($(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
514endif # Dwarf support
515endif # NO_DWARF
516
517-include arch/$(ARCH)/Makefile
518
479ifeq ($(uname_S),Darwin) 519ifeq ($(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 =
493endif 533endif
494 534
535ifneq ($(OUTPUT),)
536 BASIC_CFLAGS += -I$(OUTPUT)
537endif
538
495ifeq ($(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) 539ifeq ($(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)
496ifneq ($(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) 540ifneq ($(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]);
505endif 549endif
506 550
507ifneq ($(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) 551ifndef NO_DWARF
508 msg := $(warning No libdw.h found or old libdw.h found, disables dwarf support. Please install elfutils-devel/elfutils-dev); 552ifeq ($(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);
510else 554else
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
558endif # PERF_HAVE_DWARF_REGS
559endif # NO_DWARF
560
561ifdef NO_NEWT
562 BASIC_CFLAGS += -DNO_NEWT_SUPPORT
563else
564ifneq ($(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
567else
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
514endif 572endif
573endif # NO_NEWT
515 574
516ifndef NO_LIBPERL 575ifndef NO_LIBPERL
517PERL_EMBED_LDOPTS = `perl -MExtUtils::Embed -e ldopts 2>/dev/null` 576PERL_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
523else 582else
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
527endif 586endif
528 587
529ifndef NO_LIBPYTHON 588ifndef NO_LIBPYTHON
@@ -531,16 +590,19 @@ PYTHON_EMBED_LDOPTS = `python-config --ldflags 2>/dev/null`
531PYTHON_EMBED_CCOPTS = `python-config --cflags 2>/dev/null` 590PYTHON_EMBED_CCOPTS = `python-config --cflags 2>/dev/null`
532endif 591endif
533 592
534ifneq ($(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) 593ifneq ($(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
536else 595else
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
540endif 599endif
541 600
542ifdef NO_DEMANGLE 601ifdef NO_DEMANGLE
543 BASIC_CFLAGS += -DNO_DEMANGLE 602 BASIC_CFLAGS += -DNO_DEMANGLE
603else ifdef HAVE_CPLUS_DEMANGLE
604 EXTLIBS += -liberty
605 BASIC_CFLAGS += -DHAVE_CPLUS_DEMANGLE
544else 606else
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
607endif 669endif
608ifdef SNPRINTF_RETURNS_BOGUS 670ifdef 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
611endif 673endif
612ifdef FREAD_READS_DIRECTORIES 674ifdef 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
615endif 677endif
616ifdef NO_SYMLINK_HEAD 678ifdef NO_SYMLINK_HEAD
617 BASIC_CFLAGS += -DNO_SYMLINK_HEAD 679 BASIC_CFLAGS += -DNO_SYMLINK_HEAD
618endif 680endif
619ifdef NO_STRCASESTR 681ifdef 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
622endif 684endif
623ifdef NO_STRTOUMAX 685ifdef 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
626endif 688endif
627ifdef NO_STRTOULL 689ifdef NO_STRTOULL
628 COMPAT_CFLAGS += -DNO_STRTOULL 690 COMPAT_CFLAGS += -DNO_STRTOULL
629endif 691endif
630ifdef NO_SETENV 692ifdef 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
633endif 695endif
634ifdef NO_MKDTEMP 696ifdef 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
637endif 699endif
638ifdef NO_UNSETENV 700ifdef 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
641endif 703endif
642ifdef NO_SYS_SELECT_H 704ifdef NO_SYS_SELECT_H
643 BASIC_CFLAGS += -DNO_SYS_SELECT_H 705 BASIC_CFLAGS += -DNO_SYS_SELECT_H
644endif 706endif
645ifdef NO_MMAP 707ifdef 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
648else 710else
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
653endif 715endif
654ifdef NO_PREAD 716ifdef 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
657endif 719endif
658ifdef NO_FAST_WORKING_DIRECTORY 720ifdef NO_FAST_WORKING_DIRECTORY
659 BASIC_CFLAGS += -DNO_FAST_WORKING_DIRECTORY 721 BASIC_CFLAGS += -DNO_FAST_WORKING_DIRECTORY
@@ -675,10 +737,10 @@ else
675endif 737endif
676endif 738endif
677ifdef NO_INET_NTOP 739ifdef NO_INET_NTOP
678 LIB_OBJS += compat/inet_ntop.o 740 LIB_OBJS += $(OUTPUT)compat/inet_ntop.o
679endif 741endif
680ifdef NO_INET_PTON 742ifdef NO_INET_PTON
681 LIB_OBJS += compat/inet_pton.o 743 LIB_OBJS += $(OUTPUT)compat/inet_pton.o
682endif 744endif
683 745
684ifdef NO_ICONV 746ifdef NO_ICONV
@@ -695,15 +757,15 @@ endif
695 757
696ifdef PPC_SHA1 758ifdef 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
699else 761else
700ifdef ARM_SHA1 762ifdef 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
703else 765else
704ifdef MOZILLA_SHA1 766ifdef 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
707else 769else
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
715endif 777endif
716ifdef NO_HSTRERROR 778ifdef 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
719endif 781endif
720ifdef NO_MEMMEM 782ifdef 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
723endif 785endif
724ifdef INTERNAL_QSORT 786ifdef 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
727endif 789endif
728ifdef RUNTIME_PREFIX 790ifdef RUNTIME_PREFIX
729 COMPAT_CFLAGS += -DRUNTIME_PREFIX 791 COMPAT_CFLAGS += -DRUNTIME_PREFIX
@@ -803,7 +865,7 @@ export TAR INSTALL DESTDIR SHELL_PATH
803 865
804SHELL = $(SHELL_PATH) 866SHELL = $(SHELL_PATH)
805 867
806all:: .perf.dev.null shell_compatibility_test $(ALL_PROGRAMS) $(BUILT_INS) $(OTHER_PROGRAMS) PERF-BUILD-OPTIONS 868all:: .perf.dev.null shell_compatibility_test $(ALL_PROGRAMS) $(BUILT_INS) $(OTHER_PROGRAMS) $(OUTPUT)PERF-BUILD-OPTIONS
807ifneq (,$X) 869ifneq (,$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';)
809endif 871endif
@@ -815,39 +877,39 @@ please_set_SHELL_PATH_to_a_more_modern_shell:
815 877
816shell_compatibility_test: please_set_SHELL_PATH_to_a_more_modern_shell 878shell_compatibility_test: please_set_SHELL_PATH_to_a_more_modern_shell
817 879
818strip: $(PROGRAMS) perf$X 880strip: $(PROGRAMS) $(OUTPUT)perf$X
819 $(STRIP) $(STRIP_OPTS) $(PROGRAMS) perf$X 881 $(STRIP) $(STRIP_OPTS) $(PROGRAMS) $(OUTPUT)perf$X
820 882
821perf.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
826perf$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
830builtin-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
836builtin-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
848common-cmds.h: util/generate-cmdlist.sh command-list.txt 910$(OUTPUT)common-cmds.h: util/generate-cmdlist.sh command-list.txt
849 911
850common-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
864configure: configure.ac 926configure: 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
872perf.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
884util/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
891builtin-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
894util/config.o: util/config.c PERF-CFLAGS
895 $(QUIET_CC)$(CC) -o $*.o -c $(ALL_CFLAGS) -DETC_PERFCONFIG='"$(ETC_PERFCONFIG_SQ)"' $<
896
897util/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.
902KBITMAP_FLAGS=`echo $(ALL_CFLAGS) | sed s/-Wshadow// | sed s/-Wswitch-default// | sed s/-Wextra//`
903 955
904util/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
907util/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
910util/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
913util/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
916scripts/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
919util/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
922scripts/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
925perf-%$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:
963TRACK_CFLAGS = $(subst ','\'',$(ALL_CFLAGS)):\ 1015TRACK_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
966PERF-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".
976PERF-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
995export NO_SVN_TESTS 1047export NO_SVN_TESTS
996 1048
997check: common-cmds.h 1049check: $(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
1029install: all 1081install: 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)'
1047ifneq (,$X) 1099ifneq (,$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';)
1049endif 1101endif
1050endif 1102endif
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