diff options
Diffstat (limited to 'tools/perf/Makefile')
-rw-r--r-- | tools/perf/Makefile | 107 |
1 files changed, 81 insertions, 26 deletions
diff --git a/tools/perf/Makefile b/tools/perf/Makefile index 0c542563ea6..1455413ec7a 100644 --- a/tools/perf/Makefile +++ b/tools/perf/Makefile | |||
@@ -5,6 +5,8 @@ endif | |||
5 | # The default target of this Makefile is... | 5 | # The default target of this Makefile is... |
6 | all: | 6 | all: |
7 | 7 | ||
8 | include config/utilities.mak | ||
9 | |||
8 | ifneq ($(OUTPUT),) | 10 | ifneq ($(OUTPUT),) |
9 | # check that the output directory actually exists | 11 | # check that the output directory actually exists |
10 | OUTDIR := $(shell cd $(OUTPUT) && /bin/pwd) | 12 | OUTDIR := $(shell cd $(OUTPUT) && /bin/pwd) |
@@ -13,6 +15,12 @@ endif | |||
13 | 15 | ||
14 | # Define V to have a more verbose compile. | 16 | # Define V to have a more verbose compile. |
15 | # | 17 | # |
18 | # Define PYTHON to point to the python binary if the default | ||
19 | # `python' is not correct; for example: PYTHON=python2 | ||
20 | # | ||
21 | # Define PYTHON_CONFIG to point to the python-config binary if | ||
22 | # the default `$(PYTHON)-config' is not correct. | ||
23 | # | ||
16 | # Define ASCIIDOC8 if you want to format documentation with AsciiDoc 8 | 24 | # Define ASCIIDOC8 if you want to format documentation with AsciiDoc 8 |
17 | # | 25 | # |
18 | # Define DOCBOOK_XSL_172 if you want to format man pages with DocBook XSL v1.72. | 26 | # Define DOCBOOK_XSL_172 if you want to format man pages with DocBook XSL v1.72. |
@@ -134,7 +142,7 @@ INSTALL = install | |||
134 | # explicitly what architecture to check for. Fix this up for yours.. | 142 | # explicitly what architecture to check for. Fix this up for yours.. |
135 | SPARSE_FLAGS = -D__BIG_ENDIAN__ -D__powerpc__ | 143 | SPARSE_FLAGS = -D__BIG_ENDIAN__ -D__powerpc__ |
136 | 144 | ||
137 | -include feature-tests.mak | 145 | -include config/feature-tests.mak |
138 | 146 | ||
139 | ifeq ($(call try-cc,$(SOURCE_HELLO),-Werror -fstack-protector-all),y) | 147 | ifeq ($(call try-cc,$(SOURCE_HELLO),-Werror -fstack-protector-all),y) |
140 | CFLAGS := $(CFLAGS) -fstack-protector-all | 148 | CFLAGS := $(CFLAGS) -fstack-protector-all |
@@ -169,12 +177,10 @@ grep-libs = $(filter -l%,$(1)) | |||
169 | strip-libs = $(filter-out -l%,$(1)) | 177 | strip-libs = $(filter-out -l%,$(1)) |
170 | 178 | ||
171 | $(OUTPUT)python/perf.so: $(PYRF_OBJS) | 179 | $(OUTPUT)python/perf.so: $(PYRF_OBJS) |
172 | $(QUIET_GEN)( \ | 180 | $(QUIET_GEN)CFLAGS='$(BASIC_CFLAGS)' $(PYTHON_WORD) util/setup.py \ |
173 | export CFLAGS="$(BASIC_CFLAGS)"; \ | 181 | --quiet build_ext \ |
174 | python util/setup.py --quiet build_ext --build-lib='$(OUTPUT)python' \ | 182 | --build-lib='$(OUTPUT)python' \ |
175 | --build-temp='$(OUTPUT)python/temp' \ | 183 | --build-temp='$(OUTPUT)python/temp' |
176 | ) | ||
177 | |||
178 | # | 184 | # |
179 | # No Perl scripts right now: | 185 | # No Perl scripts right now: |
180 | # | 186 | # |
@@ -479,24 +485,74 @@ else | |||
479 | endif | 485 | endif |
480 | endif | 486 | endif |
481 | 487 | ||
482 | ifdef NO_LIBPYTHON | 488 | disable-python = $(eval $(disable-python_code)) |
483 | BASIC_CFLAGS += -DNO_LIBPYTHON | 489 | define disable-python_code |
490 | BASIC_CFLAGS += -DNO_LIBPYTHON | ||
491 | $(if $(1),$(warning No $(1) was found)) | ||
492 | $(warning Python support won't be built) | ||
493 | endef | ||
494 | |||
495 | override PYTHON := \ | ||
496 | $(call get-executable-or-default,PYTHON,python) | ||
497 | |||
498 | ifndef PYTHON | ||
499 | $(call disable-python,python interpreter) | ||
500 | python-clean := | ||
484 | else | 501 | else |
485 | PYTHON_EMBED_LDOPTS = $(shell python-config --ldflags 2>/dev/null) | 502 | |
486 | PYTHON_EMBED_LDFLAGS = $(call strip-libs,$(PYTHON_EMBED_LDOPTS)) | 503 | PYTHON_WORD := $(call shell-wordify,$(PYTHON)) |
487 | PYTHON_EMBED_LIBADD = $(call grep-libs,$(PYTHON_EMBED_LDOPTS)) | 504 | |
488 | PYTHON_EMBED_CCOPTS = `python-config --cflags 2>/dev/null` | 505 | python-clean := $(PYTHON_WORD) util/setup.py clean \ |
489 | FLAGS_PYTHON_EMBED=$(PYTHON_EMBED_CCOPTS) $(PYTHON_EMBED_LDOPTS) | 506 | --build-lib='$(OUTPUT)python' \ |
490 | ifneq ($(call try-cc,$(SOURCE_PYTHON_EMBED),$(FLAGS_PYTHON_EMBED)),y) | 507 | --build-temp='$(OUTPUT)python/temp' |
491 | msg := $(warning No Python.h found, install python-dev[el] to have python support in 'perf script' and to build the python bindings) | 508 | |
492 | BASIC_CFLAGS += -DNO_LIBPYTHON | 509 | ifdef NO_LIBPYTHON |
493 | else | 510 | $(call disable-python) |
494 | ALL_LDFLAGS += $(PYTHON_EMBED_LDFLAGS) | 511 | else |
495 | EXTLIBS += $(PYTHON_EMBED_LIBADD) | 512 | |
496 | LIB_OBJS += $(OUTPUT)util/scripting-engines/trace-event-python.o | 513 | override PYTHON_CONFIG := \ |
497 | LIB_OBJS += $(OUTPUT)scripts/python/Perf-Trace-Util/Context.o | 514 | $(call get-executable-or-default,PYTHON_CONFIG,$(PYTHON)-config) |
498 | LANG_BINDINGS += $(OUTPUT)python/perf.so | 515 | |
499 | endif | 516 | ifndef PYTHON_CONFIG |
517 | $(call disable-python,python-config tool) | ||
518 | else | ||
519 | |||
520 | PYTHON_CONFIG_SQ := $(call shell-sq,$(PYTHON_CONFIG)) | ||
521 | |||
522 | PYTHON_EMBED_LDOPTS := $(shell $(PYTHON_CONFIG_SQ) --ldflags 2>/dev/null) | ||
523 | PYTHON_EMBED_LDFLAGS := $(call strip-libs,$(PYTHON_EMBED_LDOPTS)) | ||
524 | PYTHON_EMBED_LIBADD := $(call grep-libs,$(PYTHON_EMBED_LDOPTS)) | ||
525 | PYTHON_EMBED_CCOPTS := $(shell $(PYTHON_CONFIG_SQ) --cflags 2>/dev/null) | ||
526 | FLAGS_PYTHON_EMBED := $(PYTHON_EMBED_CCOPTS) $(PYTHON_EMBED_LDOPTS) | ||
527 | |||
528 | ifneq ($(call try-cc,$(SOURCE_PYTHON_EMBED),$(FLAGS_PYTHON_EMBED)),y) | ||
529 | $(call disable-python,Python.h (for Python 2.x)) | ||
530 | else | ||
531 | |||
532 | ifneq ($(call try-cc,$(SOURCE_PYTHON_VERSION),$(FLAGS_PYTHON_EMBED)),y) | ||
533 | $(warning Python 3 is not yet supported; please set) | ||
534 | $(warning PYTHON and/or PYTHON_CONFIG appropriately.) | ||
535 | $(warning If you also have Python 2 installed, then) | ||
536 | $(warning try something like:) | ||
537 | $(warning $(and ,)) | ||
538 | $(warning $(and ,) make PYTHON=python2) | ||
539 | $(warning $(and ,)) | ||
540 | $(warning Otherwise, disable Python support entirely:) | ||
541 | $(warning $(and ,)) | ||
542 | $(warning $(and ,) make NO_LIBPYTHON=1) | ||
543 | $(warning $(and ,)) | ||
544 | $(error $(and ,)) | ||
545 | else | ||
546 | ALL_LDFLAGS += $(PYTHON_EMBED_LDFLAGS) | ||
547 | EXTLIBS += $(PYTHON_EMBED_LIBADD) | ||
548 | LIB_OBJS += $(OUTPUT)util/scripting-engines/trace-event-python.o | ||
549 | LIB_OBJS += $(OUTPUT)scripts/python/Perf-Trace-Util/Context.o | ||
550 | LANG_BINDINGS += $(OUTPUT)python/perf.so | ||
551 | endif | ||
552 | |||
553 | endif | ||
554 | endif | ||
555 | endif | ||
500 | endif | 556 | endif |
501 | 557 | ||
502 | ifdef NO_DEMANGLE | 558 | ifdef NO_DEMANGLE |
@@ -837,8 +893,7 @@ clean: | |||
837 | $(RM) *.spec *.pyc *.pyo */*.pyc */*.pyo $(OUTPUT)common-cmds.h TAGS tags cscope* | 893 | $(RM) *.spec *.pyc *.pyo */*.pyc */*.pyo $(OUTPUT)common-cmds.h TAGS tags cscope* |
838 | $(MAKE) -C Documentation/ clean | 894 | $(MAKE) -C Documentation/ clean |
839 | $(RM) $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)PERF-CFLAGS | 895 | $(RM) $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)PERF-CFLAGS |
840 | @python util/setup.py clean --build-lib='$(OUTPUT)python' \ | 896 | $(python-clean) |
841 | --build-temp='$(OUTPUT)python/temp' | ||
842 | 897 | ||
843 | .PHONY: all install clean strip | 898 | .PHONY: all install clean strip |
844 | .PHONY: shell_compatibility_test please_set_SHELL_PATH_to_a_more_modern_shell | 899 | .PHONY: shell_compatibility_test please_set_SHELL_PATH_to_a_more_modern_shell |