new file mode 100644
@@ -0,0 +1,47 @@
+obj-y += perf.o
+
+obj-$(CONFIG_BUILTIN_ANNOTATE) += builtin-annotate.o
+obj-$(CONFIG_BUILTIN_BENCH) += builtin-bench.o
+obj-$(CONFIG_BUILTIN_BENCH) += bench/
+obj-$(CONFIG_BUILTIN_BUILDID_CACHE) += builtin-buildid-cache.o
+obj-$(CONFIG_BUILTIN_BUILDID_LIST) += builtin-buildid-list.o
+obj-$(CONFIG_BUILTIN_DIFF) += builtin-diff.o
+obj-$(CONFIG_BUILTIN_EVLIST) += builtin-evlist.o
+obj-$(CONFIG_BUILTIN_HELP) += builtin-help.o
+obj-$(CONFIG_BUILTIN_INJECT) += builtin-inject.o
+obj-$(CONFIG_BUILTIN_KMEM) += builtin-kmem.o
+obj-$(CONFIG_BUILTIN_KVM) += builtin-kvm.o
+obj-$(CONFIG_BUILTIN_LIST) += builtin-list.o
+obj-$(CONFIG_BUILTIN_LOCK) += builtin-lock.o
+obj-$(CONFIG_BUILTIN_PROBE) += builtin-probe.o
+obj-$(CONFIG_BUILTIN_RECORD) += builtin-record.o
+obj-$(CONFIG_BUILTIN_REPORT) += builtin-report.o
+obj-$(CONFIG_BUILTIN_SCHED) += builtin-sched.o
+obj-$(CONFIG_BUILTIN_SCRIPT) += builtin-script.o
+obj-$(CONFIG_BUILTIN_STAT) += builtin-stat.o
+obj-$(CONFIG_BUILTIN_TIMECHART) += builtin-timechart.o
+obj-$(CONFIG_BUILTIN_TOP) += builtin-top.o
+obj-$(CONFIG_BUILTIN_TRACE) += builtin-trace.o
+obj-$(CONFIG_BUILTIN_MEM) += builtin-mem.o
+obj-$(CONFIG_BUILTIN_TEST) += tests/
+
+obj-y += ../../lib/rbtree.o
+
+obj-y += util/
+obj-y += ui/
+obj-y += arch/
+
+obj-$(CONFIG_LIBPERL) += scripts/perl/Perf-Trace-Util/
+obj-$(CONFIG_LIBPYTHON) += scripts/python/Perf-Trace-Util/
+
+
+CFLAGS_rbtree.o += -Wno-unused-parameter
+
+CFLAGS_perf.o += -D"PERF_HTML_PATH=KBUILD_STR($(htmldir_SQ))"
+CFLAGS_perf.o += -include PERF-VERSION-FILE
+
+$(obj)/perf.o: $(obj)/PERF-VERSION-FILE
+
+CFLAGS_builtin-help.o += -D"PERF_HTML_PATH=KBUILD_STR($(htmldir_SQ))"
+CFLAGS_builtin-help.o += -D"PERF_INFO_PATH=KBUILD_STR($(infodir_SQ))"
+CFLAGS_builtin-help.o += -D"PERF_MAN_PATH=KBUILD_STR($(mandir_SQ))"
new file mode 100644
@@ -0,0 +1,273 @@
+
+mainmenu "The perf configuration"
+
+menu "Built-in commands"
+
+config BUILTIN_RECORD
+ bool "record"
+ default y
+ ---help---
+ Run a command and record its profile into a perf archive.
+
+config BUILTIN_REPORT
+ bool "report"
+ default y
+ ---help---
+ Read a perf archive (created by perf record) and display the
+ profile.
+
+config BUILTIN_STAT
+ bool "stat"
+ default y
+ ---help---
+ Run a command and gather performance counter statistics.
+
+config BUILTIN_TOP
+ bool "top"
+ default n
+ ---help---
+ Generate and display a performance counter profile in
+ real-time.
+
+config BUILTIN_TRACE
+ bool "trace"
+ default n
+ depends on CONFIG_LIBAUDIT
+ ---help---
+ Strace inspired tool.
+
+config BUILTIN_ANNOTATE
+ bool "annotate"
+ default n
+ ---help---
+ Read a perf archive (created by perf record) and display
+ annotated code.
+
+config BUILTIN_BENCH
+ bool "bench"
+ default n
+ ---help---
+ General framework for benchmark suites.
+
+config BUILTIN_BUILDID_CACHE
+ bool "buildid-cache"
+ default n
+ ---help---
+ Manage build-id cache.
+
+config BUILTIN_BUILDID_LIST
+ bool "buildid-list"
+ default n
+ ---help---
+ List the buildids in a perf archive file.
+
+config BUILTIN_DIFF
+ bool "diff"
+ default y
+ ---help---
+ Read perf archive files and display the differential
+ profile.
+
+config BUILTIN_EVLIST
+ bool "evlist"
+ default n
+ ---help---
+ List the event names in a perf archive file
+
+config BUILTIN_HELP
+ bool "help"
+ default y
+ ---help---
+ Display help information about perf
+
+config BUILTIN_INJECT
+ bool "inject"
+ default n
+ ---help---
+ The inject feature reads a perf-record event stream and
+ repipes it to stdout.
+
+config BUILTIN_KMEM
+ bool "kmem"
+ default n
+ ---help---
+ Tool to trace/measure kernel memory(slab) properties.
+
+config BUILTIN_KVM
+ bool "kvm"
+ default n
+ ---help---
+ Tool to trace/measure kvm guest os
+
+config BUILTIN_LIST
+ bool "list"
+ default n
+ ---help---
+ List all symbolic event types.
+
+config BUILTIN_LOCK
+ bool "lock"
+ default n
+ ---help---
+ Analyze lock events.
+
+config BUILTIN_PROBE
+ bool "probe"
+ default n
+ depends on LIBELF
+ ---help---
+ Define new dynamic tracepoints
+
+config BUILTIN_SCHED
+ bool "sched"
+ default n
+ ---help---
+ Tool to trace/measure scheduler properties (latencies).
+
+config BUILTIN_SCRIPT
+ bool "script"
+ default y
+ ---help---
+ Read perf archive file (created by perf record) and display
+ trace output.
+
+config BUILTIN_TIMECHART
+ bool "timechart"
+ default n
+ ---help---
+ Tool to visualize total system behavior during a workload.
+
+config BUILTIN_MEM
+ bool "mem"
+ default y
+ ---help---
+ Profile memory accesses.
+
+config BUILTIN_TEST
+ bool "test"
+ default y
+ ---help---
+ Runs sanity tests.
+
+endmenu
+
+menu "Libraries"
+
+config LIBAUDIT
+ bool "Audit (libaudit)"
+ default n
+ ---help---
+ Linux audit framework dependency.
+
+config LIBPERL
+ bool "Perl"
+ default n
+ ---help---
+ Libperl dependency needed by the perf script feature.
+
+config LIBPYTHON
+ bool "Python"
+ default n
+ ---help---
+ Libpython dependency needed by the perf script feature.
+
+choice
+ prompt "Elf library"
+ default LIBELF
+ ---help---
+ Perf needs ELF files manipulation facilities. To fulfill
+ these tasks, perf can rely on either the libelf library or a
+ minimal builtin support.
+
+
+ config LIBELF
+ bool "elf"
+ ---help---
+ Libelf library.
+
+ config LIBELF_MINIMAL
+ bool "builtin support"
+ ---help---
+ Builtin elf support.
+endchoice
+
+config LIBUNWIND
+ bool "User space libunwind callchains"
+ ---help---
+ The library libunwind provides a portable C API to determine
+ the call-chain of a program.
+
+config LIBUNWIND_DIR
+ string "libunwind directory"
+ depends on LIBUNWIND
+ ---help---
+ Directory holding the libuwind dependency (headers +
+ libraries).
+
+config NUMA
+ bool "Numa support (bench)"
+ default n
+ ---help---
+ The library libnuma offers facilities to configure NUMA
+ policies supported by the linux kernel.
+
+config DEMANGLE
+ bool "Demangle symbols"
+ default n
+ ---help---
+ Enable demangling so as to display human-readable
+ symbols. This option is convenient with C++ programs.
+
+config BIONIC
+ bool "Bionic support"
+ default n
+ ---help---
+ The Bionic libc is a derivation of the BSD's standard C
+ library code developed by Google for their Android operating
+ system.
+
+endmenu
+
+menu "GUI"
+
+config STDIO
+ bool "Terminal"
+ default y
+ ---help---
+ Most basic display mode.
+
+config TUI
+ bool "Tui (newt based)"
+ default n
+ ---help---
+ Text-based user interface which provides windowing
+ facilities.
+
+config GTK2
+ bool "Gtk2"
+ default n
+ ---help---
+ Elaborate display mode based on libgtk2.
+
+endmenu
+
+menu "Build"
+config DEBUG
+ bool "Compile with debug info"
+ default n
+ ---help---
+ Compile with debug info.
+
+config DEBUG_PARSER
+ bool "Compile with parsers debug info"
+ default n
+ ---help---
+ Compile with parsers debug info.
+
+config BACKTRACE
+ bool "Compile with dump_stack support"
+ default n
+ ---help---
+ Compile with dump_stack support.
+
+endmenu
new file mode 100644
@@ -0,0 +1,407 @@
+srctree := $(abspath $(if $(KBUILD_SRC),$(KBUILD_SRC),$(CURDIR)/../../))
+objtree := $(abspath $(if $(KBUILD_SRC),$(CURDIR),$(CURDIR)/../..))
+
+VPATH := $(srctree)
+
+export srctree VPATH
+
+MAKEFLAGS += --include-dir=$(srctree)
+MAKEFLAGS += --no-builtin-rules
+MAKEFLAGS += --no-print-directory
+
+ifeq ("$(origin V)", "command line")
+KBUILD_VERBOSE = $(V)
+endif
+
+ifndef KBUILD_VERBOSE
+KBUILD_VERBOSE = 0
+endif
+
+ifeq ($(KBUILD_VERBOSE),1)
+quiet =
+Q =
+else
+quiet=quiet_
+Q = @
+endif
+
+# If the user is running make -s (silent mode), suppress echoing of
+# commands
+ifneq ($(filter s% -s%,$(MAKEFLAGS)),)
+quiet=silent_
+endif
+
+export quiet Q KBUILD_VERBOSE
+
+ifndef V
+QUIET_LINK = @echo ' LD $@';
+QUIET_GEN = @echo ' GEN $@';
+QUIET_CLEAN = @echo ' CLEAN tools/perf';
+endif
+
+export QUIET_BISON QUIET_FLEX
+
+ifeq ($(KBUILD_SRC),)
+
+ifeq ("$(origin O)", "command line")
+KBUILD_OUTPUT := $(O)
+else
+KBUILD_OUTPUT := $(objtree)
+endif
+
+# Invoke a second make in the output directory, passing relevant variables
+# check that the output directory actually exists
+saved-output := $(KBUILD_OUTPUT)
+KBUILD_OUTPUT := $(shell cd $(KBUILD_OUTPUT) && /bin/pwd)
+$(if $(KBUILD_OUTPUT),, \
+ $(error output directory "$(saved-output)" does not exist))
+
+dummy := $(shell mkdir -p $(KBUILD_OUTPUT)/lib)
+dummy := $(shell mkdir -p $(KBUILD_OUTPUT)/include/config)
+dummy := $(shell mkdir -p $(KBUILD_OUTPUT)/tools/perf)
+
+PHONY += $(MAKECMDGOALS) sub-make
+
+$(filter-out sub-make $(CURDIR)/Makefile, $(MAKECMDGOALS)) all: sub-make
+ @:
+
+sub-make: FORCE
+ $(if $(KBUILD_VERBOSE:1=),@)$(MAKE) -C $(KBUILD_OUTPUT) \
+ KBUILD_SRC=$(srctree) \
+ -f $(CURDIR)/Makefile.kbuild \
+ $(filter-out sub-make,$(MAKECMDGOALS))
+
+# Leave processing to above invocation of make
+skip-makefile := 1
+endif # ifeq ($(KBUILD_SRC),)
+
+export KBUILD_SRC
+
+ifeq ($(skip-makefile),)
+
+build := -f $(srctree)/scripts/Makefile.build obj
+
+src-kernel := $(srctree)
+src-perf := $(srctree)/tools/perf
+obj-kernel := $(objtree)
+obj-perf := $(objtree)/tools/perf
+
+VPATH += $(src-perf)
+
+export src-perf obj-perf
+
+OUTPUT := $(obj-perf)
+
+export OUTPUT
+
+AS = as
+LD = ld
+CC = gcc
+CPP = $(CC) -E
+HOSTCC = gcc
+FLEX = flex
+BISON = bison
+INSTALL = install
+
+export AS LD CC CPP HOSTCC FLEX BISON
+
+# kbuild related config
+CONFIG_SHELL := /bin/sh
+
+KBUILD_KCONFIG := $(src-perf)/Kconfig
+KCONFIG_CONFIG ?= $(obj-perf)/.config
+KCONFIG_TRISTATE := $(obj-perf)/include/config/tristate.conf
+KCONFIG_AUTOHEADER := $(obj-perf)/include/generated/autoconf.h
+KCONFIG_AUTOCONFIG := $(obj-perf)/include/config/auto.conf
+KCONFIG_SCRIPT := $(srctree)/scripts/config --file $(KCONFIG_CONFIG)
+
+export CONFIG_SHELL
+export KBUILD_KCONFIG
+export KCONFIG_CONFIG KCONFIG_TRISTATE
+export KCONFIG_AUTOHEADER KCONFIG_AUTOCONFIG KCONFIG_SCRIPT
+
+# perf detected config
+CONFIG_DETECTED := $(obj-perf)/.config-detected
+
+export CONFIG_DETECTED
+
+# external .a libs
+LK_DIR := $(srctree)/tools/lib/lk/
+TRACE_EVENT_DIR := $(srctree)/tools/lib/traceevent/
+
+LIBTRACEEVENT := $(obj-kernel)/tools/lib/traceevent/libtraceevent.a
+LIBLK := $(obj-kernel)/tools/lib/lk/liblk.a
+LIBS_A := $(LIBTRACEEVENT) $(LIBLK)
+
+export TRACE_EVENT_DIR LK_DIR LIBTRACEEVENT LIBLK
+
+all:
+
+scripts_basic:
+ $(Q)$(MAKE) $(build)=scripts/basic
+
+defconfig: scripts_basic
+ $(Q)cp $(src-perf)/config/defconfig $(KCONFIG_CONFIG)
+ $(Q)$(MAKE) -s $(build)=scripts/kconfig oldconfig
+
+%config: scripts_basic
+ $(Q)$(MAKE) -s $(build)=scripts/kconfig $@
+
+$(KCONFIG_CONFIG):
+ $(Q)$(MAKE) $(build)=scripts/basic
+ $(Q)$(MAKE) -s $(build)=scripts/kconfig allyesconfig
+
+$(CONFIG_DETECTED): $(KCONFIG_CONFIG)
+ $(Q)$(MAKE) -f $(src-perf)/config/Makefile
+
+# no need to include auto.conf.cmd, because .config
+# is the only dependency here
+$(KCONFIG_AUTOCONFIG): $(KCONFIG_CONFIG) $(CONFIG_DETECTED)
+ $(Q)$(MAKE) -f $(src-perf)/config/Makefile.fix-config
+ $(Q)mkdir -p $(obj-perf)/include/config
+ $(Q)mkdir -p $(obj-perf)/include/generated
+ $(Q)$(MAKE) -s $(build)=scripts/kconfig silentoldconfig
+ @touch $(CONFIG_DETECTED) # final touch.. to keep the time dependency correct
+
+clean-dirs := $(addprefix _clean_, tools/perf/)
+
+$(clean-dirs):
+ $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.clean obj=$(patsubst _clean_%,%,$@)
+
+clean: $(clean-dirs) $(LIBTRACEEVENT)-clean $(LIBLK)-clean
+ $(Q)$(QUIET_CLEAN)
+ $(Q)rm -f $(obj-perf)/perf
+ $(Q)rm -f $(obj-perf)/common-cmds.h
+ $(Q)rm -f $(obj-perf)/python/perf.so
+ $(Q)rm -rf $(obj-perf)/include/generated $(obj-perf)/include/config
+ $(Q)find $(obj-perf) \
+ \( -name '*.[oas]' -o -name '.*.cmd' \
+ -o -name '.*.d' -o -name '.*.tmp' \
+ -o -name '*-flex.[ch]' -o -name '*-bison.[ch]' \
+ \) -type f -print | xargs rm -f
+ $(Q)$(python-clean)
+ $(Q)rm -f $(CONFIG_DETECTED) $(KCONFIG_CONFIG)
+
+TAGS tags:
+ $(Q)rm -f $(src-perf)/tags
+ $(QUIET_GEN)cd $(src-perf); find . -name '*.[hcS]' -print | xargs ctags -a
+
+cscope:
+ $(Q)rm -f $(src-perf)/cscope*
+ $(QUIET_GEN)cd $(src-perf); find . -name '*.[hcS]' -print | xargs cscope -b
+
+PHONY += clean $(clean-dirs) tags TAGS cscope
+
+ifneq ($(filter %config help clean tags TAGS cscope,$(MAKECMDGOALS)),)
+dont-detect := 1
+endif
+
+ifndef dont-detect
+# detected config variables
+include $(CONFIG_DETECTED)
+
+# Following variables are needed within Kbuild files, we need
+# to export them as they are not part of the .config set.
+export CONFIG_ARCH := $(ARCH)
+export CONFIG_X86_64
+export htmldir_SQ
+export infodir_SQ
+export mandir_SQ
+export perfexecdir_SQ
+export prefix_SQ
+export PARSER_DEBUG_BISON
+export PARSER_DEBUG_FLEX
+export ETC_PERFCONFIG_SQ
+export PYTHON_EMBED_CCOPTS
+export PERL_EMBED_CCOPTS
+endif
+
+# let sources know it's kbuild
+CFLAGS += -DCONFIG_KBUILD
+
+# kbuild related config
+LINUXINCLUDE := $(CFLAGS)
+KBUILD_BUILTIN := 1
+KBUILD_CHECKSRC := 0
+
+export LINUXINCLUDE
+export KBUILD_BUILTIN KBUILD_CHECKSRC
+
+# pyuthon language binding
+PYTHON_EXTBUILD := $(src-perf)/python_ext_build/
+PYTHON_EXTBUILD_LIB := $(PYTHON_EXTBUILD)lib/
+PYTHON_EXTBUILD_TMP := $(PYTHON_EXTBUILD)tmp/
+
+export PYTHON_EXTBUILD_LIB PYTHON_EXTBUILD_TMP
+
+python-clean := rm -rf $(PYTHON_EXTBUILD) $(obj-perf)/python/perf.so
+
+PYTHON_EXT_SRCS := $(addprefix $(src-perf)/,$(shell grep -v ^\# $(src-perf)/util/python-ext-sources))
+PYTHON_EXT_DEPS := $(src-perf)/util/python-ext-sources $(src-perf)/util/setup.py
+PYTHON_EXT_CFLAGS := $(CFLAGS) -w
+
+export PYTHON_EXT_SRCS
+
+
+$(obj-perf)/python/perf.so: $(PYTHON_EXT_SRCS) $(PYTHON_EXT_DEPS)
+ $(QUIET_GEN)CFLAGS='$(PYTHON_EXT_CFLAGS)' $(PYTHON_WORD) $(src-perf)/util/setup.py \
+ --quiet build_ext; \
+ mkdir -p $(obj-perf)/python && \
+ cp $(PYTHON_EXTBUILD_LIB)perf.so $(obj-perf)/python/
+
+all: tools/perf/PERF-VERSION-FILE scripts_basic $(KCONFIG_AUTOCONFIG) tools/perf/perf $(LANG_BINDINGS)
+
+$(obj-perf)/common-cmds.h: $(src-perf)/util/generate-cmdlist.sh $(src-perf)/command-list.txt
+ $(QUIET_GEN)$(src-perf)/util/generate-cmdlist.sh $(src-perf) > $@+ && mv $@+ $@
+
+PHONY += all scripts_basic
+
+$(obj-perf)/built-in.o: $(obj-perf)/common-cmds.h FORCE
+ $(Q)$(MAKE) $(build)=tools/perf
+
+LIBS = -Wl,--whole-archive $^ -Wl,--no-whole-archive -Wl,--start-group $(EXTLIBS) -Wl,--end-group
+
+tools/perf/perf: $(obj-perf)/built-in.o $(LIBS_A)
+ $(QUIET_LINK)$(CC) $(LDFLAGS) -o $@ $(LIBS)
+
+$(LIBTRACEEVENT): FORCE
+ @mkdir -p $(obj-kernel)/tools/lib/traceevent
+ $(Q)$(MAKE) -C $(src-kernel)/tools/lib/traceevent O=$(obj-kernel)/tools/lib/traceevent
+
+$(LIBTRACEEVENT)-clean: FORCE
+ @mkdir -p $(obj-kernel)/tools/lib/traceevent
+ $(Q)$(MAKE) -sC $(srctree)/tools/lib/traceevent O=$(obj-kernel)/tools/lib/traceevent clean
+
+PHONY += $(TRACE_EVENT_DIR) $(TRACE_EVENT_DIR)-clean
+
+$(LIBLK): FORCE
+ @mkdir -p $(obj-kernel)/tools/lib/lk
+ $(Q)$(MAKE) -C $(srctree)/tools/lib/lk O=$(obj-kernel)/tools/lib/lk
+
+$(LIBLK)-clean: FORCE
+ @mkdir -p $(obj-kernel)/tools/lib/lk
+ $(Q)$(MAKE) -sC $(srctree)/tools/lib/lk O=$(obj-kernel)/tools/lib/lk clean
+
+tools/perf/PERF-VERSION-FILE: FORCE
+ $(QUIET_GEN)$(SHELL_PATH) $(src-perf)/util/PERF-VERSION-GEN $(obj-perf)/
+
+
+# Single targets
+# ---------------------------------------------------------------------------
+# Single targets are compatible with:
+# - build with mixed source and output
+# - build with separate output dir 'make O=...'
+# - external modules
+#
+# target-dir => where to store outputfile
+# build-dir => directory in kernel source tree to use
+
+build-dir = $(patsubst $(obj-kernel)/%,%,$(abspath $(obj-perf)/$(patsubst %/,%,$(dir $@))))
+target-dir = $(patsubst $(obj-kernel)/%,%,$(abspath $(obj-perf)/$(dir $@)))
+
+%.o: %.c scripts_basic FORCE
+ $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)/$(notdir $@)
+%.s: %.c scripts_basic FORCE
+ $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)/$(notdir $@)
+%.i: %.c scripts_basic FORCE
+ $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)/$(notdir $@)
+%.s: %.S scripts_basic FORCE
+ $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)/$(notdir $@)
+%.o: %.S scripts_basic FORCE
+ $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)/$(notdir $@)
+
+SCRIPT_SH += $(src-perf)/perf-archive.sh
+SCRIPTS = $(patsubst %.sh,%,$(SCRIPT_SH))
+
+$(SCRIPTS) : % : %.sh
+ $(QUIET_GEN)$(INSTALL) '$@.sh' '$(perf-obj)$@'
+
+all: $(SCRIPTS)
+
+install-bin: all
+ $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(bindir_SQ)'
+ $(INSTALL) $(obj-perf)/perf '$(DESTDIR_SQ)$(bindir_SQ)'
+ $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/Perf-Trace-Util/lib/Perf/Trace'
+ $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/bin'
+ $(INSTALL) $(src-perf)/perf-archive -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)'
+ $(INSTALL) $(src-perf)/scripts/perl/Perf-Trace-Util/lib/Perf/Trace/* -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/Perf-Trace-Util/lib/Perf/Trace'
+ $(INSTALL) $(src-perf)/scripts/perl/*.pl -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl'
+ $(INSTALL) $(src-perf)/scripts/perl/bin/* -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/bin'
+ $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python/Perf-Trace-Util/lib/Perf/Trace'
+ $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python/bin'
+ $(INSTALL) $(src-perf)/scripts/python/Perf-Trace-Util/lib/Perf/Trace/* -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python/Perf-Trace-Util/lib/Perf/Trace'
+ $(INSTALL) $(src-perf)/scripts/python/*.py -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python'
+ $(INSTALL) $(src-perf)/scripts/python/bin/* -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python/bin'
+ $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(sysconfdir_SQ)/bash_completion.d'
+ $(INSTALL) $(src-perf)/bash_completion '$(DESTDIR_SQ)$(sysconfdir_SQ)/bash_completion.d/perf'
+ $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests'
+ $(INSTALL) $(src-perf)/tests/attr.py '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests'
+ $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/attr'
+ $(INSTALL) $(src-perf)/tests/attr/* '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/attr'
+
+install: install-bin try-install-man
+
+DOC_TARGETS := doc man html info pdf
+
+$(DOC_TARGETS):
+ $(Q)$(MAKE) -C $(src-perf)/Documentation $(@:doc=all)
+
+INSTALL_DOC_TARGETS := $(patsubst %,install-%,$(DOC_TARGETS)) try-install-man
+INSTALL_DOC_TARGETS += quick-install-doc quick-install-man quick-install-html
+
+# 'make install-doc' should call 'make -C Documentation install'
+$(INSTALL_DOC_TARGETS):
+ $(Q)$(MAKE) -C $(src-perf)/Documentation $(@:-doc=)
+
+help:
+ @echo 'Perf make targets:'
+ @echo ' doc - make *all* documentation (see below)'
+ @echo ' man - make manpage documentation (access with man <foo>)'
+ @echo ' html - make html documentation'
+ @echo ' info - make GNU info documentation (access with info <foo>)'
+ @echo ' pdf - make pdf documentation'
+ @echo ' TAGS - use etags to make tag information for source browsing'
+ @echo ' tags - use ctags to make tag information for source browsing'
+ @echo ' cscope - use cscope to make interactive browsing database'
+ @echo ''
+ @echo 'Perf install targets:'
+ @echo ' NOTE: documentation build requires asciidoc, xmlto packages to be installed'
+ @echo ' HINT: use "make prefix=<path> <install target>" to install to a particular'
+ @echo ' path like make prefix=/usr/local install install-doc'
+ @echo ' install - install compiled binaries'
+ @echo ' install-doc - install *all* documentation'
+ @echo ' install-man - install manpage documentation'
+ @echo ' install-html - install html documentation'
+ @echo ' install-info - install GNU info documentation'
+ @echo ' install-pdf - install pdf documentation'
+ @echo ''
+ @echo ' quick-install-doc - alias for quick-install-man'
+ @echo ' quick-install-man - install the documentation quickly'
+ @echo ' quick-install-html - install the html documentation quickly'
+ @echo ''
+ @echo 'Perf maintainer targets:'
+ @echo ' clean - clean all binary objects and build output'
+
+
+ifdef MAKE_DEBUG
+dummy := $(info DEBUG MAKEFLAGS $(MAKEFLAGS))
+dummy := $(info DEBUG VPATH $(VPATH))
+dummy := $(info DEBUG srctree $(srctree))
+dummy := $(info DEBUG objtree $(objtree))
+dummy := $(info DEBUG src-kernel $(src-kernel))
+dummy := $(info DEBUG src-perf $(src-perf))
+dummy := $(info DEBUG obj-kernel $(obj-kernel))
+dummy := $(info DEBUG obj-perf $(obj-perf))
+dummy := $(info DEBUG KBUILD_KCONFIG $(KBUILD_KCONFIG))
+dummy := $(info DEBUG KCONFIG_CONFIG $(KCONFIG_CONFIG))
+dummy := $(info DEBUG KCONFIG_TRISTATE $(KCONFIG_TRISTATE))
+dummy := $(info DEBUG KCONFIG_AUTOHEADER $(KCONFIG_AUTOHEADER))
+dummy := $(info DEBUG KCONFIG_AUTOCONFIG $(KCONFIG_AUTOCONFIG))
+dummy := $(info DEBUG TRACE_EVENT_DIR $(TRACE_EVENT_DIR))
+dummy := $(info DEBUG LK_DIR $(LK_DIR))
+endif
+
+endif # skip-makefile
+
+PHONY += FORCE
+.PHONY: $(PHONY)
@@ -606,7 +606,7 @@ $(OUTPUT)builtin-timechart.o: builtin-timechart.c $(OUTPUT)common-cmds.h $(OUTPU
$(OUTPUT)common-cmds.h: util/generate-cmdlist.sh command-list.txt
$(OUTPUT)common-cmds.h: $(wildcard Documentation/perf-*.txt)
- $(QUIET_GEN). util/generate-cmdlist.sh > $@+ && mv $@+ $@
+ $(QUIET_GEN). util/generate-cmdlist.sh ./ > $@+ && mv $@+ $@
$(SCRIPTS) : % : %.sh
$(QUIET_GEN)$(INSTALL) '$@.sh' '$(OUTPUT)$@'
new file mode 100644
@@ -0,0 +1,3 @@
+obj-y += common.o
+
+obj-y += $(CONFIG_ARCH)/
new file mode 100644
@@ -0,0 +1 @@
+obj-y += util/
new file mode 100644
@@ -0,0 +1,3 @@
+obj-y += dwarf-regs.o
+obj-y += header.o
+obj-$(CONFIG_LIBUNWIND) += unwind.o
new file mode 100644
@@ -0,0 +1,9 @@
+obj-y += mem-memcpy.o
+obj-y += mem-memset.o
+obj-y += sched-messaging.o
+obj-y += sched-pipe.o
+
+obj-$(CONFIG_NUMA) += numa.o
+
+obj-$(CONFIG_X86_64) += mem-memcpy-x86-64-asm.o
+obj-$(CONFIG_X86_64) += mem-memset-x86-64-asm.o
@@ -1,6 +1,7 @@
#ifndef BUILTIN_CMDS_H
#define BUILTIN_CMDS_H
+#ifndef CONFIG_KBUILD
#define CONFIG_BUILTIN_REPORT 1
#define CONFIG_BUILTIN_SCRIPT 1
#define CONFIG_BUILTIN_BENCH 1
@@ -23,5 +24,8 @@
#define CONFIG_BUILTIN_HELP 1
#define CONFIG_BUILTIN_PROBE 1
#define CONFIG_BUILTIN_MEM 1
+#else
+#include <generated/autoconf.h>
+#endif /* CONFIG_KBUILD */
#endif /* BUILTIN_CMDS_H */
@@ -24,6 +24,7 @@ ifeq ($(ARCH),x86)
CFLAGS += -DHAVE_ARCH_X86_64_SUPPORT
ARCH_INCLUDE = ../../arch/x86/lib/memcpy_64.S ../../arch/x86/lib/memset_64.S
LIBUNWIND_LIBS = -lunwind -lunwind-x86_64
+ CONFIG_X86_64=y
else
LIBUNWIND_LIBS = -lunwind -lunwind-x86
endif
@@ -78,6 +79,10 @@ ifndef NO_LIBELF
FEATURE_CHECK_LDFLAGS-libdw-dwarf-unwind := $(LIBDW_LDFLAGS) -ldw
endif
+ifdef KCONFIG_CONFIG
+include $(src-perf)/config/Makefile.fix-legacy
+endif
+
# include ARCH specific config
-include $(src-perf)/arch/$(ARCH)/Makefile
@@ -244,6 +249,7 @@ ifeq ($(DEBUG),0)
endif
CFLAGS += -I$(src-perf)/util/include
+CFLAGS += -I$(obj-perf)/include
CFLAGS += -I$(src-perf)/arch/$(ARCH)/include
CFLAGS += -I$(srctree)/tools/include/
CFLAGS += -I$(srctree)/arch/$(ARCH)/include/uapi
@@ -733,3 +739,42 @@ endif
ifeq ($(display_lib),1)
$(info )
endif
+
+ifdef CONFIG_DETECTED
+
+store = @echo "$(1)=$($(1))" >> $(CONFIG_DETECTED)
+
+all:
+ $(call store,ARCH)
+ $(call store,CFLAGS)
+ $(call store,LDFLAGS)
+ $(call store,EXTLIBS)
+ $(call store,htmldir_SQ)
+ $(call store,infodir_SQ)
+ $(call store,mandir_SQ)
+ $(call store,perfexecdir_SQ)
+ $(call store,prefix_SQ)
+ $(call store,PARSER_DEBUG_BISON)
+ $(call store,PARSER_DEBUG_FLEX)
+ $(call store,PYTHON_EMBED_CCOPTS)
+ $(call store,PERL_EMBED_CCOPTS)
+ $(call store,CONFIG_X86_64)
+ $(call store,NO_LIBUNWIND)
+ $(call store,NO_LIBPERL)
+ $(call store,NO_LIBPYTHON)
+ $(call store,NO_NEWT)
+ $(call store,NO_GTK2)
+ $(call store,NO_DEMANGLE)
+ $(call store,NO_LIBELF)
+ $(call store,NO_LIBUNWIND)
+ $(call store,NO_BACKTRACE)
+ $(call store,NO_LIBNUMA)
+ $(call store,NO_LIBAUDIT)
+ $(call store,NO_LIBBIONIC)
+ $(call store,ETC_PERFCONFIG_SQ)
+ $(call store,DESTDIR_SQ)
+ $(call store,bindir_SQ)
+ $(call store,perfexec_instdir_SQ)
+ $(call store,sysconfdir_SQ)
+
+endif # CONFIG_DETECTED
new file mode 100644
@@ -0,0 +1,104 @@
+include $(CONFIG_DETECTED)
+include $(KCONFIG_CONFIG)
+
+CONFIG := $(srctree)/scripts/config --file $(KCONFIG_CONFIG)
+
+# NO_LIBPERL
+ifdef CONFIG_LIBPERL
+ifdef NO_LIBPERL
+dummy := $(info Disabling CONFIG_LIBPERL)
+dummy := $(shell $(CONFIG) -d CONFIG_LIBPERL)
+endif
+endif
+
+# NO_LIBPYTHON
+ifdef CONFIG_LIBPYTHON
+ifdef NO_LIBPYTHON
+dummy := $(info Disabling CONFIG_LIBPYTHON)
+dummy := $(shell $(CONFIG) -d CONFIG_LIBPYTHON)
+endif
+endif
+
+# NO_NEWT
+ifdef CONFIG_TUI
+ifdef NO_NEWT
+dummy := $(info Disabling CONFIG_TUI)
+dummy := $(shell $(CONFIG) -d CONFIG_TUI)
+endif
+endif
+
+# NO_NEWT
+ifdef CONFIG_TUI
+ifdef NO_SLANG
+dummy := $(info Disabling CONFIG_TUI)
+dummy := $(shell $(CONFIG) -d CONFIG_TUI)
+endif
+endif
+
+# NO_GTK2
+ifdef CONFIG_GTK2
+ifdef NO_GTK2
+dummy := $(info Disabling CONFIG_GTK2)
+dummy := $(shell $(CONFIG) -d CONFIG_GTK2)
+endif
+endif
+
+# NO_DEMANGLE
+ifdef CONFIG_DEMANGLE
+ifdef NO_DEMANGLE
+dummy := $(info Disabling CONFIG_DEMANGLE)
+dummy := $(shell $(CONFIG) -d CONFIG_DEMANGLE)
+endif
+endif
+
+# NO_LIBELF
+ifdef CONFIG_LIBELF
+ifdef NO_LIBELF
+dummy := $(info Disabling CONFIG_LIBELF)
+dummy := $(info Enabling CONFIG_LIBELF_MINIMAL)
+dummy := $(shell $(CONFIG) -d CONFIG_LIBELF)
+dummy := $(shell $(CONFIG) -e CONFIG_LIBELF_MINIMAL)
+endif
+endif
+
+# NO_LIBUNWIND
+ifdef CONFIG_LIBUNWIND
+ifdef NO_LIBUNWIND
+dummy := $(info Disabling CONFIG_LIBUNWIND)
+dummy := $(shell $(CONFIG) -d CONFIG_LIBUNWIND)
+endif
+endif
+
+# NO_BACKTRACE
+ifdef CONFIG_BACKTRACE
+ifdef NO_BACKTRACE
+dummy := $(info Disabling CONFIG_BACKTRACE)
+dummy := $(shell $(CONFIG) -d CONFIG_BACKTRACE)
+endif
+endif
+
+# NO_LIBNUMA
+ifdef CONFIG_NUMA
+ifdef NO_LIBNUMA
+dummy := $(info Disabling CONFIG_NUMA)
+dummy := $(shell $(CONFIG) -d CONFIG_NUMA)
+endif
+endif
+
+# NO_LIBAUDIT
+ifdef CONFIG_LIBAUDIT
+ifdef NO_LIBAUDIT
+dummy := $(info Disabling CONFIG_LIBAUDIT)
+dummy := $(shell $(CONFIG) -d CONFIG_LIBAUDIT)
+endif
+endif
+
+# NO_LIBBIONIC
+ifdef CONFIG_BIONIC
+ifdef NO_LIBBIONIC
+dummy := $(info Disabling CONFIG_BIONIC)
+dummy := $(shell $(CONFIG) -d CONFIG_BIONIC)
+endif
+endif
+
+all:
new file mode 100644
@@ -0,0 +1,46 @@
+
+include $(KCONFIG_CONFIG)
+
+ifndef CONFIG_LIBPERL
+NO_LIBPERL := 1
+endif
+
+ifndef CONFIG_LIBPYTHON
+NO_LIBPYTHON := 1
+endif
+
+ifndef CONFIG_TUI
+NO_SLANG := 1
+endif
+
+ifndef CONFIG_GTK2
+NO_GTK2 := 1
+endif
+
+ifndef CONFIG_DEMANGLE
+NO_DEMANGLE := 1
+endif
+
+ifndef CONFIG_LIBELF
+NO_LIBELF := 1
+endif
+
+ifndef CONFIG_LIBUNWIND
+NO_LIBUNWIND := 1
+endif
+
+ifndef CONFIG_BACKTRACE
+NO_BACKTRACE := 1
+endif
+
+ifndef CONFIG_NUMA
+export NO_LIBNUMA := 1
+endif
+
+ifndef CONFIG_LIBAUDIT
+NO_LIBAUDIT := 1
+endif
+
+ifdef CONFIG_BIONIC
+NO_LIBBIONIC := 1
+endif
new file mode 100644
@@ -0,0 +1,54 @@
+#
+# Automatically generated file; DO NOT EDIT.
+# Linux Kernel Configuration
+#
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+# CONFIG_BUILTIN_TOP is not set
+# CONFIG_BUILTIN_ANNOTATE is not set
+# CONFIG_BUILTIN_BENCH is not set
+# CONFIG_BUILTIN_BUILDID_CACHE is not set
+# CONFIG_BUILTIN_BUILDID_LIST is not set
+CONFIG_BUILTIN_DIFF=y
+# CONFIG_BUILTIN_EVLIST is not set
+CONFIG_BUILTIN_HELP=y
+# CONFIG_BUILTIN_INJECT is not set
+# CONFIG_BUILTIN_KMEM is not set
+# CONFIG_BUILTIN_KVM is not set
+# CONFIG_BUILTIN_LIST is not set
+# CONFIG_BUILTIN_LOCK is not set
+# CONFIG_BUILTIN_SCHED is not set
+CONFIG_BUILTIN_SCRIPT=y
+# CONFIG_BUILTIN_TIMECHART is not set
+# CONFIG_BUILTIN_TEST is not set
+
+#
+# Libraries
+#
+# CONFIG_LIBAUDIT is not set
+# CONFIG_LIBPERL is not set
+# CONFIG_LIBPYTHON is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_BACKTRACE=y
+# CONFIG_LIBUNWIND is not set
+# CONFIG_NUMA is not set
+# CONFIG_DEMANGLE is not set
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+# CONFIG_TUI is not set
+# CONFIG_GTK2 is not set
+
+#
+# Build
+#
+CONFIG_DEBUG=y
+# CONFIG_DEBUG_PARSER is not set
new file mode 100644
@@ -0,0 +1,3 @@
+obj-y += Context.o
+
+CFLAGS_Context.o += $(PERL_EMBED_CCOPTS)
new file mode 100644
@@ -0,0 +1,4 @@
+obj-y += Context.o
+
+CFLAGS_Context.o := $(PYTHON_EMBED_CCOPTS)
+CFLAGS_Context.o += -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter -Wno-nested-externs
new file mode 100644
@@ -0,0 +1,23 @@
+obj-y += builtin-test.o
+obj-y += attr.o
+obj-y += dso-data.o
+obj-y += evsel-roundtrip-name.o
+obj-y += evsel-tp-sched.o
+obj-y += hists_link.o
+obj-y += mmap-basic.o
+obj-y += open-syscall-all-cpus.o
+obj-y += open-syscall.o
+obj-y += open-syscall-tp-fields.o
+obj-y += parse-events.o
+obj-y += perf-record.o
+obj-y += pmu.o
+obj-y += python-use.o
+obj-y += rdpmc.o
+obj-y += vmlinux-kallsyms.o
+obj-y += bp_signal.o
+obj-y += bp_signal_overflow.o
+obj-y += sw-clock.o
+obj-y += task-exit.o
+
+CFLAGS_python-use.o += -DPYTHON='"$(PYTHON_WORD)"' -DPYTHONPATH='"python"'
+CFLAGS_attr.o += -DPYTHON='"$(PYTHON_WORD)"' -DBINDIR='"$(bindir_SQ)"'
new file mode 100644
@@ -0,0 +1,14 @@
+obj-$(CONFIG_TUI) += browser.o
+obj-y += helpline.o
+obj-y += hist.o
+obj-y += progress.o
+obj-y += setup.o
+obj-y += util.o
+
+obj-y += browsers/
+obj-y += stdio/
+
+obj-$(CONFIG_TUI) += tui/
+obj-$(CONFIG_GTK2) += gtk/
+
+CFLAGS_browser.o += -DENABLE_SLFUTURE_CONST
new file mode 100644
@@ -0,0 +1,6 @@
+obj-$(CONFIG_TUI) += annotate.o
+obj-$(CONFIG_TUI) += hists.o
+obj-$(CONFIG_TUI) += map.o
+obj-$(CONFIG_TUI) += scripts.o
+
+CFLAGS_hists.o += -DENABLE_SLFUTURE_CONST
new file mode 100644
@@ -0,0 +1,7 @@
+obj-y += browser.o
+obj-y += hists.o
+obj-y += setup.o
+obj-y += util.o
+obj-y += helpline.o
+obj-y += progress.o
+obj-y += annotate.o
new file mode 100644
@@ -0,0 +1 @@
+obj-y += hist.o
new file mode 100644
@@ -0,0 +1,4 @@
+obj-y += helpline.o
+obj-y += progress.o
+obj-y += setup.o
+obj-y += util.o
new file mode 100644
@@ -0,0 +1,113 @@
+obj-y += abspath.o
+obj-y += alias.o
+obj-y += annotate.o
+obj-y += bitmap.o
+obj-y += build-id.o
+obj-y += callchain.o
+obj-y += cgroup.o
+obj-y += color.o
+obj-y += config.o
+obj-y += cpumap.o
+obj-y += ctype.o
+obj-y += debug.o
+obj-y += dso.o
+obj-y += environment.o
+obj-y += event.o
+obj-y += evlist.o
+obj-y += evsel.o
+obj-y += exec_cmd.o
+obj-y += header.o
+obj-y += help.o
+obj-y += hist.o
+obj-y += hweight.o
+obj-y += intlist.o
+obj-y += levenshtein.o
+obj-y += machine.o
+obj-y += map.o
+obj-y += pager.o
+obj-y += parse-options.o
+obj-y += path.o
+obj-y += pmu-flex.o
+obj-y += pmu-bison.o
+obj-y += pmu.o
+obj-y += pstack.o
+obj-y += quote.o
+obj-y += rblist.o
+obj-y += run-command.o
+obj-y += session.o
+obj-y += sigchain.o
+obj-y += sort.o
+obj-y += stat.o
+obj-y += strbuf.o
+obj-y += strfilter.o
+obj-y += string.o
+obj-y += strlist.o
+obj-y += svghelper.o
+obj-y += symbol.o
+
+obj-$(CONFIG_LIBUNWIND) += unwind.o
+
+obj-$(CONFIG_LIBELF) += symbol-elf.o
+obj-$(CONFIG_LIBELF) += dwarf-aux.o
+obj-$(CONFIG_LIBELF) += probe-event.o
+obj-$(CONFIG_LIBELF) += probe-finder.o
+
+obj-$(CONFIG_LIBELF_MINIMAL) += symbol-minimal.o
+
+obj-y += sysfs.o
+obj-y += target.o
+obj-y += thread.o
+obj-y += thread_map.o
+obj-y += top.o
+obj-y += usage.o
+obj-y += util.o
+obj-y += values.o
+obj-y += xyarray.o
+obj-y += vdso.o
+obj-y += wrapper.o
+obj-y += trace-event-info.o
+obj-y += trace-event-parse.o
+obj-$(CONFIG_BUILTIN_SCRIPT) += trace-event-scripting.o
+obj-y += trace-event-read.o
+
+obj-y += scripting-engines/
+
+define bison
+$(Q)echo ' BI $@'
+$(Q)$(BISON) -v $< -d $(PARSER_DEBUG_BISON) -o $@ -p $1
+endef
+
+define flex
+$(Q)echo ' FL $@';
+$(Q)$(FLEX) --header-file=$(basename $@).h $(PARSER_DEBUG_FLEX) -t $< > $@
+endef
+
+obj-y += parse-events-flex.o
+obj-y += parse-events-bison.o
+obj-y += parse-events.o
+
+$(obj)/parse-events-bison.c: $(src)/parse-events.y
+ $(call bison,parse_events_)
+
+$(obj)/parse-events-flex.c: $(src)/parse-events.l $(obj)/parse-events-bison.c
+ $(call flex)
+
+$(src)/parse-events-flex.o: $(src)/parse-events-flex.c
+$(src)/parse-events-bison.o: $(src)/parse-events-bison.c
+
+$(src)/pmu-bison.c: $(src)/pmu.y
+ $(call bison,perf_pmu_)
+
+$(src)/pmu-flex.c: $(src)/pmu.l $(src)/pmu-bison.c
+ $(call flex)
+
+$(src)/pmu-flex.o: $(src)/pmu-flex.c
+$(src)/pmu-bison.o: $(src)/pmu-bison.c
+
+CFLAGS_parse-events-flex.o += -w
+CFLAGS_parse-events-bison.o += -DYYENABLE_NLS=0 -DYYLTYPE_IS_TRIVIAL=0 -w
+CFLAGS_pmu-flex.o += -w
+CFLAGS_pmu-bison.o += -DYYENABLE_NLS=0 -DYYLTYPE_IS_TRIVIAL=0 -w
+
+CFLAGS_config.o += -DETC_PERFCONFIG='"$(ETC_PERFCONFIG_SQ)"'
+CFLAGS_exec_cmd.o += -DPERF_EXEC_PATH='"$(perfexecdir_SQ)"' -DPREFIX='"$(prefix_SQ)"'
@@ -9,6 +9,10 @@ GVF=${OUTPUT}PERF-VERSION-FILE
LF='
'
+if [ "${srctree}x" = "x" ]; then
+srctree=../..
+fi
+
#
# First check if there is a .git to get the version from git describe
# otherwise try to get the version from the kernel Makefile
@@ -15,7 +15,7 @@ struct cmdname_help
static struct cmdname_help common_cmds[] = {"
-sed -n -e 's/^perf-\([^ ]*\)[ ].* common.*/\1/p' command-list.txt |
+sed -n -e 's/^perf-\([^ ]*\)[ ].* common.*/\1/p' $1/command-list.txt |
sort |
while read cmd
do
@@ -26,12 +26,12 @@ do
x
s/.*perf-'"$cmd"' - \(.*\)/ {"'"$cmd"'", "\1"},/
p
- }' "Documentation/perf-$cmd.txt"
+ }' "$1/Documentation/perf-$cmd.txt"
echo "#endif"
done
echo "#ifdef HAVE_LIBELF_SUPPORT"
-sed -n -e 's/^perf-\([^ ]*\)[ ].* full.*/\1/p' command-list.txt |
+sed -n -e 's/^perf-\([^ ]*\)[ ].* full.*/\1/p' $1/command-list.txt |
sort |
while read cmd
do
@@ -42,7 +42,7 @@ do
x
s/.*perf-'"$cmd"' - \(.*\)/ {"'"$cmd"'", "\1"},/
p
- }' "Documentation/perf-$cmd.txt"
+ }' "$1/Documentation/perf-$cmd.txt"
echo "#endif"
done
echo "#endif /* HAVE_LIBELF_SUPPORT */"
new file mode 100644
@@ -0,0 +1,7 @@
+obj-$(CONFIG_LIBPERL) += trace-event-perl.o
+obj-$(CONFIG_LIBPYTHON) += trace-event-python.o
+
+CFLAGS_trace-event-perl.o := $(PERL_EMBED_CCOPTS)
+
+CFLAGS_trace-event-python.o := $(PYTHON_EMBED_CCOPTS)
+CFLAGS_trace-event-python.o += -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter -Wno-shadow
@@ -2,6 +2,7 @@
from distutils.core import setup, Extension
from os import getenv
+from os import environ
from distutils.command.build_ext import build_ext as _build_ext
from distutils.command.install_lib import install_lib as _install_lib
@@ -27,8 +28,11 @@ build_tmp = getenv('PYTHON_EXTBUILD_TMP')
libtraceevent = getenv('LIBTRACEEVENT')
libapikfs = getenv('LIBAPIKFS')
-ext_sources = [f.strip() for f in file('util/python-ext-sources')
- if len(f.strip()) > 0 and f[0] != '#']
+if environ.has_key('PYTHON_EXT_SRCS'):
+ ext_sources = getenv('PYTHON_EXT_SRCS').split()
+else:
+ ext_sources = [f.strip() for f in file('util/python-ext-sources')
+ if len(f.strip()) > 0 and f[0] != '#']
perf = Extension('perf',
sources = ext_sources,