Jiri Olsa | 8bd407b | 2013-03-15 16:28:49 +0100 | [diff] [blame] | 1 | |
Jiri Olsa | a6cf5f3 | 2014-01-03 15:32:32 +0100 | [diff] [blame] | 2 | ifeq ($(src-perf),) |
| 3 | src-perf := $(srctree)/tools/perf |
Jiri Olsa | 8bd407b | 2013-03-15 16:28:49 +0100 | [diff] [blame] | 4 | endif |
| 5 | |
Jiri Olsa | a6cf5f3 | 2014-01-03 15:32:32 +0100 | [diff] [blame] | 6 | ifeq ($(obj-perf),) |
| 7 | obj-perf := $(OUTPUT) |
| 8 | endif |
| 9 | |
| 10 | ifneq ($(obj-perf),) |
| 11 | obj-perf := $(abspath $(obj-perf))/ |
| 12 | endif |
| 13 | |
Jiri Olsa | fcfd661 | 2014-12-31 17:37:00 +0100 | [diff] [blame] | 14 | $(shell echo -n > .config-detected) |
| 15 | detected = $(shell echo "$(1)=y" >> .config-detected) |
| 16 | detected_var = $(shell echo "$(1)=$($(1))" >> .config-detected) |
| 17 | |
Jiri Olsa | a6cf5f3 | 2014-01-03 15:32:32 +0100 | [diff] [blame] | 18 | LIB_INCLUDE := $(srctree)/tools/lib/ |
| 19 | CFLAGS := $(EXTRA_CFLAGS) $(EXTRA_WARNINGS) |
| 20 | |
| 21 | include $(src-perf)/config/Makefile.arch |
| 22 | |
Jiri Olsa | f39e042 | 2014-12-29 15:03:09 +0100 | [diff] [blame] | 23 | $(call detected_var,ARCH) |
| 24 | |
Jiri Olsa | a6cf5f3 | 2014-01-03 15:32:32 +0100 | [diff] [blame] | 25 | NO_PERF_REGS := 1 |
| 26 | |
| 27 | # Additional ARCH settings for x86 |
| 28 | ifeq ($(ARCH),x86) |
Jiri Olsa | f39e042 | 2014-12-29 15:03:09 +0100 | [diff] [blame] | 29 | $(call detected,CONFIG_X86) |
Namhyung Kim | c6e5e9f | 2015-01-12 10:20:55 +0800 | [diff] [blame] | 30 | ifeq (${IS_64_BIT}, 1) |
Ingo Molnar | 89fe808 | 2013-09-30 12:07:11 +0200 | [diff] [blame] | 31 | CFLAGS += -DHAVE_ARCH_X86_64_SUPPORT |
Jiri Olsa | 8e1b3f6 | 2013-04-15 04:06:58 +0200 | [diff] [blame] | 32 | ARCH_INCLUDE = ../../arch/x86/lib/memcpy_64.S ../../arch/x86/lib/memset_64.S |
Adrian Hunter | 8a0c4c2 | 2013-11-01 15:51:32 +0200 | [diff] [blame] | 33 | LIBUNWIND_LIBS = -lunwind -lunwind-x86_64 |
Jiri Olsa | 72965b8 | 2014-12-29 13:52:36 +0100 | [diff] [blame] | 34 | $(call detected,CONFIG_X86_64) |
Adrian Hunter | 8a0c4c2 | 2013-11-01 15:51:32 +0200 | [diff] [blame] | 35 | else |
| 36 | LIBUNWIND_LIBS = -lunwind -lunwind-x86 |
Jiri Olsa | 8e1b3f6 | 2013-04-15 04:06:58 +0200 | [diff] [blame] | 37 | endif |
| 38 | NO_PERF_REGS := 0 |
Jiri Olsa | 8bd407b | 2013-03-15 16:28:49 +0100 | [diff] [blame] | 39 | endif |
Jean Pihet | 8ab596a | 2014-04-28 14:32:33 +0200 | [diff] [blame] | 40 | |
Will Deacon | 7495f37 | 2013-09-26 12:36:36 +0100 | [diff] [blame] | 41 | ifeq ($(ARCH),arm) |
| 42 | NO_PERF_REGS := 0 |
| 43 | LIBUNWIND_LIBS = -lunwind -lunwind-arm |
| 44 | endif |
Jiri Olsa | 8bd407b | 2013-03-15 16:28:49 +0100 | [diff] [blame] | 45 | |
Jean Pihet | 8ab596a | 2014-04-28 14:32:33 +0200 | [diff] [blame] | 46 | ifeq ($(ARCH),arm64) |
| 47 | NO_PERF_REGS := 0 |
| 48 | LIBUNWIND_LIBS = -lunwind -lunwind-aarch64 |
| 49 | endif |
| 50 | |
Jiri Olsa | 3bc3374 | 2014-12-30 13:30:04 +0100 | [diff] [blame] | 51 | ifeq ($(NO_PERF_REGS),0) |
| 52 | $(call detected,CONFIG_PERF_REGS) |
| 53 | endif |
| 54 | |
Jean Pihet | 90fa9de | 2014-05-16 10:41:11 +0200 | [diff] [blame] | 55 | # So far there's only x86 and arm libdw unwind support merged in perf. |
Jiri Olsa | 4dc549e | 2014-04-20 10:50:00 +0200 | [diff] [blame] | 56 | # Disable it on all other architectures in case libdw unwind |
| 57 | # support is detected in system. Add supported architectures |
| 58 | # to the check. |
Jean Pihet | 90fa9de | 2014-05-16 10:41:11 +0200 | [diff] [blame] | 59 | ifneq ($(ARCH),$(filter $(ARCH),x86 arm)) |
Jiri Olsa | 4dc549e | 2014-04-20 10:50:00 +0200 | [diff] [blame] | 60 | NO_LIBDW_DWARF_UNWIND := 1 |
| 61 | endif |
| 62 | |
Jean Pihet | 1448fef | 2013-12-10 13:24:04 +0100 | [diff] [blame] | 63 | ifeq ($(LIBUNWIND_LIBS),) |
| 64 | NO_LIBUNWIND := 1 |
| 65 | else |
| 66 | # |
| 67 | # For linking with debug library, run like: |
| 68 | # |
| 69 | # make DEBUG=1 LIBUNWIND_DIR=/opt/libunwind/ |
| 70 | # |
| 71 | ifdef LIBUNWIND_DIR |
| 72 | LIBUNWIND_CFLAGS = -I$(LIBUNWIND_DIR)/include |
| 73 | LIBUNWIND_LDFLAGS = -L$(LIBUNWIND_DIR)/lib |
| 74 | endif |
| 75 | LIBUNWIND_LDFLAGS += $(LIBUNWIND_LIBS) |
| 76 | |
| 77 | # Set per-feature check compilation flags |
| 78 | FEATURE_CHECK_CFLAGS-libunwind = $(LIBUNWIND_CFLAGS) |
| 79 | FEATURE_CHECK_LDFLAGS-libunwind = $(LIBUNWIND_LDFLAGS) |
| 80 | FEATURE_CHECK_CFLAGS-libunwind-debug-frame = $(LIBUNWIND_CFLAGS) |
| 81 | FEATURE_CHECK_LDFLAGS-libunwind-debug-frame = $(LIBUNWIND_LDFLAGS) |
Jean Pihet | 1448fef | 2013-12-10 13:24:04 +0100 | [diff] [blame] | 82 | endif |
| 83 | |
Jiri Olsa | 8bd407b | 2013-03-15 16:28:49 +0100 | [diff] [blame] | 84 | ifeq ($(NO_PERF_REGS),0) |
Ingo Molnar | 89fe808 | 2013-09-30 12:07:11 +0200 | [diff] [blame] | 85 | CFLAGS += -DHAVE_PERF_REGS_SUPPORT |
Jiri Olsa | 8bd407b | 2013-03-15 16:28:49 +0100 | [diff] [blame] | 86 | endif |
Jiri Olsa | a32f493 | 2013-03-25 00:32:01 +0100 | [diff] [blame] | 87 | |
Jiri Olsa | 4575789 | 2014-02-19 16:52:56 +0100 | [diff] [blame] | 88 | ifndef NO_LIBELF |
| 89 | # for linking with debug library, run like: |
| 90 | # make DEBUG=1 LIBDW_DIR=/opt/libdw/ |
| 91 | ifdef LIBDW_DIR |
| 92 | LIBDW_CFLAGS := -I$(LIBDW_DIR)/include |
| 93 | LIBDW_LDFLAGS := -L$(LIBDW_DIR)/lib |
Jiri Olsa | 4575789 | 2014-02-19 16:52:56 +0100 | [diff] [blame] | 94 | endif |
Ramkumar Ramachandra | 2c529e4 | 2014-03-26 18:44:05 -0400 | [diff] [blame] | 95 | FEATURE_CHECK_CFLAGS-libdw-dwarf-unwind := $(LIBDW_CFLAGS) |
| 96 | FEATURE_CHECK_LDFLAGS-libdw-dwarf-unwind := $(LIBDW_LDFLAGS) -ldw |
Jiri Olsa | 4575789 | 2014-02-19 16:52:56 +0100 | [diff] [blame] | 97 | endif |
| 98 | |
Jiri Olsa | 53d0a57 | 2015-02-20 23:16:58 +0100 | [diff] [blame] | 99 | ifndef NO_LIBBABELTRACE |
| 100 | # for linking with debug library, run like: |
| 101 | # make DEBUG=1 LIBBABELTRACE_DIR=/opt/libbabeltrace/ |
| 102 | ifdef LIBBABELTRACE_DIR |
| 103 | LIBBABELTRACE_CFLAGS := -I$(LIBBABELTRACE_DIR)/include |
| 104 | LIBBABELTRACE_LDFLAGS := -L$(LIBBABELTRACE_DIR)/lib |
| 105 | endif |
| 106 | FEATURE_CHECK_CFLAGS-libbabeltrace := $(LIBBABELTRACE_CFLAGS) |
| 107 | FEATURE_CHECK_LDFLAGS-libbabeltrace := $(LIBBABELTRACE_LDFLAGS) -lbabeltrace-ctf |
| 108 | endif |
| 109 | |
Jiri Olsa | 7c53746 | 2013-05-24 14:35:23 +0200 | [diff] [blame] | 110 | # include ARCH specific config |
| 111 | -include $(src-perf)/arch/$(ARCH)/Makefile |
| 112 | |
Jiri Olsa | 7c53746 | 2013-05-24 14:35:23 +0200 | [diff] [blame] | 113 | include $(src-perf)/config/utilities.mak |
Jiri Olsa | a32f493 | 2013-03-25 00:32:01 +0100 | [diff] [blame] | 114 | |
| 115 | ifeq ($(call get-executable,$(FLEX)),) |
Jiri Olsa | 8e1b3f6 | 2013-04-15 04:06:58 +0200 | [diff] [blame] | 116 | dummy := $(error Error: $(FLEX) is missing on this system, please install it) |
Jiri Olsa | a32f493 | 2013-03-25 00:32:01 +0100 | [diff] [blame] | 117 | endif |
| 118 | |
| 119 | ifeq ($(call get-executable,$(BISON)),) |
Jiri Olsa | 8e1b3f6 | 2013-04-15 04:06:58 +0200 | [diff] [blame] | 120 | dummy := $(error Error: $(BISON) is missing on this system, please install it) |
Jiri Olsa | a32f493 | 2013-03-25 00:32:01 +0100 | [diff] [blame] | 121 | endif |
Jiri Olsa | 362493f | 2013-03-25 00:40:48 +0100 | [diff] [blame] | 122 | |
| 123 | # Treat warnings as errors unless directed not to |
| 124 | ifneq ($(WERROR),0) |
Jiri Olsa | 8e1b3f6 | 2013-04-15 04:06:58 +0200 | [diff] [blame] | 125 | CFLAGS += -Werror |
Jiri Olsa | 362493f | 2013-03-25 00:40:48 +0100 | [diff] [blame] | 126 | endif |
| 127 | |
Adrian Hunter | 74af377 | 2013-10-22 10:34:05 +0300 | [diff] [blame] | 128 | ifndef DEBUG |
| 129 | DEBUG := 0 |
| 130 | endif |
| 131 | |
Ingo Molnar | fcf9258 | 2013-10-10 08:05:25 +0200 | [diff] [blame] | 132 | ifeq ($(DEBUG),0) |
Jiri Olsa | 8e1b3f6 | 2013-04-15 04:06:58 +0200 | [diff] [blame] | 133 | CFLAGS += -O6 |
Jiri Olsa | 362493f | 2013-03-25 00:40:48 +0100 | [diff] [blame] | 134 | endif |
| 135 | |
| 136 | ifdef PARSER_DEBUG |
Jiri Olsa | 8e1b3f6 | 2013-04-15 04:06:58 +0200 | [diff] [blame] | 137 | PARSER_DEBUG_BISON := -t |
| 138 | PARSER_DEBUG_FLEX := -d |
| 139 | CFLAGS += -DPARSER_DEBUG |
Jiri Olsa | 9352aab | 2014-12-29 17:42:46 +0100 | [diff] [blame] | 140 | $(call detected_var,PARSER_DEBUG_BISON) |
| 141 | $(call detected_var,PARSER_DEBUG_FLEX) |
Jiri Olsa | 362493f | 2013-03-25 00:40:48 +0100 | [diff] [blame] | 142 | endif |
| 143 | |
Namhyung Kim | 56c7d79 | 2014-07-29 15:57:19 +0900 | [diff] [blame] | 144 | ifndef NO_LIBPYTHON |
Thomas Ilsche | d6a947f | 2014-08-04 15:03:15 +0200 | [diff] [blame] | 145 | # Try different combinations to accommodate systems that only have |
| 146 | # python[2][-config] in weird combinations but always preferring |
| 147 | # python2 and python2-config as per pep-0394. If we catch a |
| 148 | # python[-config] in version 3, the version check will kill it. |
| 149 | PYTHON2 := $(if $(call get-executable,python2),python2,python) |
| 150 | override PYTHON := $(call get-executable-or-default,PYTHON,$(PYTHON2)) |
| 151 | PYTHON2_CONFIG := \ |
| 152 | $(if $(call get-executable,$(PYTHON)-config),$(PYTHON)-config,python-config) |
Namhyung Kim | 56c7d79 | 2014-07-29 15:57:19 +0900 | [diff] [blame] | 153 | override PYTHON_CONFIG := \ |
Thomas Ilsche | d6a947f | 2014-08-04 15:03:15 +0200 | [diff] [blame] | 154 | $(call get-executable-or-default,PYTHON_CONFIG,$(PYTHON2_CONFIG)) |
Namhyung Kim | 56c7d79 | 2014-07-29 15:57:19 +0900 | [diff] [blame] | 155 | |
| 156 | PYTHON_CONFIG_SQ := $(call shell-sq,$(PYTHON_CONFIG)) |
| 157 | |
| 158 | PYTHON_EMBED_LDOPTS := $(shell $(PYTHON_CONFIG_SQ) --ldflags 2>/dev/null) |
| 159 | PYTHON_EMBED_CCOPTS := $(shell $(PYTHON_CONFIG_SQ) --cflags 2>/dev/null) |
| 160 | |
| 161 | FEATURE_CHECK_CFLAGS-libpython := $(PYTHON_EMBED_CCOPTS) |
| 162 | FEATURE_CHECK_LDFLAGS-libpython := $(PYTHON_EMBED_LDOPTS) |
| 163 | FEATURE_CHECK_CFLAGS-libpython-version := $(PYTHON_EMBED_CCOPTS) |
| 164 | FEATURE_CHECK_LDFLAGS-libpython-version := $(PYTHON_EMBED_LDOPTS) |
| 165 | endif |
| 166 | |
Jiri Olsa | 2fe7374 | 2013-04-15 04:32:28 +0200 | [diff] [blame] | 167 | CFLAGS += -fno-omit-frame-pointer |
| 168 | CFLAGS += -ggdb3 |
| 169 | CFLAGS += -funwind-tables |
| 170 | CFLAGS += -Wall |
| 171 | CFLAGS += -Wextra |
| 172 | CFLAGS += -std=gnu99 |
Jiri Olsa | 9c12cf9 | 2013-03-21 11:30:54 +0100 | [diff] [blame] | 173 | |
Mathias Krause | 6392b4e | 2014-04-27 18:51:05 +0200 | [diff] [blame] | 174 | # Enforce a non-executable stack, as we may regress (again) in the future by |
| 175 | # adding assembler files missing the .GNU-stack linker note. |
| 176 | LDFLAGS += -Wl,-z,noexecstack |
| 177 | |
Namhyung Kim | 5e2d4d0 | 2014-11-07 14:20:06 +0900 | [diff] [blame] | 178 | EXTLIBS = -lpthread -lrt -lm -ldl |
Jiri Olsa | 362493f | 2013-03-25 00:40:48 +0100 | [diff] [blame] | 179 | |
Ingo Molnar | 1c2d1d8 | 2013-10-03 15:05:56 +0200 | [diff] [blame] | 180 | ifneq ($(OUTPUT),) |
| 181 | OUTPUT_FEATURES = $(OUTPUT)config/feature-checks/ |
| 182 | $(shell mkdir -p $(OUTPUT_FEATURES)) |
| 183 | endif |
| 184 | |
Ingo Molnar | baa9c30 | 2013-10-01 14:14:31 +0200 | [diff] [blame] | 185 | feature_check = $(eval $(feature_check_code)) |
Ingo Molnar | b6aa997 | 2013-09-30 10:08:24 +0200 | [diff] [blame] | 186 | define feature_check_code |
Arnaldo Carvalho de Melo | 443a705 | 2015-03-10 19:04:31 -0300 | [diff] [blame] | 187 | feature-$(1) := $(shell $(MAKE) OUTPUT=$(OUTPUT_FEATURES) CFLAGS="$(EXTRA_CFLAGS) $(FEATURE_CHECK_CFLAGS-$(1))" LDFLAGS="$(LDFLAGS) $(FEATURE_CHECK_LDFLAGS-$(1))" -C config/feature-checks test-$1.bin > $(OUTPUT)config/feature-checks/.make-$(1).output 2>&1 && echo 1 || echo 0) |
Ingo Molnar | baa9c30 | 2013-10-01 14:14:31 +0200 | [diff] [blame] | 188 | endef |
| 189 | |
| 190 | feature_set = $(eval $(feature_set_code)) |
| 191 | define feature_set_code |
| 192 | feature-$(1) := 1 |
Ingo Molnar | b6aa997 | 2013-09-30 10:08:24 +0200 | [diff] [blame] | 193 | endef |
| 194 | |
| 195 | # |
| 196 | # Build the feature check binaries in parallel, ignore errors, ignore return value and suppress output: |
| 197 | # |
Ingo Molnar | b6aa997 | 2013-09-30 10:08:24 +0200 | [diff] [blame] | 198 | |
Ingo Molnar | f1138ec | 2013-10-02 09:54:43 +0200 | [diff] [blame] | 199 | # |
| 200 | # Note that this is not a complete list of all feature tests, just |
| 201 | # those that are typically built on a fully configured system. |
| 202 | # |
| 203 | # [ Feature tests not mentioned here have to be built explicitly in |
| 204 | # the rule that uses them - an example for that is the 'bionic' |
| 205 | # feature check. ] |
| 206 | # |
| 207 | CORE_FEATURE_TESTS = \ |
| 208 | backtrace \ |
Ingo Molnar | 8295d4e | 2013-10-07 10:35:39 +0200 | [diff] [blame] | 209 | dwarf \ |
Ingo Molnar | f1138ec | 2013-10-02 09:54:43 +0200 | [diff] [blame] | 210 | fortify-source \ |
Adrian Hunter | f6d3136 | 2014-07-14 13:02:53 +0300 | [diff] [blame] | 211 | sync-compare-and-swap \ |
Ingo Molnar | f1138ec | 2013-10-02 09:54:43 +0200 | [diff] [blame] | 212 | glibc \ |
Ingo Molnar | 7ef9e05 | 2013-09-30 15:01:56 +0200 | [diff] [blame] | 213 | gtk2 \ |
Ingo Molnar | c7a79e9 | 2013-09-30 15:08:30 +0200 | [diff] [blame] | 214 | gtk2-infobar \ |
Ingo Molnar | f1138ec | 2013-10-02 09:54:43 +0200 | [diff] [blame] | 215 | libaudit \ |
| 216 | libbfd \ |
| 217 | libelf \ |
| 218 | libelf-getphdrnum \ |
| 219 | libelf-mmap \ |
| 220 | libnuma \ |
Ingo Molnar | 7181a67 | 2013-09-30 15:15:36 +0200 | [diff] [blame] | 221 | libperl \ |
Ingo Molnar | 9734163 | 2013-09-30 15:18:37 +0200 | [diff] [blame] | 222 | libpython \ |
Ingo Molnar | 95d061c | 2013-09-30 15:40:04 +0200 | [diff] [blame] | 223 | libpython-version \ |
Ingo Molnar | f1138ec | 2013-10-02 09:54:43 +0200 | [diff] [blame] | 224 | libslang \ |
| 225 | libunwind \ |
Vineet Gupta | 459a3df | 2015-01-13 19:13:24 +0530 | [diff] [blame] | 226 | pthread-attr-setaffinity-np \ |
Ingo Molnar | bb4c550 | 2013-11-14 08:33:24 +0100 | [diff] [blame] | 227 | stackprotector-all \ |
Jiri Olsa | 0a4f2b6 | 2014-02-19 16:52:58 +0100 | [diff] [blame] | 228 | timerfd \ |
Namhyung Kim | e92ce12 | 2014-10-31 16:51:38 +0900 | [diff] [blame] | 229 | libdw-dwarf-unwind \ |
| 230 | zlib |
Ingo Molnar | b6aa997 | 2013-09-30 10:08:24 +0200 | [diff] [blame] | 231 | |
Jiri Olsa | 0695e57 | 2014-02-19 16:52:54 +0100 | [diff] [blame] | 232 | LIB_FEATURE_TESTS = \ |
| 233 | dwarf \ |
| 234 | glibc \ |
| 235 | gtk2 \ |
| 236 | libaudit \ |
| 237 | libbfd \ |
| 238 | libelf \ |
| 239 | libnuma \ |
| 240 | libperl \ |
| 241 | libpython \ |
| 242 | libslang \ |
Jiri Olsa | 0a4f2b6 | 2014-02-19 16:52:58 +0100 | [diff] [blame] | 243 | libunwind \ |
Namhyung Kim | e92ce12 | 2014-10-31 16:51:38 +0900 | [diff] [blame] | 244 | libdw-dwarf-unwind \ |
| 245 | zlib |
Jiri Olsa | 0695e57 | 2014-02-19 16:52:54 +0100 | [diff] [blame] | 246 | |
| 247 | VF_FEATURE_TESTS = \ |
| 248 | backtrace \ |
| 249 | fortify-source \ |
Adrian Hunter | f6d3136 | 2014-07-14 13:02:53 +0300 | [diff] [blame] | 250 | sync-compare-and-swap \ |
Jiri Olsa | 0695e57 | 2014-02-19 16:52:54 +0100 | [diff] [blame] | 251 | gtk2-infobar \ |
| 252 | libelf-getphdrnum \ |
| 253 | libelf-mmap \ |
| 254 | libpython-version \ |
Vineet Gupta | 459a3df | 2015-01-13 19:13:24 +0530 | [diff] [blame] | 255 | pthread-attr-setaffinity-np \ |
Jiri Olsa | 0695e57 | 2014-02-19 16:52:54 +0100 | [diff] [blame] | 256 | stackprotector-all \ |
| 257 | timerfd \ |
| 258 | libunwind-debug-frame \ |
Jiri Olsa | 2cf9040 | 2014-04-23 16:53:25 +0200 | [diff] [blame] | 259 | bionic \ |
| 260 | liberty \ |
| 261 | liberty-z \ |
Adrian Hunter | e477f3f | 2014-10-23 18:16:03 -0300 | [diff] [blame] | 262 | cplus-demangle \ |
| 263 | compile-32 \ |
| 264 | compile-x32 |
Jiri Olsa | 0695e57 | 2014-02-19 16:52:54 +0100 | [diff] [blame] | 265 | |
Jiri Olsa | c4eb6c0 | 2014-01-07 13:47:18 +0100 | [diff] [blame] | 266 | # Set FEATURE_CHECK_(C|LD)FLAGS-all for all CORE_FEATURE_TESTS features. |
| 267 | # If in the future we need per-feature checks/flags for features not |
| 268 | # mentioned in this list we need to refactor this ;-). |
| 269 | set_test_all_flags = $(eval $(set_test_all_flags_code)) |
| 270 | define set_test_all_flags_code |
| 271 | FEATURE_CHECK_CFLAGS-all += $(FEATURE_CHECK_CFLAGS-$(1)) |
| 272 | FEATURE_CHECK_LDFLAGS-all += $(FEATURE_CHECK_LDFLAGS-$(1)) |
| 273 | endef |
| 274 | |
| 275 | $(foreach feat,$(CORE_FEATURE_TESTS),$(call set_test_all_flags,$(feat))) |
| 276 | |
Ingo Molnar | baa9c30 | 2013-10-01 14:14:31 +0200 | [diff] [blame] | 277 | # |
| 278 | # Special fast-path for the 'all features are available' case: |
| 279 | # |
Ingo Molnar | b3b64a1 | 2013-10-02 10:01:42 +0200 | [diff] [blame] | 280 | $(call feature_check,all,$(MSG)) |
| 281 | |
| 282 | # |
| 283 | # Just in case the build freshly failed, make sure we print the |
| 284 | # feature matrix: |
| 285 | # |
Ingo Molnar | baa9c30 | 2013-10-01 14:14:31 +0200 | [diff] [blame] | 286 | ifeq ($(feature-all), 1) |
Ingo Molnar | f1138ec | 2013-10-02 09:54:43 +0200 | [diff] [blame] | 287 | # |
| 288 | # test-all.c passed - just set all the core feature flags to 1: |
| 289 | # |
| 290 | $(foreach feat,$(CORE_FEATURE_TESTS),$(call feature_set,$(feat))) |
Ingo Molnar | baa9c30 | 2013-10-01 14:14:31 +0200 | [diff] [blame] | 291 | else |
Chunwei Chen | 56560ec | 2013-12-21 13:48:11 +0800 | [diff] [blame] | 292 | $(shell $(MAKE) OUTPUT=$(OUTPUT_FEATURES) CFLAGS="$(EXTRA_CFLAGS)" LDFLAGS=$(LDFLAGS) -i -j -C config/feature-checks $(addsuffix .bin,$(CORE_FEATURE_TESTS)) >/dev/null 2>&1) |
Ingo Molnar | f1138ec | 2013-10-02 09:54:43 +0200 | [diff] [blame] | 293 | $(foreach feat,$(CORE_FEATURE_TESTS),$(call feature_check,$(feat))) |
Ingo Molnar | baa9c30 | 2013-10-01 14:14:31 +0200 | [diff] [blame] | 294 | endif |
| 295 | |
Ingo Molnar | 90ac542 | 2013-09-30 13:48:44 +0200 | [diff] [blame] | 296 | ifeq ($(feature-stackprotector-all), 1) |
Jiri Olsa | 8e1b3f6 | 2013-04-15 04:06:58 +0200 | [diff] [blame] | 297 | CFLAGS += -fstack-protector-all |
Jiri Olsa | 362493f | 2013-03-25 00:40:48 +0100 | [diff] [blame] | 298 | endif |
| 299 | |
Ingo Molnar | fcf9258 | 2013-10-10 08:05:25 +0200 | [diff] [blame] | 300 | ifeq ($(DEBUG),0) |
Ingo Molnar | 1ea6f99 | 2013-10-07 09:38:28 +0200 | [diff] [blame] | 301 | ifeq ($(feature-fortify-source), 1) |
Jiri Olsa | 8e1b3f6 | 2013-04-15 04:06:58 +0200 | [diff] [blame] | 302 | CFLAGS += -D_FORTIFY_SOURCE=2 |
| 303 | endif |
Jiri Olsa | 362493f | 2013-03-25 00:40:48 +0100 | [diff] [blame] | 304 | endif |
| 305 | |
Jiri Olsa | 2fe7374 | 2013-04-15 04:32:28 +0200 | [diff] [blame] | 306 | CFLAGS += -I$(src-perf)/util/include |
| 307 | CFLAGS += -I$(src-perf)/arch/$(ARCH)/include |
Namhyung Kim | 8a625c1 | 2014-01-09 23:00:52 +0900 | [diff] [blame] | 308 | CFLAGS += -I$(srctree)/tools/include/ |
Jiri Olsa | 2fe7374 | 2013-04-15 04:32:28 +0200 | [diff] [blame] | 309 | CFLAGS += -I$(srctree)/arch/$(ARCH)/include/uapi |
| 310 | CFLAGS += -I$(srctree)/arch/$(ARCH)/include |
| 311 | CFLAGS += -I$(srctree)/include/uapi |
| 312 | CFLAGS += -I$(srctree)/include |
Jiri Olsa | 7c53746 | 2013-05-24 14:35:23 +0200 | [diff] [blame] | 313 | |
| 314 | # $(obj-perf) for generated common-cmds.h |
| 315 | # $(obj-perf)/util for generated bison/flex headers |
| 316 | ifneq ($(OUTPUT),) |
Jiri Olsa | 2fe7374 | 2013-04-15 04:32:28 +0200 | [diff] [blame] | 317 | CFLAGS += -I$(obj-perf)/util |
| 318 | CFLAGS += -I$(obj-perf) |
Jiri Olsa | 7c53746 | 2013-05-24 14:35:23 +0200 | [diff] [blame] | 319 | endif |
| 320 | |
Jiri Olsa | 2fe7374 | 2013-04-15 04:32:28 +0200 | [diff] [blame] | 321 | CFLAGS += -I$(src-perf)/util |
| 322 | CFLAGS += -I$(src-perf) |
Robert Richter | 4e31902 | 2013-06-11 17:29:18 +0200 | [diff] [blame] | 323 | CFLAGS += -I$(LIB_INCLUDE) |
Jiri Olsa | 7c53746 | 2013-05-24 14:35:23 +0200 | [diff] [blame] | 324 | |
Jiri Olsa | 2fe7374 | 2013-04-15 04:32:28 +0200 | [diff] [blame] | 325 | CFLAGS += -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE |
Jiri Olsa | 362493f | 2013-03-25 00:40:48 +0100 | [diff] [blame] | 326 | |
Adrian Hunter | f6d3136 | 2014-07-14 13:02:53 +0300 | [diff] [blame] | 327 | ifeq ($(feature-sync-compare-and-swap), 1) |
| 328 | CFLAGS += -DHAVE_SYNC_COMPARE_AND_SWAP_SUPPORT |
| 329 | endif |
| 330 | |
Vineet Gupta | 459a3df | 2015-01-13 19:13:24 +0530 | [diff] [blame] | 331 | ifeq ($(feature-pthread-attr-setaffinity-np), 1) |
| 332 | CFLAGS += -DHAVE_PTHREAD_ATTR_SETAFFINITY_NP |
| 333 | endif |
| 334 | |
Jiri Olsa | 4e22db4 | 2013-05-24 14:35:24 +0200 | [diff] [blame] | 335 | ifndef NO_BIONIC |
David Ahern | 5febff0 | 2013-10-29 10:43:15 -0600 | [diff] [blame] | 336 | $(call feature_check,bionic) |
Ingo Molnar | 78e9d65 | 2013-09-30 14:11:46 +0200 | [diff] [blame] | 337 | ifeq ($(feature-bionic), 1) |
| 338 | BIONIC := 1 |
| 339 | EXTLIBS := $(filter-out -lrt,$(EXTLIBS)) |
| 340 | EXTLIBS := $(filter-out -lpthread,$(EXTLIBS)) |
| 341 | endif |
Jiri Olsa | 362493f | 2013-03-25 00:40:48 +0100 | [diff] [blame] | 342 | endif |
Jiri Olsa | cf4cca1 | 2013-03-25 00:45:08 +0100 | [diff] [blame] | 343 | |
| 344 | ifdef NO_LIBELF |
Jiri Olsa | 8e1b3f6 | 2013-04-15 04:06:58 +0200 | [diff] [blame] | 345 | NO_DWARF := 1 |
| 346 | NO_DEMANGLE := 1 |
| 347 | NO_LIBUNWIND := 1 |
Jiri Olsa | 5ea8415 | 2014-02-19 16:52:57 +0100 | [diff] [blame] | 348 | NO_LIBDW_DWARF_UNWIND := 1 |
Jiri Olsa | cf4cca1 | 2013-03-25 00:45:08 +0100 | [diff] [blame] | 349 | else |
Ingo Molnar | 8f7f800 | 2013-09-30 14:20:25 +0200 | [diff] [blame] | 350 | ifeq ($(feature-libelf), 0) |
Ingo Molnar | e12762c | 2013-10-07 10:34:20 +0200 | [diff] [blame] | 351 | ifeq ($(feature-glibc), 1) |
Ingo Molnar | 50eed7a | 2013-09-30 14:11:16 +0200 | [diff] [blame] | 352 | LIBC_SUPPORT := 1 |
| 353 | endif |
| 354 | ifeq ($(BIONIC),1) |
| 355 | LIBC_SUPPORT := 1 |
| 356 | endif |
| 357 | ifeq ($(LIBC_SUPPORT),1) |
| 358 | msg := $(warning No libelf found, disables 'probe' tool, please install elfutils-libelf-devel/libelf-dev); |
Jiri Olsa | cf4cca1 | 2013-03-25 00:45:08 +0100 | [diff] [blame] | 359 | |
Ingo Molnar | 50eed7a | 2013-09-30 14:11:16 +0200 | [diff] [blame] | 360 | NO_LIBELF := 1 |
| 361 | NO_DWARF := 1 |
| 362 | NO_DEMANGLE := 1 |
Arnaldo Carvalho de Melo | 9458955 | 2014-03-25 09:35:11 -0300 | [diff] [blame] | 363 | NO_LIBUNWIND := 1 |
| 364 | NO_LIBDW_DWARF_UNWIND := 1 |
Ingo Molnar | 50eed7a | 2013-09-30 14:11:16 +0200 | [diff] [blame] | 365 | else |
Arnaldo Carvalho de Melo | f9ca2d8 | 2014-06-05 12:46:04 -0300 | [diff] [blame] | 366 | ifneq ($(filter s% -static%,$(LDFLAGS),),) |
| 367 | msg := $(error No static glibc found, please install glibc-static); |
| 368 | else |
| 369 | msg := $(error No gnu/libc-version.h found, please install glibc-dev[el]); |
| 370 | endif |
Ingo Molnar | 50eed7a | 2013-09-30 14:11:16 +0200 | [diff] [blame] | 371 | endif |
Jiri Olsa | 8e1b3f6 | 2013-04-15 04:06:58 +0200 | [diff] [blame] | 372 | else |
Jiri Olsa | 0a4f2b6 | 2014-02-19 16:52:58 +0100 | [diff] [blame] | 373 | ifndef NO_LIBDW_DWARF_UNWIND |
| 374 | ifneq ($(feature-libdw-dwarf-unwind),1) |
| 375 | NO_LIBDW_DWARF_UNWIND := 1 |
| 376 | msg := $(warning No libdw DWARF unwind found, Please install elfutils-devel/libdw-dev >= 0.158 and/or set LIBDW_DIR); |
| 377 | endif |
| 378 | endif |
Ingo Molnar | 8295d4e | 2013-10-07 10:35:39 +0200 | [diff] [blame] | 379 | ifneq ($(feature-dwarf), 1) |
Ingo Molnar | 50eed7a | 2013-09-30 14:11:16 +0200 | [diff] [blame] | 380 | msg := $(warning No libdw.h found or old libdw.h found or elfutils is older than 0.138, disables dwarf support. Please install new elfutils-devel/libdw-dev); |
| 381 | NO_DWARF := 1 |
| 382 | endif # Dwarf support |
Ingo Molnar | 0648f83 | 2013-10-02 15:30:35 +0200 | [diff] [blame] | 383 | endif # libelf support |
Jiri Olsa | cf4cca1 | 2013-03-25 00:45:08 +0100 | [diff] [blame] | 384 | endif # NO_LIBELF |
| 385 | |
| 386 | ifndef NO_LIBELF |
Ingo Molnar | fb3d333 | 2013-10-07 10:05:51 +0200 | [diff] [blame] | 387 | CFLAGS += -DHAVE_LIBELF_SUPPORT |
Namhyung Kim | 5e2d4d0 | 2014-11-07 14:20:06 +0900 | [diff] [blame] | 388 | EXTLIBS += -lelf |
Jiri Olsa | 709e679 | 2014-12-29 23:52:25 +0100 | [diff] [blame] | 389 | $(call detected,CONFIG_LIBELF) |
Jiri Olsa | 779724f | 2013-03-25 00:48:14 +0100 | [diff] [blame] | 390 | |
Ingo Molnar | 8869b17 | 2013-09-30 15:02:28 +0200 | [diff] [blame] | 391 | ifeq ($(feature-libelf-mmap), 1) |
Ingo Molnar | fb3d333 | 2013-10-07 10:05:51 +0200 | [diff] [blame] | 392 | CFLAGS += -DHAVE_LIBELF_MMAP_SUPPORT |
| 393 | endif |
Jiri Olsa | 779724f | 2013-03-25 00:48:14 +0100 | [diff] [blame] | 394 | |
Ingo Molnar | b7bcef6 | 2013-09-30 14:35:27 +0200 | [diff] [blame] | 395 | ifeq ($(feature-libelf-getphdrnum), 1) |
Ingo Molnar | fb3d333 | 2013-10-07 10:05:51 +0200 | [diff] [blame] | 396 | CFLAGS += -DHAVE_ELF_GETPHDRNUM_SUPPORT |
| 397 | endif |
Jiri Olsa | 779724f | 2013-03-25 00:48:14 +0100 | [diff] [blame] | 398 | |
Ingo Molnar | fb3d333 | 2013-10-07 10:05:51 +0200 | [diff] [blame] | 399 | # include ARCH specific config |
| 400 | -include $(src-perf)/arch/$(ARCH)/Makefile |
| 401 | |
| 402 | ifndef NO_DWARF |
| 403 | ifeq ($(origin PERF_HAVE_DWARF_REGS), undefined) |
| 404 | msg := $(warning DWARF register mappings have not been defined for architecture $(ARCH), DWARF support disabled); |
| 405 | NO_DWARF := 1 |
| 406 | else |
| 407 | CFLAGS += -DHAVE_DWARF_SUPPORT $(LIBDW_CFLAGS) |
| 408 | LDFLAGS += $(LIBDW_LDFLAGS) |
Namhyung Kim | 5e2d4d0 | 2014-11-07 14:20:06 +0900 | [diff] [blame] | 409 | EXTLIBS += -ldw |
Jiri Olsa | 8379fce | 2014-12-30 00:06:25 +0100 | [diff] [blame] | 410 | $(call detected,CONFIG_DWARF) |
Ingo Molnar | fb3d333 | 2013-10-07 10:05:51 +0200 | [diff] [blame] | 411 | endif # PERF_HAVE_DWARF_REGS |
| 412 | endif # NO_DWARF |
Jiri Olsa | cf4cca1 | 2013-03-25 00:45:08 +0100 | [diff] [blame] | 413 | endif # NO_LIBELF |
Jiri Olsa | 0e433fe | 2013-03-25 00:53:03 +0100 | [diff] [blame] | 414 | |
Anton Blanchard | 65ccb4f | 2014-08-25 18:25:06 +1000 | [diff] [blame] | 415 | ifeq ($(ARCH),powerpc) |
| 416 | ifndef NO_DWARF |
| 417 | CFLAGS += -DHAVE_SKIP_CALLCHAIN_IDX |
| 418 | endif |
| 419 | endif |
| 420 | |
Jiri Olsa | 0e433fe | 2013-03-25 00:53:03 +0100 | [diff] [blame] | 421 | ifndef NO_LIBUNWIND |
Ingo Molnar | 058f952 | 2013-09-30 14:45:44 +0200 | [diff] [blame] | 422 | ifneq ($(feature-libunwind), 1) |
Jiri Olsa | 0a4f2b6 | 2014-02-19 16:52:58 +0100 | [diff] [blame] | 423 | msg := $(warning No libunwind found. Please install libunwind-dev[el] >= 1.1 and/or set LIBUNWIND_DIR); |
Ingo Molnar | 308e1e7 | 2013-10-07 10:30:47 +0200 | [diff] [blame] | 424 | NO_LIBUNWIND := 1 |
Jiri Olsa | 0a4f2b6 | 2014-02-19 16:52:58 +0100 | [diff] [blame] | 425 | endif |
| 426 | endif |
| 427 | |
| 428 | dwarf-post-unwind := 1 |
| 429 | dwarf-post-unwind-text := BUG |
| 430 | |
| 431 | # setup DWARF post unwinder |
| 432 | ifdef NO_LIBUNWIND |
| 433 | ifdef NO_LIBDW_DWARF_UNWIND |
| 434 | msg := $(warning Disabling post unwind, no support found.); |
| 435 | dwarf-post-unwind := 0 |
Linus Torvalds | f47671e | 2013-11-14 08:51:29 +0900 | [diff] [blame] | 436 | else |
Jiri Olsa | 0a4f2b6 | 2014-02-19 16:52:58 +0100 | [diff] [blame] | 437 | dwarf-post-unwind-text := libdw |
Jiri Olsa | b2e45c3 | 2014-12-30 00:11:11 +0100 | [diff] [blame] | 438 | $(call detected,CONFIG_LIBDW_DWARF_UNWIND) |
Jiri Olsa | 0a4f2b6 | 2014-02-19 16:52:58 +0100 | [diff] [blame] | 439 | endif |
| 440 | else |
| 441 | dwarf-post-unwind-text := libunwind |
Jiri Olsa | b2e45c3 | 2014-12-30 00:11:11 +0100 | [diff] [blame] | 442 | $(call detected,CONFIG_LIBUNWIND) |
Jiri Olsa | 0a4f2b6 | 2014-02-19 16:52:58 +0100 | [diff] [blame] | 443 | # Enable libunwind support by default. |
| 444 | ifndef NO_LIBDW_DWARF_UNWIND |
| 445 | NO_LIBDW_DWARF_UNWIND := 1 |
| 446 | endif |
| 447 | endif |
| 448 | |
| 449 | ifeq ($(dwarf-post-unwind),1) |
| 450 | CFLAGS += -DHAVE_DWARF_UNWIND_SUPPORT |
Jiri Olsa | f39e042 | 2014-12-29 15:03:09 +0100 | [diff] [blame] | 451 | $(call detected,CONFIG_DWARF_UNWIND) |
Jiri Olsa | 0a4f2b6 | 2014-02-19 16:52:58 +0100 | [diff] [blame] | 452 | else |
| 453 | NO_DWARF_UNWIND := 1 |
| 454 | endif |
| 455 | |
| 456 | ifndef NO_LIBUNWIND |
Jean Pihet | 8ab596a | 2014-04-28 14:32:33 +0200 | [diff] [blame] | 457 | ifeq ($(ARCH),$(filter $(ARCH),arm arm64)) |
Jiri Olsa | 0a4f2b6 | 2014-02-19 16:52:58 +0100 | [diff] [blame] | 458 | $(call feature_check,libunwind-debug-frame) |
| 459 | ifneq ($(feature-libunwind-debug-frame), 1) |
| 460 | msg := $(warning No debug_frame support found in libunwind); |
Linus Torvalds | f47671e | 2013-11-14 08:51:29 +0900 | [diff] [blame] | 461 | CFLAGS += -DNO_LIBUNWIND_DEBUG_FRAME |
| 462 | endif |
Jiri Olsa | 0a4f2b6 | 2014-02-19 16:52:58 +0100 | [diff] [blame] | 463 | else |
| 464 | # non-ARM has no dwarf_find_debug_frame() function: |
| 465 | CFLAGS += -DNO_LIBUNWIND_DEBUG_FRAME |
| 466 | endif |
| 467 | CFLAGS += -DHAVE_LIBUNWIND_SUPPORT |
| 468 | EXTLIBS += $(LIBUNWIND_LIBS) |
| 469 | CFLAGS += $(LIBUNWIND_CFLAGS) |
| 470 | LDFLAGS += $(LIBUNWIND_LDFLAGS) |
Ingo Molnar | 058f952 | 2013-09-30 14:45:44 +0200 | [diff] [blame] | 471 | endif |
Jiri Olsa | a827952 | 2013-03-25 00:54:36 +0100 | [diff] [blame] | 472 | |
| 473 | ifndef NO_LIBAUDIT |
Ingo Molnar | d795a65 | 2013-09-30 14:55:31 +0200 | [diff] [blame] | 474 | ifneq ($(feature-libaudit), 1) |
Jiri Olsa | 8e1b3f6 | 2013-04-15 04:06:58 +0200 | [diff] [blame] | 475 | msg := $(warning No libaudit.h found, disables 'trace' tool, please install audit-libs-devel or libaudit-dev); |
| 476 | NO_LIBAUDIT := 1 |
| 477 | else |
Ingo Molnar | 89fe808 | 2013-09-30 12:07:11 +0200 | [diff] [blame] | 478 | CFLAGS += -DHAVE_LIBAUDIT_SUPPORT |
Jiri Olsa | 8e1b3f6 | 2013-04-15 04:06:58 +0200 | [diff] [blame] | 479 | EXTLIBS += -laudit |
Jiri Olsa | 285ab8b | 2014-12-29 15:13:44 +0100 | [diff] [blame] | 480 | $(call detected,CONFIG_AUDIT) |
Jiri Olsa | 8e1b3f6 | 2013-04-15 04:06:58 +0200 | [diff] [blame] | 481 | endif |
Jiri Olsa | a827952 | 2013-03-25 00:54:36 +0100 | [diff] [blame] | 482 | endif |
Jiri Olsa | 4a8f888 | 2013-03-25 00:56:08 +0100 | [diff] [blame] | 483 | |
| 484 | ifdef NO_NEWT |
Jiri Olsa | 8e1b3f6 | 2013-04-15 04:06:58 +0200 | [diff] [blame] | 485 | NO_SLANG=1 |
Jiri Olsa | 4a8f888 | 2013-03-25 00:56:08 +0100 | [diff] [blame] | 486 | endif |
| 487 | |
| 488 | ifndef NO_SLANG |
Ingo Molnar | b9498b5 | 2013-09-30 14:57:54 +0200 | [diff] [blame] | 489 | ifneq ($(feature-libslang), 1) |
Jiri Olsa | 8e1b3f6 | 2013-04-15 04:06:58 +0200 | [diff] [blame] | 490 | msg := $(warning slang not found, disables TUI support. Please install slang-devel or libslang-dev); |
| 491 | NO_SLANG := 1 |
| 492 | else |
| 493 | # Fedora has /usr/include/slang/slang.h, but ubuntu /usr/include/slang.h |
| 494 | CFLAGS += -I/usr/include/slang |
Ingo Molnar | 89fe808 | 2013-09-30 12:07:11 +0200 | [diff] [blame] | 495 | CFLAGS += -DHAVE_SLANG_SUPPORT |
Jiri Olsa | 8e1b3f6 | 2013-04-15 04:06:58 +0200 | [diff] [blame] | 496 | EXTLIBS += -lslang |
Jiri Olsa | cf15c74 | 2014-12-30 00:27:52 +0100 | [diff] [blame] | 497 | $(call detected,CONFIG_SLANG) |
Jiri Olsa | 8e1b3f6 | 2013-04-15 04:06:58 +0200 | [diff] [blame] | 498 | endif |
Jiri Olsa | 4a8f888 | 2013-03-25 00:56:08 +0100 | [diff] [blame] | 499 | endif |
Jiri Olsa | 58cabf6 | 2013-03-18 00:09:24 +0100 | [diff] [blame] | 500 | |
| 501 | ifndef NO_GTK2 |
Mark Rutland | a8a5cd8 | 2014-01-15 10:44:08 +0000 | [diff] [blame] | 502 | FLAGS_GTK2=$(CFLAGS) $(LDFLAGS) $(EXTLIBS) $(shell $(PKG_CONFIG) --libs --cflags gtk+-2.0 2>/dev/null) |
Ingo Molnar | 7ef9e05 | 2013-09-30 15:01:56 +0200 | [diff] [blame] | 503 | ifneq ($(feature-gtk2), 1) |
Jiri Olsa | 8e1b3f6 | 2013-04-15 04:06:58 +0200 | [diff] [blame] | 504 | msg := $(warning GTK2 not found, disables GTK2 support. Please install gtk2-devel or libgtk2.0-dev); |
| 505 | NO_GTK2 := 1 |
| 506 | else |
Ingo Molnar | c7a79e9 | 2013-09-30 15:08:30 +0200 | [diff] [blame] | 507 | ifeq ($(feature-gtk2-infobar), 1) |
Namhyung Kim | fc67297 | 2013-09-13 15:27:43 +0900 | [diff] [blame] | 508 | GTK_CFLAGS := -DHAVE_GTK_INFO_BAR_SUPPORT |
Jiri Olsa | 8e1b3f6 | 2013-04-15 04:06:58 +0200 | [diff] [blame] | 509 | endif |
Ingo Molnar | 89fe808 | 2013-09-30 12:07:11 +0200 | [diff] [blame] | 510 | CFLAGS += -DHAVE_GTK2_SUPPORT |
Mark Rutland | a8a5cd8 | 2014-01-15 10:44:08 +0000 | [diff] [blame] | 511 | GTK_CFLAGS += $(shell $(PKG_CONFIG) --cflags gtk+-2.0 2>/dev/null) |
| 512 | GTK_LIBS := $(shell $(PKG_CONFIG) --libs gtk+-2.0 2>/dev/null) |
Jiri Olsa | e213708 | 2013-09-26 20:55:54 +0200 | [diff] [blame] | 513 | EXTLIBS += -ldl |
Jiri Olsa | 8e1b3f6 | 2013-04-15 04:06:58 +0200 | [diff] [blame] | 514 | endif |
Jiri Olsa | 58cabf6 | 2013-03-18 00:09:24 +0100 | [diff] [blame] | 515 | endif |
Jiri Olsa | 3082cb3 | 2013-03-18 00:19:44 +0100 | [diff] [blame] | 516 | |
| 517 | grep-libs = $(filter -l%,$(1)) |
| 518 | strip-libs = $(filter-out -l%,$(1)) |
| 519 | |
| 520 | ifdef NO_LIBPERL |
Jiri Olsa | 8e1b3f6 | 2013-04-15 04:06:58 +0200 | [diff] [blame] | 521 | CFLAGS += -DNO_LIBPERL |
Jiri Olsa | 3082cb3 | 2013-03-18 00:19:44 +0100 | [diff] [blame] | 522 | else |
Jiri Olsa | 8e1b3f6 | 2013-04-15 04:06:58 +0200 | [diff] [blame] | 523 | PERL_EMBED_LDOPTS = $(shell perl -MExtUtils::Embed -e ldopts 2>/dev/null) |
| 524 | PERL_EMBED_LDFLAGS = $(call strip-libs,$(PERL_EMBED_LDOPTS)) |
| 525 | PERL_EMBED_LIBADD = $(call grep-libs,$(PERL_EMBED_LDOPTS)) |
| 526 | PERL_EMBED_CCOPTS = `perl -MExtUtils::Embed -e ccopts 2>/dev/null` |
| 527 | FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS) |
Jiri Olsa | 3082cb3 | 2013-03-18 00:19:44 +0100 | [diff] [blame] | 528 | |
Ingo Molnar | 7181a67 | 2013-09-30 15:15:36 +0200 | [diff] [blame] | 529 | ifneq ($(feature-libperl), 1) |
Jiri Olsa | 8e1b3f6 | 2013-04-15 04:06:58 +0200 | [diff] [blame] | 530 | CFLAGS += -DNO_LIBPERL |
| 531 | NO_LIBPERL := 1 |
Ingo Molnar | a954e68 | 2015-02-28 09:39:09 +0100 | [diff] [blame] | 532 | msg := $(warning Missing perl devel files. Disabling perl scripting support, please install perl-ExtUtils-Embed/libperl-dev); |
Jiri Olsa | 8e1b3f6 | 2013-04-15 04:06:58 +0200 | [diff] [blame] | 533 | else |
| 534 | LDFLAGS += $(PERL_EMBED_LDFLAGS) |
| 535 | EXTLIBS += $(PERL_EMBED_LIBADD) |
Jiri Olsa | c7355f8 | 2014-12-30 13:11:32 +0100 | [diff] [blame] | 536 | $(call detected,CONFIG_LIBPERL) |
Jiri Olsa | 8e1b3f6 | 2013-04-15 04:06:58 +0200 | [diff] [blame] | 537 | endif |
Jiri Olsa | 3082cb3 | 2013-03-18 00:19:44 +0100 | [diff] [blame] | 538 | endif |
Jiri Olsa | 6e533cf | 2013-03-18 00:35:32 +0100 | [diff] [blame] | 539 | |
David Ahern | 87419c9 | 2013-10-29 10:43:16 -0600 | [diff] [blame] | 540 | ifeq ($(feature-timerfd), 1) |
| 541 | CFLAGS += -DHAVE_TIMERFD_SUPPORT |
| 542 | else |
| 543 | msg := $(warning No timerfd support. Disables 'perf kvm stat live'); |
| 544 | endif |
| 545 | |
Jiri Olsa | 6e533cf | 2013-03-18 00:35:32 +0100 | [diff] [blame] | 546 | disable-python = $(eval $(disable-python_code)) |
| 547 | define disable-python_code |
Jiri Olsa | 9c12cf9 | 2013-03-21 11:30:54 +0100 | [diff] [blame] | 548 | CFLAGS += -DNO_LIBPYTHON |
Ingo Molnar | 6c5aa23 | 2015-02-28 09:33:45 +0100 | [diff] [blame] | 549 | $(warning $1) |
Jiri Olsa | 6e533cf | 2013-03-18 00:35:32 +0100 | [diff] [blame] | 550 | NO_LIBPYTHON := 1 |
| 551 | endef |
| 552 | |
Namhyung Kim | 56c7d79 | 2014-07-29 15:57:19 +0900 | [diff] [blame] | 553 | ifdef NO_LIBPYTHON |
Ingo Molnar | 6c5aa23 | 2015-02-28 09:33:45 +0100 | [diff] [blame] | 554 | $(call disable-python,Python support disabled by user) |
Jiri Olsa | 6e533cf | 2013-03-18 00:35:32 +0100 | [diff] [blame] | 555 | else |
| 556 | |
Namhyung Kim | 56c7d79 | 2014-07-29 15:57:19 +0900 | [diff] [blame] | 557 | ifndef PYTHON |
Ingo Molnar | 6c5aa23 | 2015-02-28 09:33:45 +0100 | [diff] [blame] | 558 | $(call disable-python,No python interpreter was found: disables Python support - please install python-devel/python-dev) |
Jiri Olsa | 6e533cf | 2013-03-18 00:35:32 +0100 | [diff] [blame] | 559 | else |
Namhyung Kim | 56c7d79 | 2014-07-29 15:57:19 +0900 | [diff] [blame] | 560 | PYTHON_WORD := $(call shell-wordify,$(PYTHON)) |
Jiri Olsa | 6e533cf | 2013-03-18 00:35:32 +0100 | [diff] [blame] | 561 | |
| 562 | ifndef PYTHON_CONFIG |
Ingo Molnar | 6c5aa23 | 2015-02-28 09:33:45 +0100 | [diff] [blame] | 563 | $(call disable-python,No 'python-config' tool was found: disables Python support - please install python-devel/python-dev) |
Jiri Olsa | 6e533cf | 2013-03-18 00:35:32 +0100 | [diff] [blame] | 564 | else |
| 565 | |
| 566 | PYTHON_CONFIG_SQ := $(call shell-sq,$(PYTHON_CONFIG)) |
| 567 | |
| 568 | PYTHON_EMBED_LDOPTS := $(shell $(PYTHON_CONFIG_SQ) --ldflags 2>/dev/null) |
| 569 | PYTHON_EMBED_LDFLAGS := $(call strip-libs,$(PYTHON_EMBED_LDOPTS)) |
| 570 | PYTHON_EMBED_LIBADD := $(call grep-libs,$(PYTHON_EMBED_LDOPTS)) |
| 571 | PYTHON_EMBED_CCOPTS := $(shell $(PYTHON_CONFIG_SQ) --cflags 2>/dev/null) |
| 572 | FLAGS_PYTHON_EMBED := $(PYTHON_EMBED_CCOPTS) $(PYTHON_EMBED_LDOPTS) |
| 573 | |
Ingo Molnar | 9734163 | 2013-09-30 15:18:37 +0200 | [diff] [blame] | 574 | ifneq ($(feature-libpython), 1) |
Ingo Molnar | 6c5aa23 | 2015-02-28 09:33:45 +0100 | [diff] [blame] | 575 | $(call disable-python,No 'Python.h' (for Python 2.x support) was found: disables Python support - please install python-devel/python-dev) |
Jiri Olsa | 6e533cf | 2013-03-18 00:35:32 +0100 | [diff] [blame] | 576 | else |
| 577 | |
Ingo Molnar | 95d061c | 2013-09-30 15:40:04 +0200 | [diff] [blame] | 578 | ifneq ($(feature-libpython-version), 1) |
Jiri Olsa | 6e533cf | 2013-03-18 00:35:32 +0100 | [diff] [blame] | 579 | $(warning Python 3 is not yet supported; please set) |
| 580 | $(warning PYTHON and/or PYTHON_CONFIG appropriately.) |
| 581 | $(warning If you also have Python 2 installed, then) |
| 582 | $(warning try something like:) |
| 583 | $(warning $(and ,)) |
| 584 | $(warning $(and ,) make PYTHON=python2) |
| 585 | $(warning $(and ,)) |
| 586 | $(warning Otherwise, disable Python support entirely:) |
| 587 | $(warning $(and ,)) |
| 588 | $(warning $(and ,) make NO_LIBPYTHON=1) |
| 589 | $(warning $(and ,)) |
| 590 | $(error $(and ,)) |
| 591 | else |
Jiri Olsa | 1e9f7aa | 2013-03-21 11:41:05 +0100 | [diff] [blame] | 592 | LDFLAGS += $(PYTHON_EMBED_LDFLAGS) |
Jiri Olsa | 6e533cf | 2013-03-18 00:35:32 +0100 | [diff] [blame] | 593 | EXTLIBS += $(PYTHON_EMBED_LIBADD) |
Jiri Olsa | 7c53746 | 2013-05-24 14:35:23 +0200 | [diff] [blame] | 594 | LANG_BINDINGS += $(obj-perf)python/perf.so |
Jiri Olsa | c7355f8 | 2014-12-30 13:11:32 +0100 | [diff] [blame] | 595 | $(call detected,CONFIG_LIBPYTHON) |
Jiri Olsa | 6e533cf | 2013-03-18 00:35:32 +0100 | [diff] [blame] | 596 | endif |
| 597 | endif |
| 598 | endif |
| 599 | endif |
| 600 | endif |
Jiri Olsa | c3cf836 | 2013-03-18 00:38:16 +0100 | [diff] [blame] | 601 | |
Jiri Olsa | 3e6a147 | 2013-10-10 22:24:00 +0200 | [diff] [blame] | 602 | ifeq ($(feature-libbfd), 1) |
Jiri Olsa | 2cf9040 | 2014-04-23 16:53:25 +0200 | [diff] [blame] | 603 | EXTLIBS += -lbfd |
| 604 | |
| 605 | # call all detections now so we get correct |
| 606 | # status in VF output |
| 607 | $(call feature_check,liberty) |
| 608 | $(call feature_check,liberty-z) |
| 609 | $(call feature_check,cplus-demangle) |
| 610 | |
| 611 | ifeq ($(feature-liberty), 1) |
| 612 | EXTLIBS += -liberty |
| 613 | else |
| 614 | ifeq ($(feature-liberty-z), 1) |
| 615 | EXTLIBS += -liberty -lz |
| 616 | endif |
| 617 | endif |
Jiri Olsa | 3e6a147 | 2013-10-10 22:24:00 +0200 | [diff] [blame] | 618 | endif |
| 619 | |
Jiri Olsa | c3cf836 | 2013-03-18 00:38:16 +0100 | [diff] [blame] | 620 | ifdef NO_DEMANGLE |
Jiri Olsa | 8e1b3f6 | 2013-04-15 04:06:58 +0200 | [diff] [blame] | 621 | CFLAGS += -DNO_DEMANGLE |
Jiri Olsa | c3cf836 | 2013-03-18 00:38:16 +0100 | [diff] [blame] | 622 | else |
Ingo Molnar | 89fe808 | 2013-09-30 12:07:11 +0200 | [diff] [blame] | 623 | ifdef HAVE_CPLUS_DEMANGLE_SUPPORT |
Jiri Olsa | 8e1b3f6 | 2013-04-15 04:06:58 +0200 | [diff] [blame] | 624 | EXTLIBS += -liberty |
Ingo Molnar | 89fe808 | 2013-09-30 12:07:11 +0200 | [diff] [blame] | 625 | CFLAGS += -DHAVE_CPLUS_DEMANGLE_SUPPORT |
Jiri Olsa | 8e1b3f6 | 2013-04-15 04:06:58 +0200 | [diff] [blame] | 626 | else |
Jiri Olsa | 3e6a147 | 2013-10-10 22:24:00 +0200 | [diff] [blame] | 627 | ifneq ($(feature-libbfd), 1) |
Jiri Olsa | 2cf9040 | 2014-04-23 16:53:25 +0200 | [diff] [blame] | 628 | ifneq ($(feature-liberty), 1) |
| 629 | ifneq ($(feature-liberty-z), 1) |
| 630 | # we dont have neither HAVE_CPLUS_DEMANGLE_SUPPORT |
| 631 | # or any of 'bfd iberty z' trinity |
Ingo Molnar | 1c47661 | 2013-10-02 15:15:09 +0200 | [diff] [blame] | 632 | ifeq ($(feature-cplus-demangle), 1) |
Jiri Olsa | 8e1b3f6 | 2013-04-15 04:06:58 +0200 | [diff] [blame] | 633 | EXTLIBS += -liberty |
Ingo Molnar | 89fe808 | 2013-09-30 12:07:11 +0200 | [diff] [blame] | 634 | CFLAGS += -DHAVE_CPLUS_DEMANGLE_SUPPORT |
Jiri Olsa | 8e1b3f6 | 2013-04-15 04:06:58 +0200 | [diff] [blame] | 635 | else |
Ingo Molnar | 0189d7c | 2015-02-28 09:46:42 +0100 | [diff] [blame] | 636 | msg := $(warning No bfd.h/libbfd found, please install binutils-dev[el]/zlib-static/libiberty-dev to gain symbol demangling) |
Jiri Olsa | 8e1b3f6 | 2013-04-15 04:06:58 +0200 | [diff] [blame] | 637 | CFLAGS += -DNO_DEMANGLE |
| 638 | endif |
| 639 | endif |
| 640 | endif |
| 641 | endif |
| 642 | endif |
Jiri Olsa | c3cf836 | 2013-03-18 00:38:16 +0100 | [diff] [blame] | 643 | endif |
Jiri Olsa | a1c7c9e | 2013-03-18 00:41:04 +0100 | [diff] [blame] | 644 | |
Jiri Olsa | 3e6a147 | 2013-10-10 22:24:00 +0200 | [diff] [blame] | 645 | ifneq ($(filter -lbfd,$(EXTLIBS)),) |
| 646 | CFLAGS += -DHAVE_LIBBFD_SUPPORT |
| 647 | endif |
| 648 | |
Namhyung Kim | e92ce12 | 2014-10-31 16:51:38 +0900 | [diff] [blame] | 649 | ifndef NO_ZLIB |
| 650 | ifeq ($(feature-zlib), 1) |
| 651 | CFLAGS += -DHAVE_ZLIB_SUPPORT |
| 652 | EXTLIBS += -lz |
Jiri Olsa | 1571b69 | 2014-12-30 13:31:12 +0100 | [diff] [blame] | 653 | $(call detected,CONFIG_ZLIB) |
Namhyung Kim | e92ce12 | 2014-10-31 16:51:38 +0900 | [diff] [blame] | 654 | else |
| 655 | NO_ZLIB := 1 |
| 656 | endif |
| 657 | endif |
| 658 | |
Jiri Olsa | a1c7c9e | 2013-03-18 00:41:04 +0100 | [diff] [blame] | 659 | ifndef NO_BACKTRACE |
Ingo Molnar | 4cc9117 | 2013-09-30 16:49:38 +0200 | [diff] [blame] | 660 | ifeq ($(feature-backtrace), 1) |
Ingo Molnar | 89fe808 | 2013-09-30 12:07:11 +0200 | [diff] [blame] | 661 | CFLAGS += -DHAVE_BACKTRACE_SUPPORT |
Jiri Olsa | 8e1b3f6 | 2013-04-15 04:06:58 +0200 | [diff] [blame] | 662 | endif |
Jiri Olsa | a1c7c9e | 2013-03-18 00:41:04 +0100 | [diff] [blame] | 663 | endif |
Jiri Olsa | 58a0abd | 2013-03-18 00:45:27 +0100 | [diff] [blame] | 664 | |
| 665 | ifndef NO_LIBNUMA |
Ingo Molnar | 3ae069c | 2013-09-30 13:37:10 +0200 | [diff] [blame] | 666 | ifeq ($(feature-libnuma), 0) |
Dongsheng Yang | 6305edf | 2013-12-02 10:26:48 -0500 | [diff] [blame] | 667 | msg := $(warning No numa.h found, disables 'perf bench numa mem' benchmark, please install numactl-devel/libnuma-devel/libnuma-dev); |
Jiri Olsa | 8e1b3f6 | 2013-04-15 04:06:58 +0200 | [diff] [blame] | 668 | NO_LIBNUMA := 1 |
| 669 | else |
Ingo Molnar | 89fe808 | 2013-09-30 12:07:11 +0200 | [diff] [blame] | 670 | CFLAGS += -DHAVE_LIBNUMA_SUPPORT |
Jiri Olsa | 8e1b3f6 | 2013-04-15 04:06:58 +0200 | [diff] [blame] | 671 | EXTLIBS += -lnuma |
Jiri Olsa | 72965b8 | 2014-12-29 13:52:36 +0100 | [diff] [blame] | 672 | $(call detected,CONFIG_NUMA) |
Jiri Olsa | 8e1b3f6 | 2013-04-15 04:06:58 +0200 | [diff] [blame] | 673 | endif |
Jiri Olsa | 58a0abd | 2013-03-18 00:45:27 +0100 | [diff] [blame] | 674 | endif |
Jiri Olsa | cd1c39f | 2013-03-18 00:56:01 +0100 | [diff] [blame] | 675 | |
Alexander Yarygin | da50ad6 | 2014-07-03 17:59:49 +0400 | [diff] [blame] | 676 | ifdef HAVE_KVM_STAT_SUPPORT |
| 677 | CFLAGS += -DHAVE_KVM_STAT_SUPPORT |
| 678 | endif |
| 679 | |
Adrian Hunter | e477f3f | 2014-10-23 18:16:03 -0300 | [diff] [blame] | 680 | ifeq (${IS_64_BIT}, 1) |
| 681 | ifndef NO_PERF_READ_VDSO32 |
| 682 | $(call feature_check,compile-32) |
Adrian Hunter | 46b1fa8 | 2014-10-23 13:45:24 +0300 | [diff] [blame] | 683 | ifeq ($(feature-compile-32), 1) |
| 684 | CFLAGS += -DHAVE_PERF_READ_VDSO32 |
| 685 | else |
Adrian Hunter | e477f3f | 2014-10-23 18:16:03 -0300 | [diff] [blame] | 686 | NO_PERF_READ_VDSO32 := 1 |
| 687 | endif |
| 688 | endif |
| 689 | ifneq (${IS_X86_64}, 1) |
| 690 | NO_PERF_READ_VDSOX32 := 1 |
| 691 | endif |
| 692 | ifndef NO_PERF_READ_VDSOX32 |
| 693 | $(call feature_check,compile-x32) |
Adrian Hunter | 46b1fa8 | 2014-10-23 13:45:24 +0300 | [diff] [blame] | 694 | ifeq ($(feature-compile-x32), 1) |
| 695 | CFLAGS += -DHAVE_PERF_READ_VDSOX32 |
| 696 | else |
Adrian Hunter | e477f3f | 2014-10-23 18:16:03 -0300 | [diff] [blame] | 697 | NO_PERF_READ_VDSOX32 := 1 |
| 698 | endif |
| 699 | endif |
| 700 | else |
| 701 | NO_PERF_READ_VDSO32 := 1 |
| 702 | NO_PERF_READ_VDSOX32 := 1 |
| 703 | endif |
| 704 | |
Jiri Olsa | 53d0a57 | 2015-02-20 23:16:58 +0100 | [diff] [blame] | 705 | ifndef NO_LIBBABELTRACE |
Jiri Olsa | 97e7a51 | 2015-03-11 09:00:41 +0100 | [diff] [blame^] | 706 | $(call feature_check,libbabeltrace) |
| 707 | ifeq ($(feature-libbabeltrace), 1) |
Jiri Olsa | 53d0a57 | 2015-02-20 23:16:58 +0100 | [diff] [blame] | 708 | CFLAGS += -DHAVE_LIBBABELTRACE_SUPPORT $(LIBBABELTRACE_CFLAGS) |
| 709 | LDFLAGS += $(LIBBABELTRACE_LDFLAGS) |
| 710 | EXTLIBS += -lbabeltrace-ctf |
Jiri Olsa | edbe981 | 2015-02-20 23:17:00 +0100 | [diff] [blame] | 711 | $(call detected,CONFIG_LIBBABELTRACE) |
Jiri Olsa | 97e7a51 | 2015-03-11 09:00:41 +0100 | [diff] [blame^] | 712 | else |
| 713 | msg := $(warning No libbabeltrace found, disables 'perf data' CTF format support, please install libbabeltrace-dev[el]/libbabeltrace-ctf-dev); |
| 714 | NO_LIBBABELTRACE := 1 |
Jiri Olsa | 53d0a57 | 2015-02-20 23:16:58 +0100 | [diff] [blame] | 715 | endif |
| 716 | endif |
| 717 | |
Jiri Olsa | cd1c39f | 2013-03-18 00:56:01 +0100 | [diff] [blame] | 718 | # Among the variables below, these: |
| 719 | # perfexecdir |
| 720 | # template_dir |
| 721 | # mandir |
| 722 | # infodir |
| 723 | # htmldir |
| 724 | # ETC_PERFCONFIG (but not sysconfdir) |
| 725 | # can be specified as a relative path some/where/else; |
| 726 | # this is interpreted as relative to $(prefix) and "perf" at |
| 727 | # runtime figures out where they are based on the path to the executable. |
| 728 | # This can help installing the suite in a relocatable way. |
| 729 | |
| 730 | # Make the path relative to DESTDIR, not to prefix |
| 731 | ifndef DESTDIR |
Jianyu Zhan | fc9cabe | 2014-06-03 00:44:34 +0800 | [diff] [blame] | 732 | prefix ?= $(HOME) |
Jiri Olsa | cd1c39f | 2013-03-18 00:56:01 +0100 | [diff] [blame] | 733 | endif |
| 734 | bindir_relative = bin |
| 735 | bindir = $(prefix)/$(bindir_relative) |
| 736 | mandir = share/man |
| 737 | infodir = share/info |
| 738 | perfexecdir = libexec/perf-core |
| 739 | sharedir = $(prefix)/share |
| 740 | template_dir = share/perf-core/templates |
| 741 | htmldir = share/doc/perf-doc |
| 742 | ifeq ($(prefix),/usr) |
| 743 | sysconfdir = /etc |
| 744 | ETC_PERFCONFIG = $(sysconfdir)/perfconfig |
| 745 | else |
| 746 | sysconfdir = $(prefix)/etc |
| 747 | ETC_PERFCONFIG = etc/perfconfig |
| 748 | endif |
Jiri Olsa | 6997af72 | 2014-08-25 16:55:52 +0200 | [diff] [blame] | 749 | ifndef lib |
Namhyung Kim | fc67297 | 2013-09-13 15:27:43 +0900 | [diff] [blame] | 750 | ifeq ($(IS_X86_64),1) |
| 751 | lib = lib64 |
| 752 | else |
Jiri Olsa | cd1c39f | 2013-03-18 00:56:01 +0100 | [diff] [blame] | 753 | lib = lib |
Namhyung Kim | fc67297 | 2013-09-13 15:27:43 +0900 | [diff] [blame] | 754 | endif |
Jiri Olsa | 6997af72 | 2014-08-25 16:55:52 +0200 | [diff] [blame] | 755 | endif # lib |
Namhyung Kim | fc67297 | 2013-09-13 15:27:43 +0900 | [diff] [blame] | 756 | libdir = $(prefix)/$(lib) |
Jiri Olsa | cd1c39f | 2013-03-18 00:56:01 +0100 | [diff] [blame] | 757 | |
| 758 | # Shell quote (do not use $(call) to accommodate ancient setups); |
| 759 | ETC_PERFCONFIG_SQ = $(subst ','\'',$(ETC_PERFCONFIG)) |
| 760 | DESTDIR_SQ = $(subst ','\'',$(DESTDIR)) |
| 761 | bindir_SQ = $(subst ','\'',$(bindir)) |
| 762 | mandir_SQ = $(subst ','\'',$(mandir)) |
| 763 | infodir_SQ = $(subst ','\'',$(infodir)) |
| 764 | perfexecdir_SQ = $(subst ','\'',$(perfexecdir)) |
| 765 | template_dir_SQ = $(subst ','\'',$(template_dir)) |
| 766 | htmldir_SQ = $(subst ','\'',$(htmldir)) |
| 767 | prefix_SQ = $(subst ','\'',$(prefix)) |
| 768 | sysconfdir_SQ = $(subst ','\'',$(sysconfdir)) |
Namhyung Kim | fc67297 | 2013-09-13 15:27:43 +0900 | [diff] [blame] | 769 | libdir_SQ = $(subst ','\'',$(libdir)) |
Jiri Olsa | cd1c39f | 2013-03-18 00:56:01 +0100 | [diff] [blame] | 770 | |
| 771 | ifneq ($(filter /%,$(firstword $(perfexecdir))),) |
| 772 | perfexec_instdir = $(perfexecdir) |
| 773 | else |
| 774 | perfexec_instdir = $(prefix)/$(perfexecdir) |
| 775 | endif |
| 776 | perfexec_instdir_SQ = $(subst ','\'',$(perfexec_instdir)) |
Jiri Olsa | 3d7c014 | 2013-12-03 14:09:21 +0100 | [diff] [blame] | 777 | |
| 778 | # If we install to $(HOME) we keep the traceevent default: |
| 779 | # $(HOME)/.traceevent/plugins |
| 780 | # Otherwise we install plugins into the global $(libdir). |
| 781 | ifdef DESTDIR |
| 782 | plugindir=$(libdir)/traceevent/plugins |
Josh Boyer | b935a58 | 2014-01-22 10:01:48 -0500 | [diff] [blame] | 783 | plugindir_SQ= $(subst ','\'',$(plugindir)) |
Jiri Olsa | 3d7c014 | 2013-12-03 14:09:21 +0100 | [diff] [blame] | 784 | endif |
Jiri Olsa | 0695e57 | 2014-02-19 16:52:54 +0100 | [diff] [blame] | 785 | |
| 786 | # |
| 787 | # Print the result of the feature test: |
| 788 | # |
Jiri Olsa | 8d79076 | 2014-02-19 16:52:55 +0100 | [diff] [blame] | 789 | feature_print_status = $(eval $(feature_print_status_code)) $(info $(MSG)) |
Jiri Olsa | 0695e57 | 2014-02-19 16:52:54 +0100 | [diff] [blame] | 790 | |
Jiri Olsa | 8d79076 | 2014-02-19 16:52:55 +0100 | [diff] [blame] | 791 | define feature_print_status_code |
Jiri Olsa | 0695e57 | 2014-02-19 16:52:54 +0100 | [diff] [blame] | 792 | ifeq ($(feature-$(1)), 1) |
| 793 | MSG = $(shell printf '...%30s: [ \033[32mon\033[m ]' $(1)) |
| 794 | else |
| 795 | MSG = $(shell printf '...%30s: [ \033[31mOFF\033[m ]' $(1)) |
| 796 | endif |
| 797 | endef |
| 798 | |
Jiri Olsa | 8d79076 | 2014-02-19 16:52:55 +0100 | [diff] [blame] | 799 | feature_print_var = $(eval $(feature_print_var_code)) $(info $(MSG)) |
| 800 | define feature_print_var_code |
| 801 | MSG = $(shell printf '...%30s: %s' $(1) $($(1))) |
| 802 | endef |
| 803 | |
| 804 | feature_print_text = $(eval $(feature_print_text_code)) $(info $(MSG)) |
| 805 | define feature_print_text_code |
| 806 | MSG = $(shell printf '...%30s: %s' $(1) $(2)) |
| 807 | endef |
| 808 | |
Jiri Olsa | 0695e57 | 2014-02-19 16:52:54 +0100 | [diff] [blame] | 809 | PERF_FEATURES := $(foreach feat,$(LIB_FEATURE_TESTS),feature-$(feat)($(feature-$(feat)))) |
| 810 | PERF_FEATURES_FILE := $(shell touch $(OUTPUT)PERF-FEATURES; cat $(OUTPUT)PERF-FEATURES) |
| 811 | |
Jiri Olsa | 0a4f2b6 | 2014-02-19 16:52:58 +0100 | [diff] [blame] | 812 | ifeq ($(dwarf-post-unwind),1) |
| 813 | PERF_FEATURES += dwarf-post-unwind($(dwarf-post-unwind-text)) |
| 814 | endif |
| 815 | |
Jiri Olsa | 0695e57 | 2014-02-19 16:52:54 +0100 | [diff] [blame] | 816 | # The $(display_lib) controls the default detection message |
| 817 | # output. It's set if: |
| 818 | # - detected features differes from stored features from |
| 819 | # last build (in PERF-FEATURES file) |
| 820 | # - one of the $(LIB_FEATURE_TESTS) is not detected |
| 821 | # - VF is enabled |
| 822 | |
| 823 | ifneq ("$(PERF_FEATURES)","$(PERF_FEATURES_FILE)") |
| 824 | $(shell echo "$(PERF_FEATURES)" > $(OUTPUT)PERF-FEATURES) |
| 825 | display_lib := 1 |
| 826 | endif |
| 827 | |
| 828 | feature_check = $(eval $(feature_check_code)) |
| 829 | define feature_check_code |
| 830 | ifneq ($(feature-$(1)), 1) |
| 831 | display_lib := 1 |
| 832 | endif |
| 833 | endef |
| 834 | |
| 835 | $(foreach feat,$(LIB_FEATURE_TESTS),$(call feature_check,$(feat))) |
| 836 | |
| 837 | ifeq ($(VF),1) |
| 838 | display_lib := 1 |
| 839 | display_vf := 1 |
| 840 | endif |
| 841 | |
| 842 | ifeq ($(display_lib),1) |
| 843 | $(info ) |
| 844 | $(info Auto-detecting system features:) |
Jiri Olsa | 8d79076 | 2014-02-19 16:52:55 +0100 | [diff] [blame] | 845 | $(foreach feat,$(LIB_FEATURE_TESTS),$(call feature_print_status,$(feat),)) |
Jiri Olsa | 0a4f2b6 | 2014-02-19 16:52:58 +0100 | [diff] [blame] | 846 | |
| 847 | ifeq ($(dwarf-post-unwind),1) |
| 848 | $(call feature_print_text,"DWARF post unwind library", $(dwarf-post-unwind-text)) |
| 849 | endif |
Jiri Olsa | 0695e57 | 2014-02-19 16:52:54 +0100 | [diff] [blame] | 850 | endif |
| 851 | |
| 852 | ifeq ($(display_vf),1) |
Jiri Olsa | 8d79076 | 2014-02-19 16:52:55 +0100 | [diff] [blame] | 853 | $(foreach feat,$(VF_FEATURE_TESTS),$(call feature_print_status,$(feat),)) |
| 854 | $(info ) |
| 855 | $(call feature_print_var,prefix) |
| 856 | $(call feature_print_var,bindir) |
| 857 | $(call feature_print_var,libdir) |
| 858 | $(call feature_print_var,sysconfdir) |
Jiri Olsa | 0a4f2b6 | 2014-02-19 16:52:58 +0100 | [diff] [blame] | 859 | $(call feature_print_var,LIBUNWIND_DIR) |
| 860 | $(call feature_print_var,LIBDW_DIR) |
Jiri Olsa | 0695e57 | 2014-02-19 16:52:54 +0100 | [diff] [blame] | 861 | endif |
| 862 | |
| 863 | ifeq ($(display_lib),1) |
| 864 | $(info ) |
| 865 | endif |
Jiri Olsa | f39e042 | 2014-12-29 15:03:09 +0100 | [diff] [blame] | 866 | |
| 867 | $(call detected_var,bindir_SQ) |
| 868 | $(call detected_var,PYTHON_WORD) |
| 869 | ifneq ($(OUTPUT),) |
| 870 | $(call detected_var,OUTPUT) |
| 871 | endif |
Jiri Olsa | 285ab8b | 2014-12-29 15:13:44 +0100 | [diff] [blame] | 872 | $(call detected_var,htmldir_SQ) |
| 873 | $(call detected_var,infodir_SQ) |
| 874 | $(call detected_var,mandir_SQ) |
Jiri Olsa | 9352aab | 2014-12-29 17:42:46 +0100 | [diff] [blame] | 875 | $(call detected_var,ETC_PERFCONFIG_SQ) |
| 876 | $(call detected_var,prefix_SQ) |
| 877 | $(call detected_var,perfexecdir_SQ) |
Jiri Olsa | 3b939a6 | 2014-12-30 00:16:01 +0100 | [diff] [blame] | 878 | $(call detected_var,LIBDIR) |
Jiri Olsa | 88aeea0 | 2014-12-30 00:34:23 +0100 | [diff] [blame] | 879 | $(call detected_var,GTK_CFLAGS) |
Jiri Olsa | c7355f8 | 2014-12-30 13:11:32 +0100 | [diff] [blame] | 880 | $(call detected_var,PERL_EMBED_CCOPTS) |
| 881 | $(call detected_var,PYTHON_EMBED_CCOPTS) |