aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/Makefile')
-rw-r--r--tools/perf/Makefile61
1 files changed, 46 insertions, 15 deletions
diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index bb74c79cd16e..b0f164b133d9 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -35,7 +35,9 @@ include config/utilities.mak
35# 35#
36# Define WERROR=0 to disable treating any warnings as errors. 36# Define WERROR=0 to disable treating any warnings as errors.
37# 37#
38# Define NO_NEWT if you do not want TUI support. 38# Define NO_NEWT if you do not want TUI support. (deprecated)
39#
40# Define NO_SLANG if you do not want TUI support.
39# 41#
40# Define NO_GTK2 if you do not want GTK+ GUI support. 42# Define NO_GTK2 if you do not want GTK+ GUI support.
41# 43#
@@ -104,6 +106,10 @@ ifdef PARSER_DEBUG
104 PARSER_DEBUG_CFLAGS := -DPARSER_DEBUG 106 PARSER_DEBUG_CFLAGS := -DPARSER_DEBUG
105endif 107endif
106 108
109ifdef NO_NEWT
110 NO_SLANG=1
111endif
112
107CFLAGS = -fno-omit-frame-pointer -ggdb3 -funwind-tables -Wall -Wextra -std=gnu99 $(CFLAGS_WERROR) $(CFLAGS_OPTIMIZE) $(EXTRA_WARNINGS) $(EXTRA_CFLAGS) $(PARSER_DEBUG_CFLAGS) 113CFLAGS = -fno-omit-frame-pointer -ggdb3 -funwind-tables -Wall -Wextra -std=gnu99 $(CFLAGS_WERROR) $(CFLAGS_OPTIMIZE) $(EXTRA_WARNINGS) $(EXTRA_CFLAGS) $(PARSER_DEBUG_CFLAGS)
108EXTLIBS = -lpthread -lrt -lelf -lm 114EXTLIBS = -lpthread -lrt -lelf -lm
109ALL_CFLAGS = $(CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE 115ALL_CFLAGS = $(CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE
@@ -215,6 +221,7 @@ BASIC_CFLAGS = \
215 -Iutil \ 221 -Iutil \
216 -I. \ 222 -I. \
217 -I$(TRACE_EVENT_DIR) \ 223 -I$(TRACE_EVENT_DIR) \
224 -I../lib/ \
218 -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE 225 -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE
219 226
220BASIC_LDFLAGS = 227BASIC_LDFLAGS =
@@ -240,19 +247,28 @@ SCRIPT_SH += perf-archive.sh
240grep-libs = $(filter -l%,$(1)) 247grep-libs = $(filter -l%,$(1))
241strip-libs = $(filter-out -l%,$(1)) 248strip-libs = $(filter-out -l%,$(1))
242 249
250LK_DIR = ../lib/lk/
243TRACE_EVENT_DIR = ../lib/traceevent/ 251TRACE_EVENT_DIR = ../lib/traceevent/
244 252
253LK_PATH=$(LK_DIR)
254
245ifneq ($(OUTPUT),) 255ifneq ($(OUTPUT),)
246 TE_PATH=$(OUTPUT) 256 TE_PATH=$(OUTPUT)
257ifneq ($(subdir),)
258 LK_PATH=$(OUTPUT)$(LK_DIR)
259else
260 LK_PATH=$(OUTPUT)
261endif
247else 262else
248 TE_PATH=$(TRACE_EVENT_DIR) 263 TE_PATH=$(TRACE_EVENT_DIR)
249endif 264endif
250 265
251LIBTRACEEVENT = $(TE_PATH)libtraceevent.a 266LIBTRACEEVENT = $(TE_PATH)libtraceevent.a
252TE_LIB := -L$(TE_PATH) -ltraceevent
253
254export LIBTRACEEVENT 267export LIBTRACEEVENT
255 268
269LIBLK = $(LK_PATH)liblk.a
270export LIBLK
271
256# python extension build directories 272# python extension build directories
257PYTHON_EXTBUILD := $(OUTPUT)python_ext_build/ 273PYTHON_EXTBUILD := $(OUTPUT)python_ext_build/
258PYTHON_EXTBUILD_LIB := $(PYTHON_EXTBUILD)lib/ 274PYTHON_EXTBUILD_LIB := $(PYTHON_EXTBUILD)lib/
@@ -262,7 +278,7 @@ export PYTHON_EXTBUILD_LIB PYTHON_EXTBUILD_TMP
262python-clean := rm -rf $(PYTHON_EXTBUILD) $(OUTPUT)python/perf.so 278python-clean := rm -rf $(PYTHON_EXTBUILD) $(OUTPUT)python/perf.so
263 279
264PYTHON_EXT_SRCS := $(shell grep -v ^\# util/python-ext-sources) 280PYTHON_EXT_SRCS := $(shell grep -v ^\# util/python-ext-sources)
265PYTHON_EXT_DEPS := util/python-ext-sources util/setup.py 281PYTHON_EXT_DEPS := util/python-ext-sources util/setup.py $(LIBTRACEEVENT)
266 282
267$(OUTPUT)python/perf.so: $(PYTHON_EXT_SRCS) $(PYTHON_EXT_DEPS) 283$(OUTPUT)python/perf.so: $(PYTHON_EXT_SRCS) $(PYTHON_EXT_DEPS)
268 $(QUIET_GEN)CFLAGS='$(BASIC_CFLAGS)' $(PYTHON_WORD) util/setup.py \ 284 $(QUIET_GEN)CFLAGS='$(BASIC_CFLAGS)' $(PYTHON_WORD) util/setup.py \
@@ -355,7 +371,6 @@ LIB_H += util/cache.h
355LIB_H += util/callchain.h 371LIB_H += util/callchain.h
356LIB_H += util/build-id.h 372LIB_H += util/build-id.h
357LIB_H += util/debug.h 373LIB_H += util/debug.h
358LIB_H += util/debugfs.h
359LIB_H += util/sysfs.h 374LIB_H += util/sysfs.h
360LIB_H += util/pmu.h 375LIB_H += util/pmu.h
361LIB_H += util/event.h 376LIB_H += util/event.h
@@ -416,7 +431,6 @@ LIB_OBJS += $(OUTPUT)util/annotate.o
416LIB_OBJS += $(OUTPUT)util/build-id.o 431LIB_OBJS += $(OUTPUT)util/build-id.o
417LIB_OBJS += $(OUTPUT)util/config.o 432LIB_OBJS += $(OUTPUT)util/config.o
418LIB_OBJS += $(OUTPUT)util/ctype.o 433LIB_OBJS += $(OUTPUT)util/ctype.o
419LIB_OBJS += $(OUTPUT)util/debugfs.o
420LIB_OBJS += $(OUTPUT)util/sysfs.o 434LIB_OBJS += $(OUTPUT)util/sysfs.o
421LIB_OBJS += $(OUTPUT)util/pmu.o 435LIB_OBJS += $(OUTPUT)util/pmu.o
422LIB_OBJS += $(OUTPUT)util/environment.o 436LIB_OBJS += $(OUTPUT)util/environment.o
@@ -503,6 +517,10 @@ LIB_OBJS += $(OUTPUT)tests/evsel-tp-sched.o
503LIB_OBJS += $(OUTPUT)tests/pmu.o 517LIB_OBJS += $(OUTPUT)tests/pmu.o
504LIB_OBJS += $(OUTPUT)tests/hists_link.o 518LIB_OBJS += $(OUTPUT)tests/hists_link.o
505LIB_OBJS += $(OUTPUT)tests/python-use.o 519LIB_OBJS += $(OUTPUT)tests/python-use.o
520LIB_OBJS += $(OUTPUT)tests/bp_signal.o
521LIB_OBJS += $(OUTPUT)tests/bp_signal_overflow.o
522LIB_OBJS += $(OUTPUT)tests/task-exit.o
523LIB_OBJS += $(OUTPUT)tests/sw-clock.o
506 524
507BUILTIN_OBJS += $(OUTPUT)builtin-annotate.o 525BUILTIN_OBJS += $(OUTPUT)builtin-annotate.o
508BUILTIN_OBJS += $(OUTPUT)builtin-bench.o 526BUILTIN_OBJS += $(OUTPUT)builtin-bench.o
@@ -535,8 +553,9 @@ BUILTIN_OBJS += $(OUTPUT)builtin-lock.o
535BUILTIN_OBJS += $(OUTPUT)builtin-kvm.o 553BUILTIN_OBJS += $(OUTPUT)builtin-kvm.o
536BUILTIN_OBJS += $(OUTPUT)builtin-inject.o 554BUILTIN_OBJS += $(OUTPUT)builtin-inject.o
537BUILTIN_OBJS += $(OUTPUT)tests/builtin-test.o 555BUILTIN_OBJS += $(OUTPUT)tests/builtin-test.o
556BUILTIN_OBJS += $(OUTPUT)builtin-mem.o
538 557
539PERFLIBS = $(LIB_FILE) $(LIBTRACEEVENT) 558PERFLIBS = $(LIB_FILE) $(LIBLK) $(LIBTRACEEVENT)
540 559
541# 560#
542# Platform specific tweaks 561# Platform specific tweaks
@@ -667,15 +686,15 @@ ifndef NO_LIBAUDIT
667 endif 686 endif
668endif 687endif
669 688
670ifndef NO_NEWT 689ifndef NO_SLANG
671 FLAGS_NEWT=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) -lnewt 690 FLAGS_SLANG=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) -I/usr/include/slang -lslang
672 ifneq ($(call try-cc,$(SOURCE_NEWT),$(FLAGS_NEWT),libnewt),y) 691 ifneq ($(call try-cc,$(SOURCE_SLANG),$(FLAGS_SLANG),libslang),y)
673 msg := $(warning newt not found, disables TUI support. Please install newt-devel or libnewt-dev); 692 msg := $(warning slang not found, disables TUI support. Please install slang-devel or libslang-dev);
674 else 693 else
675 # Fedora has /usr/include/slang/slang.h, but ubuntu /usr/include/slang.h 694 # Fedora has /usr/include/slang/slang.h, but ubuntu /usr/include/slang.h
676 BASIC_CFLAGS += -I/usr/include/slang 695 BASIC_CFLAGS += -I/usr/include/slang
677 BASIC_CFLAGS += -DNEWT_SUPPORT 696 BASIC_CFLAGS += -DSLANG_SUPPORT
678 EXTLIBS += -lnewt -lslang 697 EXTLIBS += -lslang
679 LIB_OBJS += $(OUTPUT)ui/browser.o 698 LIB_OBJS += $(OUTPUT)ui/browser.o
680 LIB_OBJS += $(OUTPUT)ui/browsers/annotate.o 699 LIB_OBJS += $(OUTPUT)ui/browsers/annotate.o
681 LIB_OBJS += $(OUTPUT)ui/browsers/hists.o 700 LIB_OBJS += $(OUTPUT)ui/browsers/hists.o
@@ -1051,6 +1070,18 @@ $(LIBTRACEEVENT):
1051$(LIBTRACEEVENT)-clean: 1070$(LIBTRACEEVENT)-clean:
1052 $(QUIET_SUBDIR0)$(TRACE_EVENT_DIR) $(QUIET_SUBDIR1) O=$(OUTPUT) clean 1071 $(QUIET_SUBDIR0)$(TRACE_EVENT_DIR) $(QUIET_SUBDIR1) O=$(OUTPUT) clean
1053 1072
1073# if subdir is set, we've been called from above so target has been built
1074# already
1075$(LIBLK):
1076ifeq ($(subdir),)
1077 $(QUIET_SUBDIR0)$(LK_DIR) $(QUIET_SUBDIR1) O=$(OUTPUT) liblk.a
1078endif
1079
1080$(LIBLK)-clean:
1081ifeq ($(subdir),)
1082 $(QUIET_SUBDIR0)$(LK_DIR) $(QUIET_SUBDIR1) O=$(OUTPUT) clean
1083endif
1084
1054help: 1085help:
1055 @echo 'Perf make targets:' 1086 @echo 'Perf make targets:'
1056 @echo ' doc - make *all* documentation (see below)' 1087 @echo ' doc - make *all* documentation (see below)'
@@ -1171,7 +1202,7 @@ $(INSTALL_DOC_TARGETS):
1171 1202
1172### Cleaning rules 1203### Cleaning rules
1173 1204
1174clean: $(LIBTRACEEVENT)-clean 1205clean: $(LIBTRACEEVENT)-clean $(LIBLK)-clean
1175 $(RM) $(LIB_OBJS) $(BUILTIN_OBJS) $(LIB_FILE) $(OUTPUT)perf-archive $(OUTPUT)perf.o $(LANG_BINDINGS) 1206 $(RM) $(LIB_OBJS) $(BUILTIN_OBJS) $(LIB_FILE) $(OUTPUT)perf-archive $(OUTPUT)perf.o $(LANG_BINDINGS)
1176 $(RM) $(ALL_PROGRAMS) perf 1207 $(RM) $(ALL_PROGRAMS) perf
1177 $(RM) *.spec *.pyc *.pyo */*.pyc */*.pyo $(OUTPUT)common-cmds.h TAGS tags cscope* 1208 $(RM) *.spec *.pyc *.pyo */*.pyc */*.pyo $(OUTPUT)common-cmds.h TAGS tags cscope*
@@ -1181,6 +1212,6 @@ clean: $(LIBTRACEEVENT)-clean
1181 $(RM) $(OUTPUT)util/*-flex* 1212 $(RM) $(OUTPUT)util/*-flex*
1182 $(python-clean) 1213 $(python-clean)
1183 1214
1184.PHONY: all install clean strip $(LIBTRACEEVENT) 1215.PHONY: all install clean strip $(LIBTRACEEVENT) $(LIBLK)
1185.PHONY: shell_compatibility_test please_set_SHELL_PATH_to_a_more_modern_shell 1216.PHONY: shell_compatibility_test please_set_SHELL_PATH_to_a_more_modern_shell
1186.PHONY: .FORCE-PERF-VERSION-FILE TAGS tags cscope .FORCE-PERF-CFLAGS 1217.PHONY: .FORCE-PERF-VERSION-FILE TAGS tags cscope .FORCE-PERF-CFLAGS