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