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