Ingo Molnar | bd69cc2 | 2013-10-02 11:49:08 +0200 | [diff] [blame] | 1 | include ../scripts/Makefile.include |
| 2 | |
| 3 | # The default target of this Makefile is... |
| 4 | all: |
| 5 | |
| 6 | include config/utilities.mak |
| 7 | |
| 8 | # Define V to have a more verbose compile. |
| 9 | # |
Jiri Olsa | 0695e57 | 2014-02-19 16:52:54 +0100 | [diff] [blame] | 10 | # Define VF to have a more verbose feature check output. |
| 11 | # |
Ingo Molnar | bd69cc2 | 2013-10-02 11:49:08 +0200 | [diff] [blame] | 12 | # Define O to save output files in a separate directory. |
| 13 | # |
| 14 | # Define ARCH as name of target architecture if you want cross-builds. |
| 15 | # |
| 16 | # Define CROSS_COMPILE as prefix name of compiler if you want cross-builds. |
| 17 | # |
| 18 | # Define NO_LIBPERL to disable perl script extension. |
| 19 | # |
| 20 | # Define NO_LIBPYTHON to disable python script extension. |
| 21 | # |
| 22 | # Define PYTHON to point to the python binary if the default |
| 23 | # `python' is not correct; for example: PYTHON=python2 |
| 24 | # |
| 25 | # Define PYTHON_CONFIG to point to the python-config binary if |
| 26 | # the default `$(PYTHON)-config' is not correct. |
| 27 | # |
| 28 | # Define ASCIIDOC8 if you want to format documentation with AsciiDoc 8 |
| 29 | # |
| 30 | # Define DOCBOOK_XSL_172 if you want to format man pages with DocBook XSL v1.72. |
| 31 | # |
| 32 | # Define LDFLAGS=-static to build a static binary. |
| 33 | # |
| 34 | # Define EXTRA_CFLAGS=-m64 or EXTRA_CFLAGS=-m32 as appropriate for cross-builds. |
| 35 | # |
| 36 | # Define NO_DWARF if you do not want debug-info analysis feature at all. |
| 37 | # |
| 38 | # Define WERROR=0 to disable treating any warnings as errors. |
| 39 | # |
| 40 | # Define NO_NEWT if you do not want TUI support. (deprecated) |
| 41 | # |
| 42 | # Define NO_SLANG if you do not want TUI support. |
| 43 | # |
| 44 | # Define NO_GTK2 if you do not want GTK+ GUI support. |
| 45 | # |
| 46 | # Define NO_DEMANGLE if you do not want C++ symbol demangling. |
| 47 | # |
| 48 | # Define NO_LIBELF if you do not want libelf dependency (e.g. cross-builds) |
| 49 | # |
| 50 | # Define NO_LIBUNWIND if you do not want libunwind dependency for dwarf |
| 51 | # backtrace post unwind. |
| 52 | # |
| 53 | # Define NO_BACKTRACE if you do not want stack backtrace debug feature |
| 54 | # |
| 55 | # Define NO_LIBNUMA if you do not want numa perf benchmark |
| 56 | # |
| 57 | # Define NO_LIBAUDIT if you do not want libaudit support |
| 58 | # |
| 59 | # Define NO_LIBBIONIC if you do not want bionic support |
Jiri Olsa | 5ea8415 | 2014-02-19 16:52:57 +0100 | [diff] [blame] | 60 | # |
| 61 | # Define NO_LIBDW_DWARF_UNWIND if you do not want libdw support |
| 62 | # for dwarf backtrace post unwind. |
Adrian Hunter | e477f3f | 2014-10-23 18:16:03 -0300 | [diff] [blame] | 63 | # |
| 64 | # Define NO_PERF_READ_VDSO32 if you do not want to build perf-read-vdso32 |
| 65 | # for reading the 32-bit compatibility VDSO in 64-bit mode |
| 66 | # |
| 67 | # Define NO_PERF_READ_VDSOX32 if you do not want to build perf-read-vdsox32 |
| 68 | # for reading the x32 mode 32-bit compatibility VDSO in 64-bit mode |
Namhyung Kim | e92ce12 | 2014-10-31 16:51:38 +0900 | [diff] [blame] | 69 | # |
| 70 | # Define NO_ZLIB if you do not want to support compressed kernel modules |
| 71 | |
Jiri Olsa | 5ea8415 | 2014-02-19 16:52:57 +0100 | [diff] [blame] | 72 | |
Ingo Molnar | bd69cc2 | 2013-10-02 11:49:08 +0200 | [diff] [blame] | 73 | ifeq ($(srctree),) |
| 74 | srctree := $(patsubst %/,%,$(dir $(shell pwd))) |
| 75 | srctree := $(patsubst %/,%,$(dir $(srctree))) |
| 76 | #$(info Determined 'srctree' to be $(srctree)) |
| 77 | endif |
| 78 | |
| 79 | ifneq ($(objtree),) |
| 80 | #$(info Determined 'objtree' to be $(objtree)) |
| 81 | endif |
| 82 | |
| 83 | ifneq ($(OUTPUT),) |
| 84 | #$(info Determined 'OUTPUT' to be $(OUTPUT)) |
Jiri Olsa | 9352aab | 2014-12-29 17:42:46 +0100 | [diff] [blame] | 85 | # Adding $(OUTPUT) as a directory to look for source files, |
| 86 | # because use generated output files as sources dependency |
| 87 | # for flex/bison parsers. |
| 88 | VPATH += $(OUTPUT) |
| 89 | export VPATH |
Ingo Molnar | bd69cc2 | 2013-10-02 11:49:08 +0200 | [diff] [blame] | 90 | endif |
| 91 | |
Jiri Olsa | 6dd280c | 2015-01-10 21:43:32 +0100 | [diff] [blame] | 92 | # Do not use make's built-in rules |
| 93 | # (this improves performance and avoids hard-to-debug behaviour); |
| 94 | MAKEFLAGS += -r |
| 95 | |
Ingo Molnar | bd69cc2 | 2013-10-02 11:49:08 +0200 | [diff] [blame] | 96 | $(OUTPUT)PERF-VERSION-FILE: ../../.git/HEAD |
| 97 | @$(SHELL_PATH) util/PERF-VERSION-GEN $(OUTPUT) |
| 98 | @touch $(OUTPUT)PERF-VERSION-FILE |
| 99 | |
| 100 | CC = $(CROSS_COMPILE)gcc |
Jiri Olsa | 72965b8 | 2014-12-29 13:52:36 +0100 | [diff] [blame] | 101 | LD = $(CROSS_COMPILE)ld |
Ingo Molnar | bd69cc2 | 2013-10-02 11:49:08 +0200 | [diff] [blame] | 102 | AR = $(CROSS_COMPILE)ar |
Mark Rutland | a8a5cd8 | 2014-01-15 10:44:08 +0000 | [diff] [blame] | 103 | PKG_CONFIG = $(CROSS_COMPILE)pkg-config |
Ingo Molnar | bd69cc2 | 2013-10-02 11:49:08 +0200 | [diff] [blame] | 104 | |
| 105 | RM = rm -f |
Arnaldo Carvalho de Melo | b52bc23 | 2013-09-24 11:56:36 -0300 | [diff] [blame] | 106 | LN = ln -f |
Ingo Molnar | bd69cc2 | 2013-10-02 11:49:08 +0200 | [diff] [blame] | 107 | MKDIR = mkdir |
| 108 | FIND = find |
| 109 | INSTALL = install |
| 110 | FLEX = flex |
| 111 | BISON = bison |
| 112 | STRIP = strip |
| 113 | |
Borislav Petkov | 553873e | 2013-12-09 17:14:23 +0100 | [diff] [blame] | 114 | LIB_DIR = $(srctree)/tools/lib/api/ |
Ingo Molnar | bd69cc2 | 2013-10-02 11:49:08 +0200 | [diff] [blame] | 115 | TRACE_EVENT_DIR = $(srctree)/tools/lib/traceevent/ |
| 116 | |
| 117 | # include config/Makefile by default and rule out |
| 118 | # non-config cases |
| 119 | config := 1 |
| 120 | |
| 121 | NON_CONFIG_TARGETS := clean TAGS tags cscope help |
| 122 | |
| 123 | ifdef MAKECMDGOALS |
| 124 | ifeq ($(filter-out $(NON_CONFIG_TARGETS),$(MAKECMDGOALS)),) |
| 125 | config := 0 |
| 126 | endif |
| 127 | endif |
| 128 | |
| 129 | ifeq ($(config),1) |
| 130 | include config/Makefile |
| 131 | endif |
| 132 | |
Jiri Olsa | 3d7c014 | 2013-12-03 14:09:21 +0100 | [diff] [blame] | 133 | export prefix bindir sharedir sysconfdir DESTDIR |
Ingo Molnar | bd69cc2 | 2013-10-02 11:49:08 +0200 | [diff] [blame] | 134 | |
| 135 | # sparse is architecture-neutral, which means that we need to tell it |
| 136 | # explicitly what architecture to check for. Fix this up for yours.. |
| 137 | SPARSE_FLAGS = -D__BIG_ENDIAN__ -D__powerpc__ |
| 138 | |
| 139 | # Guard against environment variables |
| 140 | BUILTIN_OBJS = |
| 141 | LIB_H = |
| 142 | LIB_OBJS = |
Namhyung Kim | fc67297 | 2013-09-13 15:27:43 +0900 | [diff] [blame] | 143 | GTK_OBJS = |
Ingo Molnar | bd69cc2 | 2013-10-02 11:49:08 +0200 | [diff] [blame] | 144 | PYRF_OBJS = |
| 145 | SCRIPT_SH = |
| 146 | |
| 147 | SCRIPT_SH += perf-archive.sh |
Adrian Hunter | c501e90 | 2014-07-31 09:01:12 +0300 | [diff] [blame] | 148 | SCRIPT_SH += perf-with-kcore.sh |
Ingo Molnar | bd69cc2 | 2013-10-02 11:49:08 +0200 | [diff] [blame] | 149 | |
| 150 | grep-libs = $(filter -l%,$(1)) |
| 151 | strip-libs = $(filter-out -l%,$(1)) |
| 152 | |
| 153 | ifneq ($(OUTPUT),) |
| 154 | TE_PATH=$(OUTPUT) |
| 155 | ifneq ($(subdir),) |
Borislav Petkov | 553873e | 2013-12-09 17:14:23 +0100 | [diff] [blame] | 156 | LIB_PATH=$(OUTPUT)/../lib/api/ |
Ingo Molnar | bd69cc2 | 2013-10-02 11:49:08 +0200 | [diff] [blame] | 157 | else |
Borislav Petkov | 553873e | 2013-12-09 17:14:23 +0100 | [diff] [blame] | 158 | LIB_PATH=$(OUTPUT) |
Ingo Molnar | bd69cc2 | 2013-10-02 11:49:08 +0200 | [diff] [blame] | 159 | endif |
| 160 | else |
| 161 | TE_PATH=$(TRACE_EVENT_DIR) |
Borislav Petkov | 553873e | 2013-12-09 17:14:23 +0100 | [diff] [blame] | 162 | LIB_PATH=$(LIB_DIR) |
Ingo Molnar | bd69cc2 | 2013-10-02 11:49:08 +0200 | [diff] [blame] | 163 | endif |
| 164 | |
| 165 | LIBTRACEEVENT = $(TE_PATH)libtraceevent.a |
| 166 | export LIBTRACEEVENT |
| 167 | |
Borislav Petkov | 553873e | 2013-12-09 17:14:23 +0100 | [diff] [blame] | 168 | LIBAPIKFS = $(LIB_PATH)libapikfs.a |
| 169 | export LIBAPIKFS |
Ingo Molnar | bd69cc2 | 2013-10-02 11:49:08 +0200 | [diff] [blame] | 170 | |
| 171 | # python extension build directories |
| 172 | PYTHON_EXTBUILD := $(OUTPUT)python_ext_build/ |
| 173 | PYTHON_EXTBUILD_LIB := $(PYTHON_EXTBUILD)lib/ |
| 174 | PYTHON_EXTBUILD_TMP := $(PYTHON_EXTBUILD)tmp/ |
| 175 | export PYTHON_EXTBUILD_LIB PYTHON_EXTBUILD_TMP |
| 176 | |
Ingo Molnar | 8ec19c0 | 2013-10-09 11:49:26 +0200 | [diff] [blame] | 177 | python-clean := $(call QUIET_CLEAN, python) $(RM) -r $(PYTHON_EXTBUILD) $(OUTPUT)python/perf.so |
Ingo Molnar | bd69cc2 | 2013-10-02 11:49:08 +0200 | [diff] [blame] | 178 | |
| 179 | PYTHON_EXT_SRCS := $(shell grep -v ^\# util/python-ext-sources) |
Borislav Petkov | 553873e | 2013-12-09 17:14:23 +0100 | [diff] [blame] | 180 | PYTHON_EXT_DEPS := util/python-ext-sources util/setup.py $(LIBTRACEEVENT) $(LIBAPIKFS) |
Ingo Molnar | bd69cc2 | 2013-10-02 11:49:08 +0200 | [diff] [blame] | 181 | |
| 182 | $(OUTPUT)python/perf.so: $(PYTHON_EXT_SRCS) $(PYTHON_EXT_DEPS) |
| 183 | $(QUIET_GEN)CFLAGS='$(CFLAGS)' $(PYTHON_WORD) util/setup.py \ |
| 184 | --quiet build_ext; \ |
| 185 | mkdir -p $(OUTPUT)python && \ |
| 186 | cp $(PYTHON_EXTBUILD_LIB)perf.so $(OUTPUT)python/ |
| 187 | # |
| 188 | # No Perl scripts right now: |
| 189 | # |
| 190 | |
| 191 | SCRIPTS = $(patsubst %.sh,%,$(SCRIPT_SH)) |
| 192 | |
Ingo Molnar | bd69cc2 | 2013-10-02 11:49:08 +0200 | [diff] [blame] | 193 | PROGRAMS += $(OUTPUT)perf |
| 194 | |
Adrian Hunter | e477f3f | 2014-10-23 18:16:03 -0300 | [diff] [blame] | 195 | ifndef NO_PERF_READ_VDSO32 |
| 196 | PROGRAMS += $(OUTPUT)perf-read-vdso32 |
| 197 | endif |
| 198 | |
| 199 | ifndef NO_PERF_READ_VDSOX32 |
| 200 | PROGRAMS += $(OUTPUT)perf-read-vdsox32 |
| 201 | endif |
| 202 | |
Ingo Molnar | bd69cc2 | 2013-10-02 11:49:08 +0200 | [diff] [blame] | 203 | # what 'all' will build and 'install' will install, in perfexecdir |
| 204 | ALL_PROGRAMS = $(PROGRAMS) $(SCRIPTS) |
| 205 | |
| 206 | # what 'all' will build but not install in perfexecdir |
| 207 | OTHER_PROGRAMS = $(OUTPUT)perf |
| 208 | |
| 209 | # Set paths to tools early so that they can be used for version tests. |
| 210 | ifndef SHELL_PATH |
| 211 | SHELL_PATH = /bin/sh |
| 212 | endif |
| 213 | ifndef PERL_PATH |
| 214 | PERL_PATH = /usr/bin/perl |
| 215 | endif |
| 216 | |
| 217 | export PERL_PATH |
| 218 | |
Ingo Molnar | bd69cc2 | 2013-10-02 11:49:08 +0200 | [diff] [blame] | 219 | LIB_FILE=$(OUTPUT)libperf.a |
| 220 | |
Arnaldo Carvalho de Melo | c506c96 | 2013-12-11 09:15:00 -0300 | [diff] [blame] | 221 | LIB_H += ../lib/symbol/kallsyms.h |
Ingo Molnar | bd69cc2 | 2013-10-02 11:49:08 +0200 | [diff] [blame] | 222 | LIB_H += ../../include/uapi/linux/perf_event.h |
| 223 | LIB_H += ../../include/linux/rbtree.h |
| 224 | LIB_H += ../../include/linux/list.h |
| 225 | LIB_H += ../../include/uapi/linux/const.h |
Borislav Petkov | 0e55fa1 | 2014-02-05 15:51:53 +0100 | [diff] [blame] | 226 | LIB_H += ../include/linux/hash.h |
Ingo Molnar | bd69cc2 | 2013-10-02 11:49:08 +0200 | [diff] [blame] | 227 | LIB_H += ../../include/linux/stringify.h |
| 228 | LIB_H += util/include/linux/bitmap.h |
Arnaldo Carvalho de Melo | 3967278 | 2014-12-16 10:55:42 -0300 | [diff] [blame] | 229 | LIB_H += ../include/linux/bitops.h |
Arnaldo Carvalho de Melo | 25cd480 | 2015-01-13 10:19:12 -0300 | [diff] [blame] | 230 | LIB_H += ../include/asm-generic/bitops/arch_hweight.h |
Arnaldo Carvalho de Melo | cae68d4 | 2014-12-15 16:44:26 -0300 | [diff] [blame] | 231 | LIB_H += ../include/asm-generic/bitops/atomic.h |
Arnaldo Carvalho de Melo | 25cd480 | 2015-01-13 10:19:12 -0300 | [diff] [blame] | 232 | LIB_H += ../include/asm-generic/bitops/const_hweight.h |
Arnaldo Carvalho de Melo | 23e1a35 | 2014-12-15 19:50:12 -0300 | [diff] [blame] | 233 | LIB_H += ../include/asm-generic/bitops/find.h |
Arnaldo Carvalho de Melo | afcd4f6 | 2014-12-16 11:26:35 -0300 | [diff] [blame] | 234 | LIB_H += ../include/asm-generic/bitops/fls64.h |
| 235 | LIB_H += ../include/asm-generic/bitops/fls.h |
Arnaldo Carvalho de Melo | 2dc0b97 | 2014-12-15 15:07:24 -0300 | [diff] [blame] | 236 | LIB_H += ../include/asm-generic/bitops/__ffs.h |
Arnaldo Carvalho de Melo | afcd4f6 | 2014-12-16 11:26:35 -0300 | [diff] [blame] | 237 | LIB_H += ../include/asm-generic/bitops/__fls.h |
Arnaldo Carvalho de Melo | 25cd480 | 2015-01-13 10:19:12 -0300 | [diff] [blame] | 238 | LIB_H += ../include/asm-generic/bitops/hweight.h |
Arnaldo Carvalho de Melo | 88bcea4 | 2014-12-16 10:53:27 -0300 | [diff] [blame] | 239 | LIB_H += ../include/asm-generic/bitops.h |
Namhyung Kim | 8a625c1 | 2014-01-09 23:00:52 +0900 | [diff] [blame] | 240 | LIB_H += ../include/linux/compiler.h |
Arnaldo Carvalho de Melo | 0389cd1 | 2014-12-15 16:04:11 -0300 | [diff] [blame] | 241 | LIB_H += ../include/linux/log2.h |
Ingo Molnar | bd69cc2 | 2013-10-02 11:49:08 +0200 | [diff] [blame] | 242 | LIB_H += util/include/linux/const.h |
| 243 | LIB_H += util/include/linux/ctype.h |
| 244 | LIB_H += util/include/linux/kernel.h |
| 245 | LIB_H += util/include/linux/list.h |
Borislav Petkov | 5ac3e4b | 2014-02-23 12:04:53 +0100 | [diff] [blame] | 246 | LIB_H += ../include/linux/export.h |
Ingo Molnar | bd69cc2 | 2013-10-02 11:49:08 +0200 | [diff] [blame] | 247 | LIB_H += util/include/linux/poison.h |
Ingo Molnar | bd69cc2 | 2013-10-02 11:49:08 +0200 | [diff] [blame] | 248 | LIB_H += util/include/linux/rbtree.h |
| 249 | LIB_H += util/include/linux/rbtree_augmented.h |
| 250 | LIB_H += util/include/linux/string.h |
Borislav Petkov | d944c4e | 2014-04-25 21:31:02 +0200 | [diff] [blame] | 251 | LIB_H += ../include/linux/types.h |
Ingo Molnar | bd69cc2 | 2013-10-02 11:49:08 +0200 | [diff] [blame] | 252 | LIB_H += util/include/linux/linkage.h |
| 253 | LIB_H += util/include/asm/asm-offsets.h |
Namhyung Kim | 02dfc8d | 2014-01-09 23:00:54 +0900 | [diff] [blame] | 254 | LIB_H += ../include/asm/bug.h |
Ingo Molnar | bd69cc2 | 2013-10-02 11:49:08 +0200 | [diff] [blame] | 255 | LIB_H += util/include/asm/byteorder.h |
Ingo Molnar | bd69cc2 | 2013-10-02 11:49:08 +0200 | [diff] [blame] | 256 | LIB_H += util/include/asm/swab.h |
| 257 | LIB_H += util/include/asm/system.h |
| 258 | LIB_H += util/include/asm/uaccess.h |
| 259 | LIB_H += util/include/dwarf-regs.h |
| 260 | LIB_H += util/include/asm/dwarf2.h |
| 261 | LIB_H += util/include/asm/cpufeature.h |
| 262 | LIB_H += util/include/asm/unistd_32.h |
| 263 | LIB_H += util/include/asm/unistd_64.h |
| 264 | LIB_H += perf.h |
| 265 | LIB_H += util/annotate.h |
| 266 | LIB_H += util/cache.h |
| 267 | LIB_H += util/callchain.h |
| 268 | LIB_H += util/build-id.h |
Adrian Hunter | 0db15b1 | 2014-10-23 13:45:13 +0300 | [diff] [blame] | 269 | LIB_H += util/db-export.h |
Ingo Molnar | bd69cc2 | 2013-10-02 11:49:08 +0200 | [diff] [blame] | 270 | LIB_H += util/debug.h |
Ingo Molnar | bd69cc2 | 2013-10-02 11:49:08 +0200 | [diff] [blame] | 271 | LIB_H += util/pmu.h |
| 272 | LIB_H += util/event.h |
| 273 | LIB_H += util/evsel.h |
| 274 | LIB_H += util/evlist.h |
| 275 | LIB_H += util/exec_cmd.h |
Adrian Hunter | e477f3f | 2014-10-23 18:16:03 -0300 | [diff] [blame] | 276 | LIB_H += util/find-vdso-map.c |
Ingo Molnar | bd69cc2 | 2013-10-02 11:49:08 +0200 | [diff] [blame] | 277 | LIB_H += util/levenshtein.h |
| 278 | LIB_H += util/machine.h |
| 279 | LIB_H += util/map.h |
| 280 | LIB_H += util/parse-options.h |
| 281 | LIB_H += util/parse-events.h |
| 282 | LIB_H += util/quote.h |
| 283 | LIB_H += util/util.h |
| 284 | LIB_H += util/xyarray.h |
| 285 | LIB_H += util/header.h |
| 286 | LIB_H += util/help.h |
| 287 | LIB_H += util/session.h |
Jiri Olsa | 5f86b80 | 2014-08-01 13:02:58 -0300 | [diff] [blame] | 288 | LIB_H += util/ordered-events.h |
Ingo Molnar | bd69cc2 | 2013-10-02 11:49:08 +0200 | [diff] [blame] | 289 | LIB_H += util/strbuf.h |
| 290 | LIB_H += util/strlist.h |
| 291 | LIB_H += util/strfilter.h |
| 292 | LIB_H += util/svghelper.h |
| 293 | LIB_H += util/tool.h |
| 294 | LIB_H += util/run-command.h |
| 295 | LIB_H += util/sigchain.h |
| 296 | LIB_H += util/dso.h |
| 297 | LIB_H += util/symbol.h |
| 298 | LIB_H += util/color.h |
| 299 | LIB_H += util/values.h |
| 300 | LIB_H += util/sort.h |
| 301 | LIB_H += util/hist.h |
Frederic Weisbecker | 1902efe | 2013-09-11 16:56:44 +0200 | [diff] [blame] | 302 | LIB_H += util/comm.h |
Ingo Molnar | bd69cc2 | 2013-10-02 11:49:08 +0200 | [diff] [blame] | 303 | LIB_H += util/thread.h |
| 304 | LIB_H += util/thread_map.h |
| 305 | LIB_H += util/trace-event.h |
| 306 | LIB_H += util/probe-finder.h |
| 307 | LIB_H += util/dwarf-aux.h |
| 308 | LIB_H += util/probe-event.h |
| 309 | LIB_H += util/pstack.h |
| 310 | LIB_H += util/cpumap.h |
| 311 | LIB_H += util/top.h |
| 312 | LIB_H += $(ARCH_INCLUDE) |
| 313 | LIB_H += util/cgroup.h |
| 314 | LIB_H += $(LIB_INCLUDE)traceevent/event-parse.h |
| 315 | LIB_H += util/target.h |
| 316 | LIB_H += util/rblist.h |
| 317 | LIB_H += util/intlist.h |
| 318 | LIB_H += util/perf_regs.h |
| 319 | LIB_H += util/unwind.h |
| 320 | LIB_H += util/vdso.h |
Adrian Hunter | 0b43786 | 2014-07-14 13:03:03 +0300 | [diff] [blame] | 321 | LIB_H += util/tsc.h |
Ingo Molnar | bd69cc2 | 2013-10-02 11:49:08 +0200 | [diff] [blame] | 322 | LIB_H += ui/helpline.h |
| 323 | LIB_H += ui/progress.h |
| 324 | LIB_H += ui/util.h |
| 325 | LIB_H += ui/ui.h |
Jiri Olsa | 6e6dc40 | 2013-10-26 20:53:14 +0200 | [diff] [blame] | 326 | LIB_H += util/data.h |
Alexander Yarygin | 9daa812 | 2014-07-03 18:29:05 +0400 | [diff] [blame] | 327 | LIB_H += util/kvm-stat.h |
Adrian Hunter | 00447cc | 2014-10-30 16:09:42 +0200 | [diff] [blame] | 328 | LIB_H += util/thread-stack.h |
Ingo Molnar | bd69cc2 | 2013-10-02 11:49:08 +0200 | [diff] [blame] | 329 | |
Borislav Petkov | 553873e | 2013-12-09 17:14:23 +0100 | [diff] [blame] | 330 | PERFLIBS = $(LIB_FILE) $(LIBAPIKFS) $(LIBTRACEEVENT) |
Ingo Molnar | bd69cc2 | 2013-10-02 11:49:08 +0200 | [diff] [blame] | 331 | |
| 332 | # We choose to avoid "if .. else if .. else .. endif endif" |
| 333 | # because maintaining the nesting to match is a pain. If |
| 334 | # we had "elif" things would have been much nicer... |
| 335 | |
| 336 | -include arch/$(ARCH)/Makefile |
| 337 | |
| 338 | ifneq ($(OUTPUT),) |
| 339 | CFLAGS += -I$(OUTPUT) |
| 340 | endif |
| 341 | |
Ingo Molnar | bd69cc2 | 2013-10-02 11:49:08 +0200 | [diff] [blame] | 342 | ifndef NO_GTK2 |
Namhyung Kim | fc67297 | 2013-09-13 15:27:43 +0900 | [diff] [blame] | 343 | ALL_PROGRAMS += $(OUTPUT)libperf-gtk.so |
Jiri Olsa | 88aeea0 | 2014-12-30 00:34:23 +0100 | [diff] [blame] | 344 | GTK_IN := $(OUTPUT)gtk-in.o |
Namhyung Kim | fc67297 | 2013-09-13 15:27:43 +0900 | [diff] [blame] | 345 | |
| 346 | install-gtk: $(OUTPUT)libperf-gtk.so |
Ingo Molnar | 8a5411e9 | 2013-10-09 11:49:29 +0200 | [diff] [blame] | 347 | $(call QUIET_INSTALL, 'GTK UI') \ |
| 348 | $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(libdir_SQ)'; \ |
| 349 | $(INSTALL) $(OUTPUT)libperf-gtk.so '$(DESTDIR_SQ)$(libdir_SQ)' |
Ingo Molnar | bd69cc2 | 2013-10-02 11:49:08 +0200 | [diff] [blame] | 350 | endif |
| 351 | |
Ingo Molnar | bd69cc2 | 2013-10-02 11:49:08 +0200 | [diff] [blame] | 352 | ifdef ASCIIDOC8 |
| 353 | export ASCIIDOC8 |
| 354 | endif |
| 355 | |
| 356 | LIBS = -Wl,--whole-archive $(PERFLIBS) -Wl,--no-whole-archive -Wl,--start-group $(EXTLIBS) -Wl,--end-group |
| 357 | |
| 358 | export INSTALL SHELL_PATH |
| 359 | |
| 360 | ### Build rules |
| 361 | |
| 362 | SHELL = $(SHELL_PATH) |
| 363 | |
| 364 | all: shell_compatibility_test $(ALL_PROGRAMS) $(LANG_BINDINGS) $(OTHER_PROGRAMS) |
| 365 | |
| 366 | please_set_SHELL_PATH_to_a_more_modern_shell: |
| 367 | @$$(:) |
| 368 | |
| 369 | shell_compatibility_test: please_set_SHELL_PATH_to_a_more_modern_shell |
| 370 | |
| 371 | strip: $(PROGRAMS) $(OUTPUT)perf |
| 372 | $(STRIP) $(STRIP_OPTS) $(PROGRAMS) $(OUTPUT)perf |
| 373 | |
Jiri Olsa | 72965b8 | 2014-12-29 13:52:36 +0100 | [diff] [blame] | 374 | PERF_IN := $(OUTPUT)perf-in.o |
| 375 | |
Jiri Olsa | 9352aab | 2014-12-29 17:42:46 +0100 | [diff] [blame] | 376 | export srctree OUTPUT RM CC LD AR CFLAGS V BISON FLEX |
Jiri Olsa | 72965b8 | 2014-12-29 13:52:36 +0100 | [diff] [blame] | 377 | build := -f $(srctree)/tools/build/Makefile.build dir=. obj |
| 378 | |
Jiri Olsa | cb4e67f | 2014-12-30 17:09:15 +0100 | [diff] [blame^] | 379 | $(PERF_IN): $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)common-cmds.h FORCE |
Jiri Olsa | 72965b8 | 2014-12-29 13:52:36 +0100 | [diff] [blame] | 380 | @$(MAKE) $(build)=perf |
| 381 | |
Jiri Olsa | cb4e67f | 2014-12-30 17:09:15 +0100 | [diff] [blame^] | 382 | $(OUTPUT)perf: $(BUILTIN_OBJS) $(PERFLIBS) $(PERF_IN) |
| 383 | $(QUIET_LINK)$(CC) $(CFLAGS) $(LDFLAGS) \ |
Jiri Olsa | 72965b8 | 2014-12-29 13:52:36 +0100 | [diff] [blame] | 384 | $(BUILTIN_OBJS) $(PERF_IN) $(LIBS) -o $@ |
Ingo Molnar | bd69cc2 | 2013-10-02 11:49:08 +0200 | [diff] [blame] | 385 | |
Jiri Olsa | 88aeea0 | 2014-12-30 00:34:23 +0100 | [diff] [blame] | 386 | $(GTK_IN): FORCE |
| 387 | @$(MAKE) $(build)=gtk |
Namhyung Kim | fc67297 | 2013-09-13 15:27:43 +0900 | [diff] [blame] | 388 | |
Jiri Olsa | 88aeea0 | 2014-12-30 00:34:23 +0100 | [diff] [blame] | 389 | $(OUTPUT)libperf-gtk.so: $(GTK_IN) $(PERFLIBS) |
Jiri Olsa | e27a08f | 2014-04-27 11:12:21 +0200 | [diff] [blame] | 390 | $(QUIET_LINK)$(CC) -o $@ -shared $(LDFLAGS) $(filter %.o,$^) $(GTK_LIBS) |
Namhyung Kim | fc67297 | 2013-09-13 15:27:43 +0900 | [diff] [blame] | 391 | |
Ingo Molnar | bd69cc2 | 2013-10-02 11:49:08 +0200 | [diff] [blame] | 392 | $(OUTPUT)common-cmds.h: util/generate-cmdlist.sh command-list.txt |
| 393 | |
| 394 | $(OUTPUT)common-cmds.h: $(wildcard Documentation/perf-*.txt) |
| 395 | $(QUIET_GEN). util/generate-cmdlist.sh > $@+ && mv $@+ $@ |
| 396 | |
| 397 | $(SCRIPTS) : % : %.sh |
| 398 | $(QUIET_GEN)$(INSTALL) '$@.sh' '$(OUTPUT)$@' |
| 399 | |
| 400 | # These can record PERF_VERSION |
Jiri Olsa | cb4e67f | 2014-12-30 17:09:15 +0100 | [diff] [blame^] | 401 | perf.spec $(SCRIPTS) \ |
Ingo Molnar | bd69cc2 | 2013-10-02 11:49:08 +0200 | [diff] [blame] | 402 | : $(OUTPUT)PERF-VERSION-FILE |
| 403 | |
| 404 | .SUFFIXES: |
Ingo Molnar | 1f7c645 | 2013-10-04 12:14:59 +0200 | [diff] [blame] | 405 | |
| 406 | # |
| 407 | # If a target does not match any of the later rules then prefix it by $(OUTPUT) |
| 408 | # This makes targets like 'make O=/tmp/perf perf.o' work in a natural way. |
| 409 | # |
| 410 | ifneq ($(OUTPUT),) |
| 411 | %.o: $(OUTPUT)%.o |
| 412 | @echo " # Redirected target $@ => $(OUTPUT)$@" |
| 413 | util/%.o: $(OUTPUT)util/%.o |
Ingo Molnar | cee972c | 2013-10-10 07:42:56 +0200 | [diff] [blame] | 414 | @echo " # Redirected target $@ => $(OUTPUT)$@" |
Ingo Molnar | 1f7c645 | 2013-10-04 12:14:59 +0200 | [diff] [blame] | 415 | bench/%.o: $(OUTPUT)bench/%.o |
Ingo Molnar | cee972c | 2013-10-10 07:42:56 +0200 | [diff] [blame] | 416 | @echo " # Redirected target $@ => $(OUTPUT)$@" |
Ingo Molnar | 1f7c645 | 2013-10-04 12:14:59 +0200 | [diff] [blame] | 417 | tests/%.o: $(OUTPUT)tests/%.o |
Ingo Molnar | cee972c | 2013-10-10 07:42:56 +0200 | [diff] [blame] | 418 | @echo " # Redirected target $@ => $(OUTPUT)$@" |
Ingo Molnar | 1f7c645 | 2013-10-04 12:14:59 +0200 | [diff] [blame] | 419 | endif |
Ingo Molnar | bd69cc2 | 2013-10-02 11:49:08 +0200 | [diff] [blame] | 420 | |
| 421 | # These two need to be here so that when O= is not used they take precedence |
| 422 | # over the general rule for .o |
| 423 | |
Ingo Molnar | bd69cc2 | 2013-10-02 11:49:08 +0200 | [diff] [blame] | 424 | $(OUTPUT)%.o: %.c $(OUTPUT)PERF-CFLAGS |
| 425 | $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) $< |
| 426 | $(OUTPUT)%.i: %.c $(OUTPUT)PERF-CFLAGS |
| 427 | $(QUIET_CC)$(CC) -o $@ -E $(CFLAGS) $< |
| 428 | $(OUTPUT)%.s: %.c $(OUTPUT)PERF-CFLAGS |
| 429 | $(QUIET_CC)$(CC) -o $@ -S $(CFLAGS) $< |
| 430 | $(OUTPUT)%.o: %.S |
| 431 | $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) $< |
| 432 | $(OUTPUT)%.s: %.S |
| 433 | $(QUIET_CC)$(CC) -o $@ -E $(CFLAGS) $< |
| 434 | |
Ingo Molnar | bd69cc2 | 2013-10-02 11:49:08 +0200 | [diff] [blame] | 435 | $(OUTPUT)perf-%: %.o $(PERFLIBS) |
| 436 | $(QUIET_LINK)$(CC) $(CFLAGS) -o $@ $(LDFLAGS) $(filter %.o,$^) $(LIBS) |
| 437 | |
Adrian Hunter | e477f3f | 2014-10-23 18:16:03 -0300 | [diff] [blame] | 438 | ifndef NO_PERF_READ_VDSO32 |
| 439 | $(OUTPUT)perf-read-vdso32: perf-read-vdso.c util/find-vdso-map.c |
| 440 | $(QUIET_CC)$(CC) -m32 $(filter -static,$(LDFLAGS)) -Wall -Werror -o $@ perf-read-vdso.c |
| 441 | endif |
| 442 | |
| 443 | ifndef NO_PERF_READ_VDSOX32 |
| 444 | $(OUTPUT)perf-read-vdsox32: perf-read-vdso.c util/find-vdso-map.c |
| 445 | $(QUIET_CC)$(CC) -mx32 $(filter -static,$(LDFLAGS)) -Wall -Werror -o $@ perf-read-vdso.c |
| 446 | endif |
| 447 | |
Ingo Molnar | bd69cc2 | 2013-10-02 11:49:08 +0200 | [diff] [blame] | 448 | $(LIB_OBJS) $(BUILTIN_OBJS): $(LIB_H) |
| 449 | $(patsubst perf-%,%.o,$(PROGRAMS)): $(LIB_H) $(wildcard */*.h) |
| 450 | |
| 451 | # we compile into subdirectories. if the target directory is not the source directory, they might not exists. So |
| 452 | # we depend the various files onto their directories. |
Namhyung Kim | fc67297 | 2013-09-13 15:27:43 +0900 | [diff] [blame] | 453 | DIRECTORY_DEPS = $(LIB_OBJS) $(BUILTIN_OBJS) $(GTK_OBJS) |
| 454 | DIRECTORY_DEPS += $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)common-cmds.h |
Jiri Olsa | da237ed | 2014-02-19 11:21:40 +0100 | [diff] [blame] | 455 | # no need to add flex objects, because they depend on bison ones |
| 456 | DIRECTORY_DEPS += $(OUTPUT)util/parse-events-bison.c |
| 457 | DIRECTORY_DEPS += $(OUTPUT)util/pmu-bison.c |
| 458 | |
| 459 | OUTPUT_DIRECTORIES := $(sort $(dir $(DIRECTORY_DEPS))) |
| 460 | |
| 461 | $(DIRECTORY_DEPS): | $(OUTPUT_DIRECTORIES) |
Ingo Molnar | bd69cc2 | 2013-10-02 11:49:08 +0200 | [diff] [blame] | 462 | # In the second step, we make a rule to actually create these directories |
Jiri Olsa | da237ed | 2014-02-19 11:21:40 +0100 | [diff] [blame] | 463 | $(OUTPUT_DIRECTORIES): |
Ingo Molnar | bd69cc2 | 2013-10-02 11:49:08 +0200 | [diff] [blame] | 464 | $(QUIET_MKDIR)$(MKDIR) -p $@ 2>/dev/null |
| 465 | |
Jiri Olsa | 9352aab | 2014-12-29 17:42:46 +0100 | [diff] [blame] | 466 | LIBPERF_IN := $(OUTPUT)libperf-in.o |
| 467 | |
| 468 | $(LIBPERF_IN): FORCE |
| 469 | @$(MAKE) $(build)=libperf |
| 470 | |
| 471 | $(LIB_FILE): $(LIB_OBJS) $(LIBPERF_IN) |
| 472 | $(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $(LIBPERF_IN) $(LIB_OBJS) |
Ingo Molnar | bd69cc2 | 2013-10-02 11:49:08 +0200 | [diff] [blame] | 473 | |
| 474 | # libtraceevent.a |
| 475 | TE_SOURCES = $(wildcard $(TRACE_EVENT_DIR)*.[ch]) |
| 476 | |
Jiri Olsa | 3d7c014 | 2013-12-03 14:09:21 +0100 | [diff] [blame] | 477 | LIBTRACEEVENT_FLAGS = $(QUIET_SUBDIR1) O=$(OUTPUT) |
| 478 | LIBTRACEEVENT_FLAGS += CFLAGS="-g -Wall $(EXTRA_CFLAGS)" |
| 479 | LIBTRACEEVENT_FLAGS += plugin_dir=$(plugindir_SQ) |
| 480 | |
| 481 | $(LIBTRACEEVENT): $(TE_SOURCES) $(OUTPUT)PERF-CFLAGS |
| 482 | $(QUIET_SUBDIR0)$(TRACE_EVENT_DIR) $(LIBTRACEEVENT_FLAGS) libtraceevent.a plugins |
Ingo Molnar | bd69cc2 | 2013-10-02 11:49:08 +0200 | [diff] [blame] | 483 | |
| 484 | $(LIBTRACEEVENT)-clean: |
Ingo Molnar | 8ec19c0 | 2013-10-09 11:49:26 +0200 | [diff] [blame] | 485 | $(call QUIET_CLEAN, libtraceevent) |
| 486 | @$(MAKE) -C $(TRACE_EVENT_DIR) O=$(OUTPUT) clean >/dev/null |
Ingo Molnar | bd69cc2 | 2013-10-02 11:49:08 +0200 | [diff] [blame] | 487 | |
Jiri Olsa | 7897907 | 2013-12-05 12:13:54 +0100 | [diff] [blame] | 488 | install-traceevent-plugins: $(LIBTRACEEVENT) |
Jiri Olsa | 3d7c014 | 2013-12-03 14:09:21 +0100 | [diff] [blame] | 489 | $(QUIET_SUBDIR0)$(TRACE_EVENT_DIR) $(LIBTRACEEVENT_FLAGS) install_plugins |
| 490 | |
Arnaldo Carvalho de Melo | 1b85337 | 2014-09-03 18:02:59 -0300 | [diff] [blame] | 491 | LIBAPIKFS_SOURCES = $(wildcard $(LIB_PATH)fs/*.[ch] $(LIB_PATH)fd/*.[ch]) |
Ingo Molnar | bd69cc2 | 2013-10-02 11:49:08 +0200 | [diff] [blame] | 492 | |
| 493 | # if subdir is set, we've been called from above so target has been built |
| 494 | # already |
Borislav Petkov | 553873e | 2013-12-09 17:14:23 +0100 | [diff] [blame] | 495 | $(LIBAPIKFS): $(LIBAPIKFS_SOURCES) |
Ingo Molnar | bd69cc2 | 2013-10-02 11:49:08 +0200 | [diff] [blame] | 496 | ifeq ($(subdir),) |
Borislav Petkov | 553873e | 2013-12-09 17:14:23 +0100 | [diff] [blame] | 497 | $(QUIET_SUBDIR0)$(LIB_DIR) $(QUIET_SUBDIR1) O=$(OUTPUT) libapikfs.a |
Ingo Molnar | bd69cc2 | 2013-10-02 11:49:08 +0200 | [diff] [blame] | 498 | endif |
| 499 | |
Borislav Petkov | 553873e | 2013-12-09 17:14:23 +0100 | [diff] [blame] | 500 | $(LIBAPIKFS)-clean: |
Ingo Molnar | bd69cc2 | 2013-10-02 11:49:08 +0200 | [diff] [blame] | 501 | ifeq ($(subdir),) |
Borislav Petkov | 553873e | 2013-12-09 17:14:23 +0100 | [diff] [blame] | 502 | $(call QUIET_CLEAN, libapikfs) |
| 503 | @$(MAKE) -C $(LIB_DIR) O=$(OUTPUT) clean >/dev/null |
Ingo Molnar | bd69cc2 | 2013-10-02 11:49:08 +0200 | [diff] [blame] | 504 | endif |
| 505 | |
| 506 | help: |
| 507 | @echo 'Perf make targets:' |
| 508 | @echo ' doc - make *all* documentation (see below)' |
| 509 | @echo ' man - make manpage documentation (access with man <foo>)' |
| 510 | @echo ' html - make html documentation' |
| 511 | @echo ' info - make GNU info documentation (access with info <foo>)' |
| 512 | @echo ' pdf - make pdf documentation' |
| 513 | @echo ' TAGS - use etags to make tag information for source browsing' |
| 514 | @echo ' tags - use ctags to make tag information for source browsing' |
| 515 | @echo ' cscope - use cscope to make interactive browsing database' |
| 516 | @echo '' |
| 517 | @echo 'Perf install targets:' |
| 518 | @echo ' NOTE: documentation build requires asciidoc, xmlto packages to be installed' |
Jianyu Zhan | fc9cabe | 2014-06-03 00:44:34 +0800 | [diff] [blame] | 519 | @echo ' HINT: use "prefix" or "DESTDIR" to install to a particular' |
| 520 | @echo ' path like "make prefix=/usr/local install install-doc"' |
Ingo Molnar | bd69cc2 | 2013-10-02 11:49:08 +0200 | [diff] [blame] | 521 | @echo ' install - install compiled binaries' |
| 522 | @echo ' install-doc - install *all* documentation' |
| 523 | @echo ' install-man - install manpage documentation' |
| 524 | @echo ' install-html - install html documentation' |
| 525 | @echo ' install-info - install GNU info documentation' |
| 526 | @echo ' install-pdf - install pdf documentation' |
| 527 | @echo '' |
| 528 | @echo ' quick-install-doc - alias for quick-install-man' |
| 529 | @echo ' quick-install-man - install the documentation quickly' |
| 530 | @echo ' quick-install-html - install the html documentation quickly' |
| 531 | @echo '' |
| 532 | @echo 'Perf maintainer targets:' |
| 533 | @echo ' clean - clean all binary objects and build output' |
| 534 | |
| 535 | |
| 536 | DOC_TARGETS := doc man html info pdf |
| 537 | |
| 538 | INSTALL_DOC_TARGETS := $(patsubst %,install-%,$(DOC_TARGETS)) try-install-man |
| 539 | INSTALL_DOC_TARGETS += quick-install-doc quick-install-man quick-install-html |
| 540 | |
| 541 | # 'make doc' should call 'make -C Documentation all' |
| 542 | $(DOC_TARGETS): |
| 543 | $(QUIET_SUBDIR0)Documentation $(QUIET_SUBDIR1) $(@:doc=all) |
| 544 | |
Sebastian Andrzej Siewior | 16a6433 | 2014-05-28 10:19:18 +0200 | [diff] [blame] | 545 | TAG_FOLDERS= . ../lib/traceevent ../lib/api ../lib/symbol |
| 546 | TAG_FILES= ../../include/uapi/linux/perf_event.h |
| 547 | |
Ingo Molnar | bd69cc2 | 2013-10-02 11:49:08 +0200 | [diff] [blame] | 548 | TAGS: |
Jiri Olsa | b0815d0 | 2014-06-04 14:43:58 +0200 | [diff] [blame] | 549 | $(QUIET_GEN)$(RM) TAGS; \ |
Sebastian Andrzej Siewior | 16a6433 | 2014-05-28 10:19:18 +0200 | [diff] [blame] | 550 | $(FIND) $(TAG_FOLDERS) -name '*.[hcS]' -print | xargs etags -a $(TAG_FILES) |
Ingo Molnar | bd69cc2 | 2013-10-02 11:49:08 +0200 | [diff] [blame] | 551 | |
| 552 | tags: |
Jiri Olsa | b0815d0 | 2014-06-04 14:43:58 +0200 | [diff] [blame] | 553 | $(QUIET_GEN)$(RM) tags; \ |
Sebastian Andrzej Siewior | 16a6433 | 2014-05-28 10:19:18 +0200 | [diff] [blame] | 554 | $(FIND) $(TAG_FOLDERS) -name '*.[hcS]' -print | xargs ctags -a $(TAG_FILES) |
Ingo Molnar | bd69cc2 | 2013-10-02 11:49:08 +0200 | [diff] [blame] | 555 | |
| 556 | cscope: |
Jiri Olsa | b0815d0 | 2014-06-04 14:43:58 +0200 | [diff] [blame] | 557 | $(QUIET_GEN)$(RM) cscope*; \ |
Sebastian Andrzej Siewior | 16a6433 | 2014-05-28 10:19:18 +0200 | [diff] [blame] | 558 | $(FIND) $(TAG_FOLDERS) -name '*.[hcS]' -print | xargs cscope -b $(TAG_FILES) |
Ingo Molnar | bd69cc2 | 2013-10-02 11:49:08 +0200 | [diff] [blame] | 559 | |
| 560 | ### Detect prefix changes |
| 561 | TRACK_CFLAGS = $(subst ','\'',$(CFLAGS)):\ |
Jiri Olsa | 3d7c014 | 2013-12-03 14:09:21 +0100 | [diff] [blame] | 562 | $(bindir_SQ):$(perfexecdir_SQ):$(template_dir_SQ):$(prefix_SQ):$(plugindir_SQ) |
Ingo Molnar | bd69cc2 | 2013-10-02 11:49:08 +0200 | [diff] [blame] | 563 | |
| 564 | $(OUTPUT)PERF-CFLAGS: .FORCE-PERF-CFLAGS |
| 565 | @FLAGS='$(TRACK_CFLAGS)'; \ |
| 566 | if test x"$$FLAGS" != x"`cat $(OUTPUT)PERF-CFLAGS 2>/dev/null`" ; then \ |
Ingo Molnar | 65fb099 | 2013-10-09 11:49:27 +0200 | [diff] [blame] | 567 | echo 1>&2 " FLAGS: * new build flags or prefix"; \ |
Ingo Molnar | bd69cc2 | 2013-10-02 11:49:08 +0200 | [diff] [blame] | 568 | echo "$$FLAGS" >$(OUTPUT)PERF-CFLAGS; \ |
| 569 | fi |
| 570 | |
| 571 | ### Testing rules |
| 572 | |
| 573 | # GNU make supports exporting all variables by "export" without parameters. |
| 574 | # However, the environment gets quite big, and some programs have problems |
| 575 | # with that. |
| 576 | |
| 577 | check: $(OUTPUT)common-cmds.h |
| 578 | if sparse; \ |
| 579 | then \ |
| 580 | for i in *.c */*.c; \ |
| 581 | do \ |
| 582 | sparse $(CFLAGS) $(SPARSE_FLAGS) $$i || exit; \ |
| 583 | done; \ |
| 584 | else \ |
| 585 | exit 1; \ |
| 586 | fi |
| 587 | |
| 588 | ### Installation rules |
| 589 | |
Namhyung Kim | fc67297 | 2013-09-13 15:27:43 +0900 | [diff] [blame] | 590 | install-gtk: |
| 591 | |
| 592 | install-bin: all install-gtk |
Ingo Molnar | 8a5411e9 | 2013-10-09 11:49:29 +0200 | [diff] [blame] | 593 | $(call QUIET_INSTALL, binaries) \ |
| 594 | $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(bindir_SQ)'; \ |
| 595 | $(INSTALL) $(OUTPUT)perf '$(DESTDIR_SQ)$(bindir_SQ)'; \ |
| 596 | $(LN) '$(DESTDIR_SQ)$(bindir_SQ)/perf' '$(DESTDIR_SQ)$(bindir_SQ)/trace' |
Adrian Hunter | e477f3f | 2014-10-23 18:16:03 -0300 | [diff] [blame] | 597 | ifndef NO_PERF_READ_VDSO32 |
| 598 | $(call QUIET_INSTALL, perf-read-vdso32) \ |
| 599 | $(INSTALL) $(OUTPUT)perf-read-vdso32 '$(DESTDIR_SQ)$(bindir_SQ)'; |
| 600 | endif |
| 601 | ifndef NO_PERF_READ_VDSOX32 |
| 602 | $(call QUIET_INSTALL, perf-read-vdsox32) \ |
| 603 | $(INSTALL) $(OUTPUT)perf-read-vdsox32 '$(DESTDIR_SQ)$(bindir_SQ)'; |
| 604 | endif |
Ingo Molnar | 8a5411e9 | 2013-10-09 11:49:29 +0200 | [diff] [blame] | 605 | $(call QUIET_INSTALL, libexec) \ |
| 606 | $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)' |
| 607 | $(call QUIET_INSTALL, perf-archive) \ |
| 608 | $(INSTALL) $(OUTPUT)perf-archive -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)' |
Adrian Hunter | c501e90 | 2014-07-31 09:01:12 +0300 | [diff] [blame] | 609 | $(call QUIET_INSTALL, perf-with-kcore) \ |
| 610 | $(INSTALL) $(OUTPUT)perf-with-kcore -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)' |
Ingo Molnar | bd69cc2 | 2013-10-02 11:49:08 +0200 | [diff] [blame] | 611 | ifndef NO_LIBPERL |
Ingo Molnar | 8a5411e9 | 2013-10-09 11:49:29 +0200 | [diff] [blame] | 612 | $(call QUIET_INSTALL, perl-scripts) \ |
| 613 | $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/Perf-Trace-Util/lib/Perf/Trace'; \ |
| 614 | $(INSTALL) scripts/perl/Perf-Trace-Util/lib/Perf/Trace/* -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/Perf-Trace-Util/lib/Perf/Trace'; \ |
| 615 | $(INSTALL) scripts/perl/*.pl -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl'; \ |
| 616 | $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/bin'; \ |
| 617 | $(INSTALL) scripts/perl/bin/* -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/bin' |
Ingo Molnar | bd69cc2 | 2013-10-02 11:49:08 +0200 | [diff] [blame] | 618 | endif |
| 619 | ifndef NO_LIBPYTHON |
Ingo Molnar | 8a5411e9 | 2013-10-09 11:49:29 +0200 | [diff] [blame] | 620 | $(call QUIET_INSTALL, python-scripts) \ |
| 621 | $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python/Perf-Trace-Util/lib/Perf/Trace'; \ |
| 622 | $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python/bin'; \ |
| 623 | $(INSTALL) scripts/python/Perf-Trace-Util/lib/Perf/Trace/* -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python/Perf-Trace-Util/lib/Perf/Trace'; \ |
| 624 | $(INSTALL) scripts/python/*.py -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python'; \ |
| 625 | $(INSTALL) scripts/python/bin/* -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python/bin' |
Ingo Molnar | bd69cc2 | 2013-10-02 11:49:08 +0200 | [diff] [blame] | 626 | endif |
Ramkumar Ramachandra | a8b4c701 | 2013-11-17 21:43:27 +0530 | [diff] [blame] | 627 | $(call QUIET_INSTALL, perf_completion-script) \ |
Ingo Molnar | 8a5411e9 | 2013-10-09 11:49:29 +0200 | [diff] [blame] | 628 | $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(sysconfdir_SQ)/bash_completion.d'; \ |
Ramkumar Ramachandra | a8b4c701 | 2013-11-17 21:43:27 +0530 | [diff] [blame] | 629 | $(INSTALL) perf-completion.sh '$(DESTDIR_SQ)$(sysconfdir_SQ)/bash_completion.d/perf' |
Ingo Molnar | 8a5411e9 | 2013-10-09 11:49:29 +0200 | [diff] [blame] | 630 | $(call QUIET_INSTALL, tests) \ |
| 631 | $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests'; \ |
| 632 | $(INSTALL) tests/attr.py '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests'; \ |
| 633 | $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/attr'; \ |
| 634 | $(INSTALL) tests/attr/* '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/attr' |
Ingo Molnar | bd69cc2 | 2013-10-02 11:49:08 +0200 | [diff] [blame] | 635 | |
Jiri Olsa | 3d7c014 | 2013-12-03 14:09:21 +0100 | [diff] [blame] | 636 | install: install-bin try-install-man install-traceevent-plugins |
Ingo Molnar | bd69cc2 | 2013-10-02 11:49:08 +0200 | [diff] [blame] | 637 | |
| 638 | install-python_ext: |
| 639 | $(PYTHON_WORD) util/setup.py --quiet install --root='/$(DESTDIR_SQ)' |
| 640 | |
| 641 | # 'make install-doc' should call 'make -C Documentation install' |
| 642 | $(INSTALL_DOC_TARGETS): |
| 643 | $(QUIET_SUBDIR0)Documentation $(QUIET_SUBDIR1) $(@:-doc=) |
| 644 | |
| 645 | ### Cleaning rules |
| 646 | |
| 647 | # |
| 648 | # This is here, not in config/Makefile, because config/Makefile does |
| 649 | # not get included for the clean target: |
| 650 | # |
| 651 | config-clean: |
Ingo Molnar | 8ec19c0 | 2013-10-09 11:49:26 +0200 | [diff] [blame] | 652 | $(call QUIET_CLEAN, config) |
| 653 | @$(MAKE) -C config/feature-checks clean >/dev/null |
Ingo Molnar | bd69cc2 | 2013-10-02 11:49:08 +0200 | [diff] [blame] | 654 | |
Borislav Petkov | 553873e | 2013-12-09 17:14:23 +0100 | [diff] [blame] | 655 | clean: $(LIBTRACEEVENT)-clean $(LIBAPIKFS)-clean config-clean |
Jiri Olsa | cb4e67f | 2014-12-30 17:09:15 +0100 | [diff] [blame^] | 656 | $(call QUIET_CLEAN, core-objs) $(RM) $(LIB_OBJS) $(BUILTIN_OBJS) $(LIB_FILE) $(OUTPUT)perf-archive $(OUTPUT)perf-with-kcore $(LANG_BINDINGS) |
Jiri Olsa | 72965b8 | 2014-12-29 13:52:36 +0100 | [diff] [blame] | 657 | @find . -name '*.o' -delete -o -name '\.*.cmd' -delete -o -name '\.*.d' -delete |
| 658 | @$(RM) .config-detected |
Adrian Hunter | e477f3f | 2014-10-23 18:16:03 -0300 | [diff] [blame] | 659 | $(call QUIET_CLEAN, core-progs) $(RM) $(ALL_PROGRAMS) perf perf-read-vdso32 perf-read-vdsox32 |
Jiri Olsa | 0695e57 | 2014-02-19 16:52:54 +0100 | [diff] [blame] | 660 | $(call QUIET_CLEAN, core-gen) $(RM) *.spec *.pyc *.pyo */*.pyc */*.pyo $(OUTPUT)common-cmds.h TAGS tags cscope* $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)PERF-CFLAGS $(OUTPUT)PERF-FEATURES $(OUTPUT)util/*-bison* $(OUTPUT)util/*-flex* |
Borislav Petkov | 553873e | 2013-12-09 17:14:23 +0100 | [diff] [blame] | 661 | $(QUIET_SUBDIR0)Documentation $(QUIET_SUBDIR1) clean |
Ingo Molnar | bd69cc2 | 2013-10-02 11:49:08 +0200 | [diff] [blame] | 662 | $(python-clean) |
| 663 | |
| 664 | # |
| 665 | # Trick: if ../../.git does not exist - we are building out of tree for example, |
| 666 | # then force version regeneration: |
| 667 | # |
| 668 | ifeq ($(wildcard ../../.git/HEAD),) |
| 669 | GIT-HEAD-PHONY = ../../.git/HEAD |
| 670 | else |
| 671 | GIT-HEAD-PHONY = |
| 672 | endif |
| 673 | |
Jiri Olsa | 72965b8 | 2014-12-29 13:52:36 +0100 | [diff] [blame] | 674 | FORCE: |
| 675 | |
Namhyung Kim | fc67297 | 2013-09-13 15:27:43 +0900 | [diff] [blame] | 676 | .PHONY: all install clean config-clean strip install-gtk |
Ingo Molnar | bd69cc2 | 2013-10-02 11:49:08 +0200 | [diff] [blame] | 677 | .PHONY: shell_compatibility_test please_set_SHELL_PATH_to_a_more_modern_shell |
Jiri Olsa | 72965b8 | 2014-12-29 13:52:36 +0100 | [diff] [blame] | 678 | .PHONY: $(GIT-HEAD-PHONY) TAGS tags cscope .FORCE-PERF-CFLAGS FORCE |
Ingo Molnar | bd69cc2 | 2013-10-02 11:49:08 +0200 | [diff] [blame] | 679 | |