Jiri Olsa | 8bd407b | 2013-03-15 16:28:49 +0100 | [diff] [blame] | 1 | uname_M := $(shell uname -m 2>/dev/null || echo not) |
| 2 | |
| 3 | ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \ |
Jiri Olsa | 8e1b3f6 | 2013-04-15 04:06:58 +0200 | [diff] [blame] | 4 | -e s/arm.*/arm/ -e s/sa110/arm/ \ |
| 5 | -e s/s390x/s390/ -e s/parisc64/parisc/ \ |
| 6 | -e s/ppc.*/powerpc/ -e s/mips.*/mips/ \ |
| 7 | -e s/sh[234].*/sh/ -e s/aarch64.*/arm64/ ) |
Jiri Olsa | 8bd407b | 2013-03-15 16:28:49 +0100 | [diff] [blame] | 8 | NO_PERF_REGS := 1 |
Jiri Olsa | 9c12cf9 | 2013-03-21 11:30:54 +0100 | [diff] [blame] | 9 | CFLAGS := $(EXTRA_CFLAGS) $(EXTRA_WARNINGS) |
Jiri Olsa | 8bd407b | 2013-03-15 16:28:49 +0100 | [diff] [blame] | 10 | |
| 11 | # Additional ARCH settings for x86 |
| 12 | ifeq ($(ARCH),i386) |
Jiri Olsa | 8e1b3f6 | 2013-04-15 04:06:58 +0200 | [diff] [blame] | 13 | override ARCH := x86 |
| 14 | NO_PERF_REGS := 0 |
| 15 | LIBUNWIND_LIBS = -lunwind -lunwind-x86 |
Jiri Olsa | 8bd407b | 2013-03-15 16:28:49 +0100 | [diff] [blame] | 16 | endif |
| 17 | |
| 18 | ifeq ($(ARCH),x86_64) |
Jiri Olsa | 8e1b3f6 | 2013-04-15 04:06:58 +0200 | [diff] [blame] | 19 | override ARCH := x86 |
| 20 | IS_X86_64 := 0 |
| 21 | ifeq (, $(findstring m32,$(CFLAGS))) |
| 22 | IS_X86_64 := $(shell echo __x86_64__ | ${CC} -E -x c - | tail -n 1) |
| 23 | endif |
| 24 | ifeq (${IS_X86_64}, 1) |
| 25 | RAW_ARCH := x86_64 |
Ingo Molnar | 89fe808 | 2013-09-30 12:07:11 +0200 | [diff] [blame] | 26 | CFLAGS += -DHAVE_ARCH_X86_64_SUPPORT |
Jiri Olsa | 8e1b3f6 | 2013-04-15 04:06:58 +0200 | [diff] [blame] | 27 | ARCH_INCLUDE = ../../arch/x86/lib/memcpy_64.S ../../arch/x86/lib/memset_64.S |
| 28 | endif |
| 29 | NO_PERF_REGS := 0 |
| 30 | LIBUNWIND_LIBS = -lunwind -lunwind-x86_64 |
Jiri Olsa | 8bd407b | 2013-03-15 16:28:49 +0100 | [diff] [blame] | 31 | endif |
| 32 | |
| 33 | ifeq ($(NO_PERF_REGS),0) |
Ingo Molnar | 89fe808 | 2013-09-30 12:07:11 +0200 | [diff] [blame] | 34 | CFLAGS += -DHAVE_PERF_REGS_SUPPORT |
Jiri Olsa | 8bd407b | 2013-03-15 16:28:49 +0100 | [diff] [blame] | 35 | endif |
Jiri Olsa | a32f493 | 2013-03-25 00:32:01 +0100 | [diff] [blame] | 36 | |
Jiri Olsa | 7c53746 | 2013-05-24 14:35:23 +0200 | [diff] [blame] | 37 | ifeq ($(src-perf),) |
| 38 | src-perf := $(srctree)/tools/perf |
| 39 | endif |
| 40 | |
| 41 | ifeq ($(obj-perf),) |
Robert Richter | 107de37 | 2013-06-11 17:22:38 +0200 | [diff] [blame] | 42 | obj-perf := $(OUTPUT) |
Jiri Olsa | 7c53746 | 2013-05-24 14:35:23 +0200 | [diff] [blame] | 43 | endif |
| 44 | |
| 45 | ifneq ($(obj-perf),) |
| 46 | obj-perf := $(abspath $(obj-perf))/ |
| 47 | endif |
| 48 | |
Robert Richter | 4e31902 | 2013-06-11 17:29:18 +0200 | [diff] [blame] | 49 | LIB_INCLUDE := $(srctree)/tools/lib/ |
| 50 | |
Jiri Olsa | 7c53746 | 2013-05-24 14:35:23 +0200 | [diff] [blame] | 51 | # include ARCH specific config |
| 52 | -include $(src-perf)/arch/$(ARCH)/Makefile |
| 53 | |
Jiri Olsa | 7c53746 | 2013-05-24 14:35:23 +0200 | [diff] [blame] | 54 | include $(src-perf)/config/utilities.mak |
Jiri Olsa | a32f493 | 2013-03-25 00:32:01 +0100 | [diff] [blame] | 55 | |
| 56 | ifeq ($(call get-executable,$(FLEX)),) |
Jiri Olsa | 8e1b3f6 | 2013-04-15 04:06:58 +0200 | [diff] [blame] | 57 | dummy := $(error Error: $(FLEX) is missing on this system, please install it) |
Jiri Olsa | a32f493 | 2013-03-25 00:32:01 +0100 | [diff] [blame] | 58 | endif |
| 59 | |
| 60 | ifeq ($(call get-executable,$(BISON)),) |
Jiri Olsa | 8e1b3f6 | 2013-04-15 04:06:58 +0200 | [diff] [blame] | 61 | dummy := $(error Error: $(BISON) is missing on this system, please install it) |
Jiri Olsa | a32f493 | 2013-03-25 00:32:01 +0100 | [diff] [blame] | 62 | endif |
Jiri Olsa | 362493f | 2013-03-25 00:40:48 +0100 | [diff] [blame] | 63 | |
| 64 | # Treat warnings as errors unless directed not to |
| 65 | ifneq ($(WERROR),0) |
Jiri Olsa | 8e1b3f6 | 2013-04-15 04:06:58 +0200 | [diff] [blame] | 66 | CFLAGS += -Werror |
Jiri Olsa | 362493f | 2013-03-25 00:40:48 +0100 | [diff] [blame] | 67 | endif |
| 68 | |
| 69 | ifeq ("$(origin DEBUG)", "command line") |
Jiri Olsa | 8e1b3f6 | 2013-04-15 04:06:58 +0200 | [diff] [blame] | 70 | PERF_DEBUG = $(DEBUG) |
Jiri Olsa | 362493f | 2013-03-25 00:40:48 +0100 | [diff] [blame] | 71 | endif |
| 72 | ifndef PERF_DEBUG |
Jiri Olsa | 8e1b3f6 | 2013-04-15 04:06:58 +0200 | [diff] [blame] | 73 | CFLAGS += -O6 |
Jiri Olsa | 362493f | 2013-03-25 00:40:48 +0100 | [diff] [blame] | 74 | endif |
| 75 | |
| 76 | ifdef PARSER_DEBUG |
Jiri Olsa | 8e1b3f6 | 2013-04-15 04:06:58 +0200 | [diff] [blame] | 77 | PARSER_DEBUG_BISON := -t |
| 78 | PARSER_DEBUG_FLEX := -d |
| 79 | CFLAGS += -DPARSER_DEBUG |
Jiri Olsa | 362493f | 2013-03-25 00:40:48 +0100 | [diff] [blame] | 80 | endif |
| 81 | |
Jiri Olsa | 2fe7374 | 2013-04-15 04:32:28 +0200 | [diff] [blame] | 82 | CFLAGS += -fno-omit-frame-pointer |
| 83 | CFLAGS += -ggdb3 |
| 84 | CFLAGS += -funwind-tables |
| 85 | CFLAGS += -Wall |
| 86 | CFLAGS += -Wextra |
| 87 | CFLAGS += -std=gnu99 |
Jiri Olsa | 9c12cf9 | 2013-03-21 11:30:54 +0100 | [diff] [blame] | 88 | |
David Ahern | 6d19912 | 2013-09-22 19:44:57 -0600 | [diff] [blame] | 89 | EXTLIBS = -lelf -lpthread -lrt -lm -ldl |
Jiri Olsa | 362493f | 2013-03-25 00:40:48 +0100 | [diff] [blame] | 90 | |
Ingo Molnar | 1c2d1d8 | 2013-10-03 15:05:56 +0200 | [diff] [blame] | 91 | ifneq ($(OUTPUT),) |
| 92 | OUTPUT_FEATURES = $(OUTPUT)config/feature-checks/ |
| 93 | $(shell mkdir -p $(OUTPUT_FEATURES)) |
| 94 | endif |
| 95 | |
Ingo Molnar | baa9c30 | 2013-10-01 14:14:31 +0200 | [diff] [blame] | 96 | feature_check = $(eval $(feature_check_code)) |
Ingo Molnar | b6aa997 | 2013-09-30 10:08:24 +0200 | [diff] [blame] | 97 | define feature_check_code |
Ingo Molnar | aa4acf6 | 2013-10-07 17:51:29 +0200 | [diff] [blame] | 98 | feature-$(1) := $(shell $(MAKE) OUTPUT=$(OUTPUT_FEATURES) LDFLAGS=$(LDFLAGS) -C config/feature-checks test-$1 >/dev/null 2>/dev/null && echo 1 || echo 0) |
Ingo Molnar | baa9c30 | 2013-10-01 14:14:31 +0200 | [diff] [blame] | 99 | endef |
| 100 | |
| 101 | feature_set = $(eval $(feature_set_code)) |
| 102 | define feature_set_code |
| 103 | feature-$(1) := 1 |
Ingo Molnar | b6aa997 | 2013-09-30 10:08:24 +0200 | [diff] [blame] | 104 | endef |
| 105 | |
| 106 | # |
| 107 | # Build the feature check binaries in parallel, ignore errors, ignore return value and suppress output: |
| 108 | # |
Ingo Molnar | b6aa997 | 2013-09-30 10:08:24 +0200 | [diff] [blame] | 109 | |
Ingo Molnar | f1138ec | 2013-10-02 09:54:43 +0200 | [diff] [blame] | 110 | # |
| 111 | # Note that this is not a complete list of all feature tests, just |
| 112 | # those that are typically built on a fully configured system. |
| 113 | # |
| 114 | # [ Feature tests not mentioned here have to be built explicitly in |
| 115 | # the rule that uses them - an example for that is the 'bionic' |
| 116 | # feature check. ] |
| 117 | # |
| 118 | CORE_FEATURE_TESTS = \ |
| 119 | backtrace \ |
Ingo Molnar | 8295d4e | 2013-10-07 10:35:39 +0200 | [diff] [blame] | 120 | dwarf \ |
Ingo Molnar | f1138ec | 2013-10-02 09:54:43 +0200 | [diff] [blame] | 121 | fortify-source \ |
| 122 | glibc \ |
Ingo Molnar | 7ef9e05 | 2013-09-30 15:01:56 +0200 | [diff] [blame] | 123 | gtk2 \ |
Ingo Molnar | c7a79e9 | 2013-09-30 15:08:30 +0200 | [diff] [blame] | 124 | gtk2-infobar \ |
Ingo Molnar | f1138ec | 2013-10-02 09:54:43 +0200 | [diff] [blame] | 125 | libaudit \ |
| 126 | libbfd \ |
| 127 | libelf \ |
| 128 | libelf-getphdrnum \ |
| 129 | libelf-mmap \ |
| 130 | libnuma \ |
Ingo Molnar | 7181a67 | 2013-09-30 15:15:36 +0200 | [diff] [blame] | 131 | libperl \ |
Ingo Molnar | 9734163 | 2013-09-30 15:18:37 +0200 | [diff] [blame] | 132 | libpython \ |
Ingo Molnar | 95d061c | 2013-09-30 15:40:04 +0200 | [diff] [blame] | 133 | libpython-version \ |
Ingo Molnar | f1138ec | 2013-10-02 09:54:43 +0200 | [diff] [blame] | 134 | libslang \ |
| 135 | libunwind \ |
Ingo Molnar | 34ef216 | 2013-09-30 16:46:49 +0200 | [diff] [blame] | 136 | on-exit \ |
Ingo Molnar | f1138ec | 2013-10-02 09:54:43 +0200 | [diff] [blame] | 137 | stackprotector \ |
| 138 | stackprotector-all \ |
| 139 | volatile-register-var |
Ingo Molnar | b6aa997 | 2013-09-30 10:08:24 +0200 | [diff] [blame] | 140 | |
Ingo Molnar | baa9c30 | 2013-10-01 14:14:31 +0200 | [diff] [blame] | 141 | # |
Ingo Molnar | b3b64a1 | 2013-10-02 10:01:42 +0200 | [diff] [blame] | 142 | # So here we detect whether test-all was rebuilt, to be able |
| 143 | # to skip the print-out of the long features list if the file |
| 144 | # existed before and after it was built: |
| 145 | # |
Ingo Molnar | 1c2d1d8 | 2013-10-03 15:05:56 +0200 | [diff] [blame] | 146 | ifeq ($(wildcard $(OUTPUT)config/feature-checks/test-all),) |
Ingo Molnar | b3b64a1 | 2013-10-02 10:01:42 +0200 | [diff] [blame] | 147 | test-all-failed := 1 |
| 148 | else |
| 149 | test-all-failed := 0 |
| 150 | endif |
| 151 | |
| 152 | # |
Ingo Molnar | baa9c30 | 2013-10-01 14:14:31 +0200 | [diff] [blame] | 153 | # Special fast-path for the 'all features are available' case: |
| 154 | # |
Ingo Molnar | b3b64a1 | 2013-10-02 10:01:42 +0200 | [diff] [blame] | 155 | $(call feature_check,all,$(MSG)) |
| 156 | |
| 157 | # |
| 158 | # Just in case the build freshly failed, make sure we print the |
| 159 | # feature matrix: |
| 160 | # |
| 161 | ifeq ($(feature-all), 0) |
| 162 | test-all-failed := 1 |
| 163 | endif |
| 164 | |
| 165 | ifeq ($(test-all-failed),1) |
| 166 | $(info ) |
| 167 | $(info Auto-detecting system features:) |
| 168 | endif |
Ingo Molnar | baa9c30 | 2013-10-01 14:14:31 +0200 | [diff] [blame] | 169 | |
| 170 | ifeq ($(feature-all), 1) |
Ingo Molnar | f1138ec | 2013-10-02 09:54:43 +0200 | [diff] [blame] | 171 | # |
| 172 | # test-all.c passed - just set all the core feature flags to 1: |
| 173 | # |
| 174 | $(foreach feat,$(CORE_FEATURE_TESTS),$(call feature_set,$(feat))) |
Ingo Molnar | baa9c30 | 2013-10-01 14:14:31 +0200 | [diff] [blame] | 175 | else |
Ingo Molnar | aa4acf6 | 2013-10-07 17:51:29 +0200 | [diff] [blame] | 176 | $(shell $(MAKE) OUTPUT=$(OUTPUT_FEATURES) LDFLAGS=$(LDFLAGS) -i -j -C config/feature-checks $(CORE_FEATURE_TESTS) >/dev/null 2>&1) |
Ingo Molnar | f1138ec | 2013-10-02 09:54:43 +0200 | [diff] [blame] | 177 | $(foreach feat,$(CORE_FEATURE_TESTS),$(call feature_check,$(feat))) |
Ingo Molnar | baa9c30 | 2013-10-01 14:14:31 +0200 | [diff] [blame] | 178 | endif |
| 179 | |
Ingo Molnar | baa9c30 | 2013-10-01 14:14:31 +0200 | [diff] [blame] | 180 | # |
| 181 | # Print the result of the feature test: |
| 182 | # |
Jiri Olsa | 165108a | 2013-10-08 17:51:10 +0200 | [diff] [blame] | 183 | feature_print = $(eval $(feature_print_code)) $(info $(MSG)) |
| 184 | |
Ingo Molnar | baa9c30 | 2013-10-01 14:14:31 +0200 | [diff] [blame] | 185 | define feature_print_code |
| 186 | ifeq ($(feature-$(1)), 1) |
Ingo Molnar | 73a725f | 2013-10-02 11:58:30 +0200 | [diff] [blame] | 187 | MSG = $(shell printf '...%30s: [ \033[32mon\033[m ]' $(1)) |
Ingo Molnar | baa9c30 | 2013-10-01 14:14:31 +0200 | [diff] [blame] | 188 | else |
Ingo Molnar | 73a725f | 2013-10-02 11:58:30 +0200 | [diff] [blame] | 189 | MSG = $(shell printf '...%30s: [ \033[31mOFF\033[m ]' $(1)) |
Ingo Molnar | baa9c30 | 2013-10-01 14:14:31 +0200 | [diff] [blame] | 190 | endif |
Ingo Molnar | baa9c30 | 2013-10-01 14:14:31 +0200 | [diff] [blame] | 191 | endef |
| 192 | |
Ingo Molnar | b3b64a1 | 2013-10-02 10:01:42 +0200 | [diff] [blame] | 193 | # |
| 194 | # Only print out our features if we rebuilt the testcases or if a test failed: |
| 195 | # |
| 196 | ifeq ($(test-all-failed), 1) |
Jiri Olsa | 165108a | 2013-10-08 17:51:10 +0200 | [diff] [blame] | 197 | $(foreach feat,$(CORE_FEATURE_TESTS),$(call feature_print,$(feat))) |
Ingo Molnar | b3b64a1 | 2013-10-02 10:01:42 +0200 | [diff] [blame] | 198 | $(info ) |
| 199 | endif |
Ingo Molnar | b6aa997 | 2013-09-30 10:08:24 +0200 | [diff] [blame] | 200 | |
Ingo Molnar | 90ac542 | 2013-09-30 13:48:44 +0200 | [diff] [blame] | 201 | ifeq ($(feature-stackprotector-all), 1) |
Jiri Olsa | 8e1b3f6 | 2013-04-15 04:06:58 +0200 | [diff] [blame] | 202 | CFLAGS += -fstack-protector-all |
Jiri Olsa | 362493f | 2013-03-25 00:40:48 +0100 | [diff] [blame] | 203 | endif |
| 204 | |
Ingo Molnar | 430be5a | 2013-10-07 09:47:00 +0200 | [diff] [blame] | 205 | ifeq ($(feature-stackprotector), 1) |
Jiri Olsa | 8e1b3f6 | 2013-04-15 04:06:58 +0200 | [diff] [blame] | 206 | CFLAGS += -Wstack-protector |
Jiri Olsa | 362493f | 2013-03-25 00:40:48 +0100 | [diff] [blame] | 207 | endif |
| 208 | |
Ingo Molnar | c251044 | 2013-09-30 13:58:12 +0200 | [diff] [blame] | 209 | ifeq ($(feature-volatile-register-var), 1) |
Jiri Olsa | 8e1b3f6 | 2013-04-15 04:06:58 +0200 | [diff] [blame] | 210 | CFLAGS += -Wvolatile-register-var |
Jiri Olsa | 362493f | 2013-03-25 00:40:48 +0100 | [diff] [blame] | 211 | endif |
| 212 | |
| 213 | ifndef PERF_DEBUG |
Ingo Molnar | 1ea6f99 | 2013-10-07 09:38:28 +0200 | [diff] [blame] | 214 | ifeq ($(feature-fortify-source), 1) |
Jiri Olsa | 8e1b3f6 | 2013-04-15 04:06:58 +0200 | [diff] [blame] | 215 | CFLAGS += -D_FORTIFY_SOURCE=2 |
| 216 | endif |
Jiri Olsa | 362493f | 2013-03-25 00:40:48 +0100 | [diff] [blame] | 217 | endif |
| 218 | |
Jiri Olsa | 2fe7374 | 2013-04-15 04:32:28 +0200 | [diff] [blame] | 219 | CFLAGS += -I$(src-perf)/util/include |
| 220 | CFLAGS += -I$(src-perf)/arch/$(ARCH)/include |
| 221 | CFLAGS += -I$(srctree)/arch/$(ARCH)/include/uapi |
| 222 | CFLAGS += -I$(srctree)/arch/$(ARCH)/include |
| 223 | CFLAGS += -I$(srctree)/include/uapi |
| 224 | CFLAGS += -I$(srctree)/include |
Jiri Olsa | 7c53746 | 2013-05-24 14:35:23 +0200 | [diff] [blame] | 225 | |
| 226 | # $(obj-perf) for generated common-cmds.h |
| 227 | # $(obj-perf)/util for generated bison/flex headers |
| 228 | ifneq ($(OUTPUT),) |
Jiri Olsa | 2fe7374 | 2013-04-15 04:32:28 +0200 | [diff] [blame] | 229 | CFLAGS += -I$(obj-perf)/util |
| 230 | CFLAGS += -I$(obj-perf) |
Jiri Olsa | 7c53746 | 2013-05-24 14:35:23 +0200 | [diff] [blame] | 231 | endif |
| 232 | |
Jiri Olsa | 2fe7374 | 2013-04-15 04:32:28 +0200 | [diff] [blame] | 233 | CFLAGS += -I$(src-perf)/util |
| 234 | CFLAGS += -I$(src-perf) |
Robert Richter | 4e31902 | 2013-06-11 17:29:18 +0200 | [diff] [blame] | 235 | CFLAGS += -I$(LIB_INCLUDE) |
Jiri Olsa | 7c53746 | 2013-05-24 14:35:23 +0200 | [diff] [blame] | 236 | |
Jiri Olsa | 2fe7374 | 2013-04-15 04:32:28 +0200 | [diff] [blame] | 237 | CFLAGS += -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE |
Jiri Olsa | 362493f | 2013-03-25 00:40:48 +0100 | [diff] [blame] | 238 | |
Jiri Olsa | 4e22db4 | 2013-05-24 14:35:24 +0200 | [diff] [blame] | 239 | ifndef NO_BIONIC |
Ingo Molnar | 78e9d65 | 2013-09-30 14:11:46 +0200 | [diff] [blame] | 240 | $(feature_check,bionic) |
| 241 | ifeq ($(feature-bionic), 1) |
| 242 | BIONIC := 1 |
| 243 | EXTLIBS := $(filter-out -lrt,$(EXTLIBS)) |
| 244 | EXTLIBS := $(filter-out -lpthread,$(EXTLIBS)) |
| 245 | endif |
Jiri Olsa | 362493f | 2013-03-25 00:40:48 +0100 | [diff] [blame] | 246 | endif |
Jiri Olsa | cf4cca1 | 2013-03-25 00:45:08 +0100 | [diff] [blame] | 247 | |
| 248 | ifdef NO_LIBELF |
Jiri Olsa | 8e1b3f6 | 2013-04-15 04:06:58 +0200 | [diff] [blame] | 249 | NO_DWARF := 1 |
| 250 | NO_DEMANGLE := 1 |
| 251 | NO_LIBUNWIND := 1 |
Jiri Olsa | cf4cca1 | 2013-03-25 00:45:08 +0100 | [diff] [blame] | 252 | else |
Ingo Molnar | 8f7f800 | 2013-09-30 14:20:25 +0200 | [diff] [blame] | 253 | ifeq ($(feature-libelf), 0) |
Ingo Molnar | e12762c | 2013-10-07 10:34:20 +0200 | [diff] [blame] | 254 | ifeq ($(feature-glibc), 1) |
Ingo Molnar | 50eed7a | 2013-09-30 14:11:16 +0200 | [diff] [blame] | 255 | LIBC_SUPPORT := 1 |
| 256 | endif |
| 257 | ifeq ($(BIONIC),1) |
| 258 | LIBC_SUPPORT := 1 |
| 259 | endif |
| 260 | ifeq ($(LIBC_SUPPORT),1) |
| 261 | 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] | 262 | |
Ingo Molnar | 50eed7a | 2013-09-30 14:11:16 +0200 | [diff] [blame] | 263 | NO_LIBELF := 1 |
| 264 | NO_DWARF := 1 |
| 265 | NO_DEMANGLE := 1 |
| 266 | else |
| 267 | msg := $(error No gnu/libc-version.h found, please install glibc-dev[el]/glibc-static); |
| 268 | endif |
Jiri Olsa | 8e1b3f6 | 2013-04-15 04:06:58 +0200 | [diff] [blame] | 269 | else |
Ingo Molnar | 50eed7a | 2013-09-30 14:11:16 +0200 | [diff] [blame] | 270 | # for linking with debug library, run like: |
| 271 | # make DEBUG=1 LIBDW_DIR=/opt/libdw/ |
| 272 | ifdef LIBDW_DIR |
| 273 | LIBDW_CFLAGS := -I$(LIBDW_DIR)/include |
| 274 | LIBDW_LDFLAGS := -L$(LIBDW_DIR)/lib |
| 275 | endif |
Jiri Olsa | cf4cca1 | 2013-03-25 00:45:08 +0100 | [diff] [blame] | 276 | |
Ingo Molnar | 8295d4e | 2013-10-07 10:35:39 +0200 | [diff] [blame] | 277 | ifneq ($(feature-dwarf), 1) |
Ingo Molnar | 50eed7a | 2013-09-30 14:11:16 +0200 | [diff] [blame] | 278 | 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); |
| 279 | NO_DWARF := 1 |
| 280 | endif # Dwarf support |
Ingo Molnar | 0648f83 | 2013-10-02 15:30:35 +0200 | [diff] [blame] | 281 | endif # libelf support |
Jiri Olsa | cf4cca1 | 2013-03-25 00:45:08 +0100 | [diff] [blame] | 282 | endif # NO_LIBELF |
| 283 | |
| 284 | ifndef NO_LIBELF |
Ingo Molnar | fb3d333 | 2013-10-07 10:05:51 +0200 | [diff] [blame] | 285 | CFLAGS += -DHAVE_LIBELF_SUPPORT |
| 286 | FLAGS_LIBELF=$(CFLAGS) $(LDFLAGS) $(EXTLIBS) |
Jiri Olsa | 779724f | 2013-03-25 00:48:14 +0100 | [diff] [blame] | 287 | |
Ingo Molnar | 8869b17 | 2013-09-30 15:02:28 +0200 | [diff] [blame] | 288 | ifeq ($(feature-libelf-mmap), 1) |
Ingo Molnar | fb3d333 | 2013-10-07 10:05:51 +0200 | [diff] [blame] | 289 | CFLAGS += -DHAVE_LIBELF_MMAP_SUPPORT |
| 290 | endif |
Jiri Olsa | 779724f | 2013-03-25 00:48:14 +0100 | [diff] [blame] | 291 | |
Ingo Molnar | b7bcef6 | 2013-09-30 14:35:27 +0200 | [diff] [blame] | 292 | ifeq ($(feature-libelf-getphdrnum), 1) |
Ingo Molnar | fb3d333 | 2013-10-07 10:05:51 +0200 | [diff] [blame] | 293 | CFLAGS += -DHAVE_ELF_GETPHDRNUM_SUPPORT |
| 294 | endif |
Jiri Olsa | 779724f | 2013-03-25 00:48:14 +0100 | [diff] [blame] | 295 | |
Ingo Molnar | fb3d333 | 2013-10-07 10:05:51 +0200 | [diff] [blame] | 296 | # include ARCH specific config |
| 297 | -include $(src-perf)/arch/$(ARCH)/Makefile |
| 298 | |
| 299 | ifndef NO_DWARF |
| 300 | ifeq ($(origin PERF_HAVE_DWARF_REGS), undefined) |
| 301 | msg := $(warning DWARF register mappings have not been defined for architecture $(ARCH), DWARF support disabled); |
| 302 | NO_DWARF := 1 |
| 303 | else |
| 304 | CFLAGS += -DHAVE_DWARF_SUPPORT $(LIBDW_CFLAGS) |
| 305 | LDFLAGS += $(LIBDW_LDFLAGS) |
| 306 | EXTLIBS += -lelf -ldw |
| 307 | endif # PERF_HAVE_DWARF_REGS |
| 308 | endif # NO_DWARF |
Jiri Olsa | cf4cca1 | 2013-03-25 00:45:08 +0100 | [diff] [blame] | 309 | endif # NO_LIBELF |
Jiri Olsa | 0e433fe | 2013-03-25 00:53:03 +0100 | [diff] [blame] | 310 | |
Jiri Olsa | 1e9f7aa | 2013-03-21 11:41:05 +0100 | [diff] [blame] | 311 | ifndef NO_LIBELF |
Ingo Molnar | fb3d333 | 2013-10-07 10:05:51 +0200 | [diff] [blame] | 312 | CFLAGS += -DHAVE_LIBELF_SUPPORT |
Ingo Molnar | 8869b17 | 2013-09-30 15:02:28 +0200 | [diff] [blame] | 313 | ifeq ($(feature-libelf-mmap), 1) |
Ingo Molnar | fb3d333 | 2013-10-07 10:05:51 +0200 | [diff] [blame] | 314 | CFLAGS += -DHAVE_LIBELF_MMAP_SUPPORT |
Ingo Molnar | b7bcef6 | 2013-09-30 14:35:27 +0200 | [diff] [blame] | 315 | endif |
Jiri Olsa | 1e9f7aa | 2013-03-21 11:41:05 +0100 | [diff] [blame] | 316 | endif # NO_LIBELF |
| 317 | |
Jiri Olsa | 0e433fe | 2013-03-25 00:53:03 +0100 | [diff] [blame] | 318 | # There's only x86 (both 32 and 64) support for CFI unwind so far |
| 319 | ifneq ($(ARCH),x86) |
Jiri Olsa | 8e1b3f6 | 2013-04-15 04:06:58 +0200 | [diff] [blame] | 320 | NO_LIBUNWIND := 1 |
Jiri Olsa | 0e433fe | 2013-03-25 00:53:03 +0100 | [diff] [blame] | 321 | endif |
| 322 | |
| 323 | ifndef NO_LIBUNWIND |
Ingo Molnar | 058f952 | 2013-09-30 14:45:44 +0200 | [diff] [blame] | 324 | # |
| 325 | # For linking with debug library, run like: |
| 326 | # |
| 327 | # make DEBUG=1 LIBUNWIND_DIR=/opt/libunwind/ |
| 328 | # |
Ingo Molnar | 308e1e7 | 2013-10-07 10:30:47 +0200 | [diff] [blame] | 329 | ifdef LIBUNWIND_DIR |
| 330 | LIBUNWIND_CFLAGS := -I$(LIBUNWIND_DIR)/include |
| 331 | LIBUNWIND_LDFLAGS := -L$(LIBUNWIND_DIR)/lib |
| 332 | endif |
Jiri Olsa | 0e433fe | 2013-03-25 00:53:03 +0100 | [diff] [blame] | 333 | |
Ingo Molnar | 058f952 | 2013-09-30 14:45:44 +0200 | [diff] [blame] | 334 | ifneq ($(feature-libunwind), 1) |
Ingo Molnar | 308e1e7 | 2013-10-07 10:30:47 +0200 | [diff] [blame] | 335 | msg := $(warning No libunwind found, disabling post unwind support. Please install libunwind-dev[el] >= 0.99); |
| 336 | NO_LIBUNWIND := 1 |
| 337 | endif |
| 338 | endif |
Jiri Olsa | 0e433fe | 2013-03-25 00:53:03 +0100 | [diff] [blame] | 339 | |
| 340 | ifndef NO_LIBUNWIND |
Ingo Molnar | 89fe808 | 2013-09-30 12:07:11 +0200 | [diff] [blame] | 341 | CFLAGS += -DHAVE_LIBUNWIND_SUPPORT |
Jiri Olsa | 8e1b3f6 | 2013-04-15 04:06:58 +0200 | [diff] [blame] | 342 | EXTLIBS += $(LIBUNWIND_LIBS) |
| 343 | CFLAGS += $(LIBUNWIND_CFLAGS) |
| 344 | LDFLAGS += $(LIBUNWIND_LDFLAGS) |
Ingo Molnar | 058f952 | 2013-09-30 14:45:44 +0200 | [diff] [blame] | 345 | endif |
Jiri Olsa | a827952 | 2013-03-25 00:54:36 +0100 | [diff] [blame] | 346 | |
| 347 | ifndef NO_LIBAUDIT |
Ingo Molnar | d795a65 | 2013-09-30 14:55:31 +0200 | [diff] [blame] | 348 | ifneq ($(feature-libaudit), 1) |
Jiri Olsa | 8e1b3f6 | 2013-04-15 04:06:58 +0200 | [diff] [blame] | 349 | msg := $(warning No libaudit.h found, disables 'trace' tool, please install audit-libs-devel or libaudit-dev); |
| 350 | NO_LIBAUDIT := 1 |
| 351 | else |
Ingo Molnar | 89fe808 | 2013-09-30 12:07:11 +0200 | [diff] [blame] | 352 | CFLAGS += -DHAVE_LIBAUDIT_SUPPORT |
Jiri Olsa | 8e1b3f6 | 2013-04-15 04:06:58 +0200 | [diff] [blame] | 353 | EXTLIBS += -laudit |
| 354 | endif |
Jiri Olsa | a827952 | 2013-03-25 00:54:36 +0100 | [diff] [blame] | 355 | endif |
Jiri Olsa | 4a8f888 | 2013-03-25 00:56:08 +0100 | [diff] [blame] | 356 | |
| 357 | ifdef NO_NEWT |
Jiri Olsa | 8e1b3f6 | 2013-04-15 04:06:58 +0200 | [diff] [blame] | 358 | NO_SLANG=1 |
Jiri Olsa | 4a8f888 | 2013-03-25 00:56:08 +0100 | [diff] [blame] | 359 | endif |
| 360 | |
| 361 | ifndef NO_SLANG |
Ingo Molnar | b9498b5 | 2013-09-30 14:57:54 +0200 | [diff] [blame] | 362 | ifneq ($(feature-libslang), 1) |
Jiri Olsa | 8e1b3f6 | 2013-04-15 04:06:58 +0200 | [diff] [blame] | 363 | msg := $(warning slang not found, disables TUI support. Please install slang-devel or libslang-dev); |
| 364 | NO_SLANG := 1 |
| 365 | else |
| 366 | # Fedora has /usr/include/slang/slang.h, but ubuntu /usr/include/slang.h |
| 367 | CFLAGS += -I/usr/include/slang |
Ingo Molnar | 89fe808 | 2013-09-30 12:07:11 +0200 | [diff] [blame] | 368 | CFLAGS += -DHAVE_SLANG_SUPPORT |
Jiri Olsa | 8e1b3f6 | 2013-04-15 04:06:58 +0200 | [diff] [blame] | 369 | EXTLIBS += -lslang |
| 370 | endif |
Jiri Olsa | 4a8f888 | 2013-03-25 00:56:08 +0100 | [diff] [blame] | 371 | endif |
Jiri Olsa | 58cabf6 | 2013-03-18 00:09:24 +0100 | [diff] [blame] | 372 | |
| 373 | ifndef NO_GTK2 |
Jiri Olsa | 8e1b3f6 | 2013-04-15 04:06:58 +0200 | [diff] [blame] | 374 | 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] | 375 | ifneq ($(feature-gtk2), 1) |
Jiri Olsa | 8e1b3f6 | 2013-04-15 04:06:58 +0200 | [diff] [blame] | 376 | msg := $(warning GTK2 not found, disables GTK2 support. Please install gtk2-devel or libgtk2.0-dev); |
| 377 | NO_GTK2 := 1 |
| 378 | else |
Ingo Molnar | c7a79e9 | 2013-09-30 15:08:30 +0200 | [diff] [blame] | 379 | ifeq ($(feature-gtk2-infobar), 1) |
Namhyung Kim | fc67297 | 2013-09-13 15:27:43 +0900 | [diff] [blame] | 380 | GTK_CFLAGS := -DHAVE_GTK_INFO_BAR_SUPPORT |
Jiri Olsa | 8e1b3f6 | 2013-04-15 04:06:58 +0200 | [diff] [blame] | 381 | endif |
Ingo Molnar | 89fe808 | 2013-09-30 12:07:11 +0200 | [diff] [blame] | 382 | CFLAGS += -DHAVE_GTK2_SUPPORT |
Namhyung Kim | fc67297 | 2013-09-13 15:27:43 +0900 | [diff] [blame] | 383 | GTK_CFLAGS += $(shell pkg-config --cflags gtk+-2.0 2>/dev/null) |
| 384 | GTK_LIBS := $(shell pkg-config --libs gtk+-2.0 2>/dev/null) |
Jiri Olsa | e213708 | 2013-09-26 20:55:54 +0200 | [diff] [blame^] | 385 | EXTLIBS += -ldl |
Jiri Olsa | 8e1b3f6 | 2013-04-15 04:06:58 +0200 | [diff] [blame] | 386 | endif |
Jiri Olsa | 58cabf6 | 2013-03-18 00:09:24 +0100 | [diff] [blame] | 387 | endif |
Jiri Olsa | 3082cb3 | 2013-03-18 00:19:44 +0100 | [diff] [blame] | 388 | |
| 389 | grep-libs = $(filter -l%,$(1)) |
| 390 | strip-libs = $(filter-out -l%,$(1)) |
| 391 | |
| 392 | ifdef NO_LIBPERL |
Jiri Olsa | 8e1b3f6 | 2013-04-15 04:06:58 +0200 | [diff] [blame] | 393 | CFLAGS += -DNO_LIBPERL |
Jiri Olsa | 3082cb3 | 2013-03-18 00:19:44 +0100 | [diff] [blame] | 394 | else |
Jiri Olsa | 8e1b3f6 | 2013-04-15 04:06:58 +0200 | [diff] [blame] | 395 | PERL_EMBED_LDOPTS = $(shell perl -MExtUtils::Embed -e ldopts 2>/dev/null) |
| 396 | PERL_EMBED_LDFLAGS = $(call strip-libs,$(PERL_EMBED_LDOPTS)) |
| 397 | PERL_EMBED_LIBADD = $(call grep-libs,$(PERL_EMBED_LDOPTS)) |
| 398 | PERL_EMBED_CCOPTS = `perl -MExtUtils::Embed -e ccopts 2>/dev/null` |
| 399 | FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS) |
Jiri Olsa | 3082cb3 | 2013-03-18 00:19:44 +0100 | [diff] [blame] | 400 | |
Ingo Molnar | 7181a67 | 2013-09-30 15:15:36 +0200 | [diff] [blame] | 401 | ifneq ($(feature-libperl), 1) |
Jiri Olsa | 8e1b3f6 | 2013-04-15 04:06:58 +0200 | [diff] [blame] | 402 | CFLAGS += -DNO_LIBPERL |
| 403 | NO_LIBPERL := 1 |
| 404 | else |
| 405 | LDFLAGS += $(PERL_EMBED_LDFLAGS) |
| 406 | EXTLIBS += $(PERL_EMBED_LIBADD) |
| 407 | endif |
Jiri Olsa | 3082cb3 | 2013-03-18 00:19:44 +0100 | [diff] [blame] | 408 | endif |
Jiri Olsa | 6e533cf | 2013-03-18 00:35:32 +0100 | [diff] [blame] | 409 | |
| 410 | disable-python = $(eval $(disable-python_code)) |
| 411 | define disable-python_code |
Jiri Olsa | 9c12cf9 | 2013-03-21 11:30:54 +0100 | [diff] [blame] | 412 | CFLAGS += -DNO_LIBPYTHON |
Jiri Olsa | 6e533cf | 2013-03-18 00:35:32 +0100 | [diff] [blame] | 413 | $(if $(1),$(warning No $(1) was found)) |
| 414 | $(warning Python support will not be built) |
| 415 | NO_LIBPYTHON := 1 |
| 416 | endef |
| 417 | |
| 418 | override PYTHON := \ |
| 419 | $(call get-executable-or-default,PYTHON,python) |
| 420 | |
| 421 | ifndef PYTHON |
| 422 | $(call disable-python,python interpreter) |
| 423 | else |
| 424 | |
| 425 | PYTHON_WORD := $(call shell-wordify,$(PYTHON)) |
| 426 | |
| 427 | ifdef NO_LIBPYTHON |
| 428 | $(call disable-python) |
| 429 | else |
| 430 | |
| 431 | override PYTHON_CONFIG := \ |
| 432 | $(call get-executable-or-default,PYTHON_CONFIG,$(PYTHON)-config) |
| 433 | |
| 434 | ifndef PYTHON_CONFIG |
| 435 | $(call disable-python,python-config tool) |
| 436 | else |
| 437 | |
| 438 | PYTHON_CONFIG_SQ := $(call shell-sq,$(PYTHON_CONFIG)) |
| 439 | |
| 440 | PYTHON_EMBED_LDOPTS := $(shell $(PYTHON_CONFIG_SQ) --ldflags 2>/dev/null) |
| 441 | PYTHON_EMBED_LDFLAGS := $(call strip-libs,$(PYTHON_EMBED_LDOPTS)) |
| 442 | PYTHON_EMBED_LIBADD := $(call grep-libs,$(PYTHON_EMBED_LDOPTS)) |
| 443 | PYTHON_EMBED_CCOPTS := $(shell $(PYTHON_CONFIG_SQ) --cflags 2>/dev/null) |
| 444 | FLAGS_PYTHON_EMBED := $(PYTHON_EMBED_CCOPTS) $(PYTHON_EMBED_LDOPTS) |
| 445 | |
Ingo Molnar | 9734163 | 2013-09-30 15:18:37 +0200 | [diff] [blame] | 446 | ifneq ($(feature-libpython), 1) |
Jiri Olsa | 6e533cf | 2013-03-18 00:35:32 +0100 | [diff] [blame] | 447 | $(call disable-python,Python.h (for Python 2.x)) |
| 448 | else |
| 449 | |
Ingo Molnar | 95d061c | 2013-09-30 15:40:04 +0200 | [diff] [blame] | 450 | ifneq ($(feature-libpython-version), 1) |
Jiri Olsa | 6e533cf | 2013-03-18 00:35:32 +0100 | [diff] [blame] | 451 | $(warning Python 3 is not yet supported; please set) |
| 452 | $(warning PYTHON and/or PYTHON_CONFIG appropriately.) |
| 453 | $(warning If you also have Python 2 installed, then) |
| 454 | $(warning try something like:) |
| 455 | $(warning $(and ,)) |
| 456 | $(warning $(and ,) make PYTHON=python2) |
| 457 | $(warning $(and ,)) |
| 458 | $(warning Otherwise, disable Python support entirely:) |
| 459 | $(warning $(and ,)) |
| 460 | $(warning $(and ,) make NO_LIBPYTHON=1) |
| 461 | $(warning $(and ,)) |
| 462 | $(error $(and ,)) |
| 463 | else |
Jiri Olsa | 1e9f7aa | 2013-03-21 11:41:05 +0100 | [diff] [blame] | 464 | LDFLAGS += $(PYTHON_EMBED_LDFLAGS) |
Jiri Olsa | 6e533cf | 2013-03-18 00:35:32 +0100 | [diff] [blame] | 465 | EXTLIBS += $(PYTHON_EMBED_LIBADD) |
Jiri Olsa | 7c53746 | 2013-05-24 14:35:23 +0200 | [diff] [blame] | 466 | LANG_BINDINGS += $(obj-perf)python/perf.so |
Jiri Olsa | 6e533cf | 2013-03-18 00:35:32 +0100 | [diff] [blame] | 467 | endif |
| 468 | endif |
| 469 | endif |
| 470 | endif |
| 471 | endif |
Jiri Olsa | c3cf836 | 2013-03-18 00:38:16 +0100 | [diff] [blame] | 472 | |
| 473 | ifdef NO_DEMANGLE |
Jiri Olsa | 8e1b3f6 | 2013-04-15 04:06:58 +0200 | [diff] [blame] | 474 | CFLAGS += -DNO_DEMANGLE |
Jiri Olsa | c3cf836 | 2013-03-18 00:38:16 +0100 | [diff] [blame] | 475 | else |
Ingo Molnar | 89fe808 | 2013-09-30 12:07:11 +0200 | [diff] [blame] | 476 | ifdef HAVE_CPLUS_DEMANGLE_SUPPORT |
Jiri Olsa | 8e1b3f6 | 2013-04-15 04:06:58 +0200 | [diff] [blame] | 477 | EXTLIBS += -liberty |
Ingo Molnar | 89fe808 | 2013-09-30 12:07:11 +0200 | [diff] [blame] | 478 | CFLAGS += -DHAVE_CPLUS_DEMANGLE_SUPPORT |
Jiri Olsa | 8e1b3f6 | 2013-04-15 04:06:58 +0200 | [diff] [blame] | 479 | else |
Ingo Molnar | 3b7646e | 2013-09-30 15:53:31 +0200 | [diff] [blame] | 480 | ifeq ($(feature-libbfd), 1) |
Jiri Olsa | 8e1b3f6 | 2013-04-15 04:06:58 +0200 | [diff] [blame] | 481 | EXTLIBS += -lbfd |
| 482 | else |
Ingo Molnar | 1c47661 | 2013-10-02 15:15:09 +0200 | [diff] [blame] | 483 | $(feature_check,liberty) |
| 484 | ifeq ($(feature-liberty), 1) |
Jiri Olsa | 8e1b3f6 | 2013-04-15 04:06:58 +0200 | [diff] [blame] | 485 | EXTLIBS += -lbfd -liberty |
| 486 | else |
Ingo Molnar | 1c47661 | 2013-10-02 15:15:09 +0200 | [diff] [blame] | 487 | $(feature_check,liberty-z) |
| 488 | ifeq ($(feature-liberty-z), 1) |
Jiri Olsa | 8e1b3f6 | 2013-04-15 04:06:58 +0200 | [diff] [blame] | 489 | EXTLIBS += -lbfd -liberty -lz |
| 490 | else |
Ingo Molnar | 1c47661 | 2013-10-02 15:15:09 +0200 | [diff] [blame] | 491 | $(feature_check,cplus-demangle) |
| 492 | ifeq ($(feature-cplus-demangle), 1) |
Jiri Olsa | 8e1b3f6 | 2013-04-15 04:06:58 +0200 | [diff] [blame] | 493 | EXTLIBS += -liberty |
Ingo Molnar | 89fe808 | 2013-09-30 12:07:11 +0200 | [diff] [blame] | 494 | CFLAGS += -DHAVE_CPLUS_DEMANGLE_SUPPORT |
Jiri Olsa | 8e1b3f6 | 2013-04-15 04:06:58 +0200 | [diff] [blame] | 495 | else |
| 496 | msg := $(warning No bfd.h/libbfd found, install binutils-dev[el]/zlib-static to gain symbol demangling) |
| 497 | CFLAGS += -DNO_DEMANGLE |
| 498 | endif |
| 499 | endif |
| 500 | endif |
| 501 | endif |
| 502 | endif |
Jiri Olsa | c3cf836 | 2013-03-18 00:38:16 +0100 | [diff] [blame] | 503 | endif |
Jiri Olsa | a1c7c9e | 2013-03-18 00:41:04 +0100 | [diff] [blame] | 504 | |
Jiri Olsa | a1c7c9e | 2013-03-18 00:41:04 +0100 | [diff] [blame] | 505 | ifndef NO_ON_EXIT |
Ingo Molnar | 34ef216 | 2013-09-30 16:46:49 +0200 | [diff] [blame] | 506 | ifeq ($(feature-on-exit), 1) |
Ingo Molnar | 89fe808 | 2013-09-30 12:07:11 +0200 | [diff] [blame] | 507 | CFLAGS += -DHAVE_ON_EXIT_SUPPORT |
Jiri Olsa | 8e1b3f6 | 2013-04-15 04:06:58 +0200 | [diff] [blame] | 508 | endif |
Jiri Olsa | a1c7c9e | 2013-03-18 00:41:04 +0100 | [diff] [blame] | 509 | endif |
| 510 | |
| 511 | ifndef NO_BACKTRACE |
Ingo Molnar | 4cc9117 | 2013-09-30 16:49:38 +0200 | [diff] [blame] | 512 | ifeq ($(feature-backtrace), 1) |
Ingo Molnar | 89fe808 | 2013-09-30 12:07:11 +0200 | [diff] [blame] | 513 | CFLAGS += -DHAVE_BACKTRACE_SUPPORT |
Jiri Olsa | 8e1b3f6 | 2013-04-15 04:06:58 +0200 | [diff] [blame] | 514 | endif |
Jiri Olsa | a1c7c9e | 2013-03-18 00:41:04 +0100 | [diff] [blame] | 515 | endif |
Jiri Olsa | 58a0abd | 2013-03-18 00:45:27 +0100 | [diff] [blame] | 516 | |
| 517 | ifndef NO_LIBNUMA |
Ingo Molnar | 3ae069c | 2013-09-30 13:37:10 +0200 | [diff] [blame] | 518 | ifeq ($(feature-libnuma), 0) |
Jiri Olsa | 8e1b3f6 | 2013-04-15 04:06:58 +0200 | [diff] [blame] | 519 | msg := $(warning No numa.h found, disables 'perf bench numa mem' benchmark, please install numa-libs-devel or libnuma-dev); |
| 520 | NO_LIBNUMA := 1 |
| 521 | else |
Ingo Molnar | 89fe808 | 2013-09-30 12:07:11 +0200 | [diff] [blame] | 522 | CFLAGS += -DHAVE_LIBNUMA_SUPPORT |
Jiri Olsa | 8e1b3f6 | 2013-04-15 04:06:58 +0200 | [diff] [blame] | 523 | EXTLIBS += -lnuma |
| 524 | endif |
Jiri Olsa | 58a0abd | 2013-03-18 00:45:27 +0100 | [diff] [blame] | 525 | endif |
Jiri Olsa | cd1c39f | 2013-03-18 00:56:01 +0100 | [diff] [blame] | 526 | |
Roberto Vitillo | 2f48fcd | 2013-09-11 14:09:32 +0900 | [diff] [blame] | 527 | ifndef ($(filter -lbfd,$(EXTLIBS)),) |
| 528 | CFLAGS += -DHAVE_LIBBFD_SUPPORT |
| 529 | endif |
| 530 | |
Jiri Olsa | cd1c39f | 2013-03-18 00:56:01 +0100 | [diff] [blame] | 531 | # Among the variables below, these: |
| 532 | # perfexecdir |
| 533 | # template_dir |
| 534 | # mandir |
| 535 | # infodir |
| 536 | # htmldir |
| 537 | # ETC_PERFCONFIG (but not sysconfdir) |
| 538 | # can be specified as a relative path some/where/else; |
| 539 | # this is interpreted as relative to $(prefix) and "perf" at |
| 540 | # runtime figures out where they are based on the path to the executable. |
| 541 | # This can help installing the suite in a relocatable way. |
| 542 | |
| 543 | # Make the path relative to DESTDIR, not to prefix |
| 544 | ifndef DESTDIR |
| 545 | prefix = $(HOME) |
| 546 | endif |
| 547 | bindir_relative = bin |
| 548 | bindir = $(prefix)/$(bindir_relative) |
| 549 | mandir = share/man |
| 550 | infodir = share/info |
| 551 | perfexecdir = libexec/perf-core |
| 552 | sharedir = $(prefix)/share |
| 553 | template_dir = share/perf-core/templates |
| 554 | htmldir = share/doc/perf-doc |
| 555 | ifeq ($(prefix),/usr) |
| 556 | sysconfdir = /etc |
| 557 | ETC_PERFCONFIG = $(sysconfdir)/perfconfig |
| 558 | else |
| 559 | sysconfdir = $(prefix)/etc |
| 560 | ETC_PERFCONFIG = etc/perfconfig |
| 561 | endif |
Namhyung Kim | fc67297 | 2013-09-13 15:27:43 +0900 | [diff] [blame] | 562 | ifeq ($(IS_X86_64),1) |
| 563 | lib = lib64 |
| 564 | else |
Jiri Olsa | cd1c39f | 2013-03-18 00:56:01 +0100 | [diff] [blame] | 565 | lib = lib |
Namhyung Kim | fc67297 | 2013-09-13 15:27:43 +0900 | [diff] [blame] | 566 | endif |
| 567 | libdir = $(prefix)/$(lib) |
Jiri Olsa | cd1c39f | 2013-03-18 00:56:01 +0100 | [diff] [blame] | 568 | |
| 569 | # Shell quote (do not use $(call) to accommodate ancient setups); |
| 570 | ETC_PERFCONFIG_SQ = $(subst ','\'',$(ETC_PERFCONFIG)) |
| 571 | DESTDIR_SQ = $(subst ','\'',$(DESTDIR)) |
| 572 | bindir_SQ = $(subst ','\'',$(bindir)) |
| 573 | mandir_SQ = $(subst ','\'',$(mandir)) |
| 574 | infodir_SQ = $(subst ','\'',$(infodir)) |
| 575 | perfexecdir_SQ = $(subst ','\'',$(perfexecdir)) |
| 576 | template_dir_SQ = $(subst ','\'',$(template_dir)) |
| 577 | htmldir_SQ = $(subst ','\'',$(htmldir)) |
| 578 | prefix_SQ = $(subst ','\'',$(prefix)) |
| 579 | sysconfdir_SQ = $(subst ','\'',$(sysconfdir)) |
Namhyung Kim | fc67297 | 2013-09-13 15:27:43 +0900 | [diff] [blame] | 580 | libdir_SQ = $(subst ','\'',$(libdir)) |
Jiri Olsa | cd1c39f | 2013-03-18 00:56:01 +0100 | [diff] [blame] | 581 | |
| 582 | ifneq ($(filter /%,$(firstword $(perfexecdir))),) |
| 583 | perfexec_instdir = $(perfexecdir) |
| 584 | else |
| 585 | perfexec_instdir = $(prefix)/$(perfexecdir) |
| 586 | endif |
| 587 | perfexec_instdir_SQ = $(subst ','\'',$(perfexec_instdir)) |