Commit | Line | Data |
---|---|---|
8bd407b9 JO |
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/ \ | |
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/ ) | |
8 | NO_PERF_REGS := 1 | |
9 | ||
10 | # Additional ARCH settings for x86 | |
11 | ifeq ($(ARCH),i386) | |
12 | override ARCH := x86 | |
13 | NO_PERF_REGS := 0 | |
14 | LIBUNWIND_LIBS = -lunwind -lunwind-x86 | |
15 | endif | |
16 | ||
17 | ifeq ($(ARCH),x86_64) | |
18 | override ARCH := x86 | |
19 | IS_X86_64 := 0 | |
20 | ifeq (, $(findstring m32,$(EXTRA_CFLAGS))) | |
21 | IS_X86_64 := $(shell echo __x86_64__ | ${CC} -E -x c - | tail -n 1) | |
22 | endif | |
23 | ifeq (${IS_X86_64}, 1) | |
24 | RAW_ARCH := x86_64 | |
25 | ARCH_CFLAGS := -DARCH_X86_64 | |
26 | ARCH_INCLUDE = ../../arch/x86/lib/memcpy_64.S ../../arch/x86/lib/memset_64.S | |
27 | endif | |
28 | NO_PERF_REGS := 0 | |
29 | LIBUNWIND_LIBS = -lunwind -lunwind-x86_64 | |
30 | endif | |
31 | ||
32 | ifeq ($(NO_PERF_REGS),0) | |
33 | BASIC_CFLAGS += -DHAVE_PERF_REGS | |
34 | endif | |
a32f4936 JO |
35 | |
36 | -include config/feature-tests.mak | |
37 | ||
38 | ifeq ($(call get-executable,$(FLEX)),) | |
39 | dummy := $(error Error: $(FLEX) is missing on this system, please install it) | |
40 | endif | |
41 | ||
42 | ifeq ($(call get-executable,$(BISON)),) | |
43 | dummy := $(error Error: $(BISON) is missing on this system, please install it) | |
44 | endif | |
362493f0 JO |
45 | |
46 | # Treat warnings as errors unless directed not to | |
47 | ifneq ($(WERROR),0) | |
48 | CFLAGS_WERROR := -Werror | |
49 | endif | |
50 | ||
51 | ifeq ("$(origin DEBUG)", "command line") | |
52 | PERF_DEBUG = $(DEBUG) | |
53 | endif | |
54 | ifndef PERF_DEBUG | |
55 | CFLAGS_OPTIMIZE = -O6 | |
56 | endif | |
57 | ||
58 | ifdef PARSER_DEBUG | |
59 | PARSER_DEBUG_BISON := -t | |
60 | PARSER_DEBUG_FLEX := -d | |
61 | PARSER_DEBUG_CFLAGS := -DPARSER_DEBUG | |
62 | endif | |
63 | ||
64 | CFLAGS = -fno-omit-frame-pointer -ggdb3 -funwind-tables -Wall -Wextra -std=gnu99 $(CFLAGS_WERROR) $(CFLAGS_OPTIMIZE) $(EXTRA_WARNINGS) $(EXTRA_CFLAGS) $(PARSER_DEBUG_CFLAGS) | |
65 | EXTLIBS = -lpthread -lrt -lelf -lm | |
66 | ALL_CFLAGS = $(CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE | |
67 | ALL_LDFLAGS = $(LDFLAGS) | |
68 | ||
69 | ifeq ($(call try-cc,$(SOURCE_HELLO),$(CFLAGS) -Werror -fstack-protector-all,-fstack-protector-all),y) | |
70 | CFLAGS := $(CFLAGS) -fstack-protector-all | |
71 | endif | |
72 | ||
73 | ifeq ($(call try-cc,$(SOURCE_HELLO),$(CFLAGS) -Werror -Wstack-protector,-Wstack-protector),y) | |
74 | CFLAGS := $(CFLAGS) -Wstack-protector | |
75 | endif | |
76 | ||
77 | ifeq ($(call try-cc,$(SOURCE_HELLO),$(CFLAGS) -Werror -Wvolatile-register-var,-Wvolatile-register-var),y) | |
78 | CFLAGS := $(CFLAGS) -Wvolatile-register-var | |
79 | endif | |
80 | ||
81 | ifndef PERF_DEBUG | |
82 | ifeq ($(call try-cc,$(SOURCE_HELLO),$(CFLAGS) -D_FORTIFY_SOURCE=2,-D_FORTIFY_SOURCE=2),y) | |
83 | CFLAGS := $(CFLAGS) -D_FORTIFY_SOURCE=2 | |
84 | endif | |
85 | endif | |
86 | ||
87 | BASIC_CFLAGS += \ | |
88 | -Iutil/include \ | |
89 | -Iarch/$(ARCH)/include \ | |
90 | $(if $(objtree),-I$(objtree)/arch/$(ARCH)/include/generated/uapi) \ | |
91 | -I$(srctree)/arch/$(ARCH)/include/uapi \ | |
92 | -I$(srctree)/arch/$(ARCH)/include \ | |
93 | $(if $(objtree),-I$(objtree)/include/generated/uapi) \ | |
94 | -I$(srctree)/include/uapi \ | |
95 | -I$(srctree)/include \ | |
96 | -I$(OUTPUT)util \ | |
97 | -Iutil \ | |
98 | -I. \ | |
99 | -I$(TRACE_EVENT_DIR) \ | |
100 | -I../lib/ \ | |
101 | -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE | |
102 | ||
103 | BASIC_LDFLAGS = | |
104 | ||
105 | ifeq ($(call try-cc,$(SOURCE_BIONIC),$(CFLAGS),bionic),y) | |
106 | BIONIC := 1 | |
107 | EXTLIBS := $(filter-out -lrt,$(EXTLIBS)) | |
108 | EXTLIBS := $(filter-out -lpthread,$(EXTLIBS)) | |
109 | BASIC_CFLAGS += -I. | |
110 | endif | |
cf4cca10 JO |
111 | |
112 | ifdef NO_LIBELF | |
113 | NO_DWARF := 1 | |
114 | NO_DEMANGLE := 1 | |
115 | NO_LIBUNWIND := 1 | |
116 | else | |
117 | FLAGS_LIBELF=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) | |
118 | ifneq ($(call try-cc,$(SOURCE_LIBELF),$(FLAGS_LIBELF),libelf),y) | |
119 | FLAGS_GLIBC=$(ALL_CFLAGS) $(ALL_LDFLAGS) | |
120 | ifeq ($(call try-cc,$(SOURCE_GLIBC),$(FLAGS_GLIBC),glibc),y) | |
121 | LIBC_SUPPORT := 1 | |
122 | endif | |
123 | ifeq ($(BIONIC),1) | |
124 | LIBC_SUPPORT := 1 | |
125 | endif | |
126 | ifeq ($(LIBC_SUPPORT),1) | |
127 | msg := $(warning No libelf found, disables 'probe' tool, please install elfutils-libelf-devel/libelf-dev); | |
128 | ||
129 | NO_LIBELF := 1 | |
130 | NO_DWARF := 1 | |
131 | NO_DEMANGLE := 1 | |
132 | else | |
133 | msg := $(error No gnu/libc-version.h found, please install glibc-dev[el]/glibc-static); | |
134 | endif | |
135 | else | |
136 | # for linking with debug library, run like: | |
137 | # make DEBUG=1 LIBDW_DIR=/opt/libdw/ | |
138 | ifdef LIBDW_DIR | |
139 | LIBDW_CFLAGS := -I$(LIBDW_DIR)/include | |
140 | LIBDW_LDFLAGS := -L$(LIBDW_DIR)/lib | |
141 | endif | |
142 | ||
143 | FLAGS_DWARF=$(ALL_CFLAGS) $(LIBDW_CFLAGS) -ldw -lelf $(LIBDW_LDFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) | |
144 | ifneq ($(call try-cc,$(SOURCE_DWARF),$(FLAGS_DWARF),libdw),y) | |
145 | 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); | |
146 | NO_DWARF := 1 | |
147 | endif # Dwarf support | |
148 | endif # SOURCE_LIBELF | |
149 | endif # NO_LIBELF | |
150 | ||
151 | ifndef NO_LIBELF | |
152 | BASIC_CFLAGS += -DLIBELF_SUPPORT | |
153 | FLAGS_LIBELF=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) | |
154 | ifeq ($(call try-cc,$(SOURCE_ELF_MMAP),$(FLAGS_LIBELF),-DLIBELF_MMAP),y) | |
155 | BASIC_CFLAGS += -DLIBELF_MMAP | |
156 | endif | |
779724fd JO |
157 | |
158 | # include ARCH specific config | |
159 | -include arch/$(ARCH)/Makefile | |
160 | ||
161 | ifndef NO_DWARF | |
162 | ifeq ($(origin PERF_HAVE_DWARF_REGS), undefined) | |
163 | msg := $(warning DWARF register mappings have not been defined for architecture $(ARCH), DWARF support disabled); | |
164 | NO_DWARF := 1 | |
165 | else | |
166 | BASIC_CFLAGS := -DDWARF_SUPPORT $(LIBDW_CFLAGS) $(BASIC_CFLAGS) | |
167 | BASIC_LDFLAGS := $(LIBDW_LDFLAGS) $(BASIC_LDFLAGS) | |
168 | EXTLIBS += -lelf -ldw | |
169 | endif # PERF_HAVE_DWARF_REGS | |
170 | endif # NO_DWARF | |
171 | ||
cf4cca10 | 172 | endif # NO_LIBELF |
0e433feb JO |
173 | |
174 | # There's only x86 (both 32 and 64) support for CFI unwind so far | |
175 | ifneq ($(ARCH),x86) | |
176 | NO_LIBUNWIND := 1 | |
177 | endif | |
178 | ||
179 | ifndef NO_LIBUNWIND | |
180 | # for linking with debug library, run like: | |
181 | # make DEBUG=1 LIBUNWIND_DIR=/opt/libunwind/ | |
182 | ifdef LIBUNWIND_DIR | |
183 | LIBUNWIND_CFLAGS := -I$(LIBUNWIND_DIR)/include | |
184 | LIBUNWIND_LDFLAGS := -L$(LIBUNWIND_DIR)/lib | |
185 | endif | |
186 | ||
187 | FLAGS_UNWIND=$(LIBUNWIND_CFLAGS) $(ALL_CFLAGS) $(LIBUNWIND_LDFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) $(LIBUNWIND_LIBS) | |
188 | ifneq ($(call try-cc,$(SOURCE_LIBUNWIND),$(FLAGS_UNWIND),libunwind),y) | |
189 | msg := $(warning No libunwind found, disabling post unwind support. Please install libunwind-dev[el] >= 0.99); | |
190 | NO_LIBUNWIND := 1 | |
191 | endif # Libunwind support | |
192 | endif # NO_LIBUNWIND | |
193 | ||
194 | ifndef NO_LIBUNWIND | |
195 | BASIC_CFLAGS += -DLIBUNWIND_SUPPORT | |
196 | EXTLIBS += $(LIBUNWIND_LIBS) | |
197 | BASIC_CFLAGS := $(LIBUNWIND_CFLAGS) $(BASIC_CFLAGS) | |
198 | BASIC_LDFLAGS := $(LIBUNWIND_LDFLAGS) $(BASIC_LDFLAGS) | |
199 | endif # NO_LIBUNWIND | |
a8279525 JO |
200 | |
201 | ifndef NO_LIBAUDIT | |
202 | FLAGS_LIBAUDIT = $(ALL_CFLAGS) $(ALL_LDFLAGS) -laudit | |
203 | ifneq ($(call try-cc,$(SOURCE_LIBAUDIT),$(FLAGS_LIBAUDIT),libaudit),y) | |
204 | msg := $(warning No libaudit.h found, disables 'trace' tool, please install audit-libs-devel or libaudit-dev); | |
205 | NO_LIBAUDIT := 1 | |
206 | else | |
207 | BASIC_CFLAGS += -DLIBAUDIT_SUPPORT | |
208 | EXTLIBS += -laudit | |
209 | endif | |
210 | endif | |
4a8f888a JO |
211 | |
212 | ifdef NO_NEWT | |
213 | NO_SLANG=1 | |
214 | endif | |
215 | ||
216 | ifndef NO_SLANG | |
217 | FLAGS_SLANG=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) -I/usr/include/slang -lslang | |
218 | ifneq ($(call try-cc,$(SOURCE_SLANG),$(FLAGS_SLANG),libslang),y) | |
219 | msg := $(warning slang not found, disables TUI support. Please install slang-devel or libslang-dev); | |
220 | NO_SLANG := 1 | |
221 | else | |
222 | # Fedora has /usr/include/slang/slang.h, but ubuntu /usr/include/slang.h | |
223 | BASIC_CFLAGS += -I/usr/include/slang | |
224 | BASIC_CFLAGS += -DSLANG_SUPPORT | |
225 | EXTLIBS += -lslang | |
226 | endif | |
227 | endif | |
58cabf6a JO |
228 | |
229 | ifndef NO_GTK2 | |
230 | FLAGS_GTK2=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) $(shell pkg-config --libs --cflags gtk+-2.0 2>/dev/null) | |
231 | ifneq ($(call try-cc,$(SOURCE_GTK2),$(FLAGS_GTK2),gtk2),y) | |
232 | msg := $(warning GTK2 not found, disables GTK2 support. Please install gtk2-devel or libgtk2.0-dev); | |
233 | NO_GTK2 := 1 | |
234 | else | |
235 | ifeq ($(call try-cc,$(SOURCE_GTK2_INFOBAR),$(FLAGS_GTK2),-DHAVE_GTK_INFO_BAR),y) | |
236 | BASIC_CFLAGS += -DHAVE_GTK_INFO_BAR | |
237 | endif | |
238 | BASIC_CFLAGS += -DGTK2_SUPPORT | |
239 | BASIC_CFLAGS += $(shell pkg-config --cflags gtk+-2.0 2>/dev/null) | |
240 | EXTLIBS += $(shell pkg-config --libs gtk+-2.0 2>/dev/null) | |
241 | endif | |
242 | endif | |
3082cb33 JO |
243 | |
244 | grep-libs = $(filter -l%,$(1)) | |
245 | strip-libs = $(filter-out -l%,$(1)) | |
246 | ||
247 | ifdef NO_LIBPERL | |
248 | BASIC_CFLAGS += -DNO_LIBPERL | |
249 | else | |
250 | PERL_EMBED_LDOPTS = $(shell perl -MExtUtils::Embed -e ldopts 2>/dev/null) | |
251 | PERL_EMBED_LDFLAGS = $(call strip-libs,$(PERL_EMBED_LDOPTS)) | |
252 | PERL_EMBED_LIBADD = $(call grep-libs,$(PERL_EMBED_LDOPTS)) | |
253 | PERL_EMBED_CCOPTS = `perl -MExtUtils::Embed -e ccopts 2>/dev/null` | |
254 | FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS) | |
255 | ||
256 | ifneq ($(call try-cc,$(SOURCE_PERL_EMBED),$(FLAGS_PERL_EMBED),perl),y) | |
257 | BASIC_CFLAGS += -DNO_LIBPERL | |
258 | NO_LIBPERL := 1 | |
259 | else | |
260 | ALL_LDFLAGS += $(PERL_EMBED_LDFLAGS) | |
261 | EXTLIBS += $(PERL_EMBED_LIBADD) | |
262 | endif | |
263 | endif | |
6e533cf1 JO |
264 | |
265 | disable-python = $(eval $(disable-python_code)) | |
266 | define disable-python_code | |
267 | BASIC_CFLAGS += -DNO_LIBPYTHON | |
268 | $(if $(1),$(warning No $(1) was found)) | |
269 | $(warning Python support will not be built) | |
270 | NO_LIBPYTHON := 1 | |
271 | endef | |
272 | ||
273 | override PYTHON := \ | |
274 | $(call get-executable-or-default,PYTHON,python) | |
275 | ||
276 | ifndef PYTHON | |
277 | $(call disable-python,python interpreter) | |
278 | else | |
279 | ||
280 | PYTHON_WORD := $(call shell-wordify,$(PYTHON)) | |
281 | ||
282 | ifdef NO_LIBPYTHON | |
283 | $(call disable-python) | |
284 | else | |
285 | ||
286 | override PYTHON_CONFIG := \ | |
287 | $(call get-executable-or-default,PYTHON_CONFIG,$(PYTHON)-config) | |
288 | ||
289 | ifndef PYTHON_CONFIG | |
290 | $(call disable-python,python-config tool) | |
291 | else | |
292 | ||
293 | PYTHON_CONFIG_SQ := $(call shell-sq,$(PYTHON_CONFIG)) | |
294 | ||
295 | PYTHON_EMBED_LDOPTS := $(shell $(PYTHON_CONFIG_SQ) --ldflags 2>/dev/null) | |
296 | PYTHON_EMBED_LDFLAGS := $(call strip-libs,$(PYTHON_EMBED_LDOPTS)) | |
297 | PYTHON_EMBED_LIBADD := $(call grep-libs,$(PYTHON_EMBED_LDOPTS)) | |
298 | PYTHON_EMBED_CCOPTS := $(shell $(PYTHON_CONFIG_SQ) --cflags 2>/dev/null) | |
299 | FLAGS_PYTHON_EMBED := $(PYTHON_EMBED_CCOPTS) $(PYTHON_EMBED_LDOPTS) | |
300 | ||
301 | ifneq ($(call try-cc,$(SOURCE_PYTHON_EMBED),$(FLAGS_PYTHON_EMBED),python),y) | |
302 | $(call disable-python,Python.h (for Python 2.x)) | |
303 | else | |
304 | ||
305 | ifneq ($(call try-cc,$(SOURCE_PYTHON_VERSION),$(FLAGS_PYTHON_EMBED),python version),y) | |
306 | $(warning Python 3 is not yet supported; please set) | |
307 | $(warning PYTHON and/or PYTHON_CONFIG appropriately.) | |
308 | $(warning If you also have Python 2 installed, then) | |
309 | $(warning try something like:) | |
310 | $(warning $(and ,)) | |
311 | $(warning $(and ,) make PYTHON=python2) | |
312 | $(warning $(and ,)) | |
313 | $(warning Otherwise, disable Python support entirely:) | |
314 | $(warning $(and ,)) | |
315 | $(warning $(and ,) make NO_LIBPYTHON=1) | |
316 | $(warning $(and ,)) | |
317 | $(error $(and ,)) | |
318 | else | |
319 | ALL_LDFLAGS += $(PYTHON_EMBED_LDFLAGS) | |
320 | EXTLIBS += $(PYTHON_EMBED_LIBADD) | |
321 | LANG_BINDINGS += $(OUTPUT)python/perf.so | |
322 | endif | |
323 | endif | |
324 | endif | |
325 | endif | |
326 | endif | |
c3cf8368 JO |
327 | |
328 | ifdef NO_DEMANGLE | |
329 | BASIC_CFLAGS += -DNO_DEMANGLE | |
330 | else | |
331 | ifdef HAVE_CPLUS_DEMANGLE | |
332 | EXTLIBS += -liberty | |
333 | BASIC_CFLAGS += -DHAVE_CPLUS_DEMANGLE | |
334 | else | |
335 | FLAGS_BFD=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) -DPACKAGE='perf' -lbfd | |
336 | has_bfd := $(call try-cc,$(SOURCE_BFD),$(FLAGS_BFD),libbfd) | |
337 | ifeq ($(has_bfd),y) | |
338 | EXTLIBS += -lbfd | |
339 | else | |
340 | FLAGS_BFD_IBERTY=$(FLAGS_BFD) -liberty | |
341 | has_bfd_iberty := $(call try-cc,$(SOURCE_BFD),$(FLAGS_BFD_IBERTY),liberty) | |
342 | ifeq ($(has_bfd_iberty),y) | |
343 | EXTLIBS += -lbfd -liberty | |
344 | else | |
345 | FLAGS_BFD_IBERTY_Z=$(FLAGS_BFD_IBERTY) -lz | |
346 | has_bfd_iberty_z := $(call try-cc,$(SOURCE_BFD),$(FLAGS_BFD_IBERTY_Z),libz) | |
347 | ifeq ($(has_bfd_iberty_z),y) | |
348 | EXTLIBS += -lbfd -liberty -lz | |
349 | else | |
350 | FLAGS_CPLUS_DEMANGLE=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) -liberty | |
351 | has_cplus_demangle := $(call try-cc,$(SOURCE_CPLUS_DEMANGLE),$(FLAGS_CPLUS_DEMANGLE),demangle) | |
352 | ifeq ($(has_cplus_demangle),y) | |
353 | EXTLIBS += -liberty | |
354 | BASIC_CFLAGS += -DHAVE_CPLUS_DEMANGLE | |
355 | else | |
356 | msg := $(warning No bfd.h/libbfd found, install binutils-dev[el]/zlib-static to gain symbol demangling) | |
357 | BASIC_CFLAGS += -DNO_DEMANGLE | |
358 | endif | |
359 | endif | |
360 | endif | |
361 | endif | |
362 | endif | |
363 | endif | |
a1c7c9e7 JO |
364 | |
365 | ifndef NO_STRLCPY | |
366 | ifeq ($(call try-cc,$(SOURCE_STRLCPY),,-DHAVE_STRLCPY),y) | |
367 | BASIC_CFLAGS += -DHAVE_STRLCPY | |
368 | endif | |
369 | endif | |
370 | ||
371 | ifndef NO_ON_EXIT | |
372 | ifeq ($(call try-cc,$(SOURCE_ON_EXIT),,-DHAVE_ON_EXIT),y) | |
373 | BASIC_CFLAGS += -DHAVE_ON_EXIT | |
374 | endif | |
375 | endif | |
376 | ||
377 | ifndef NO_BACKTRACE | |
378 | ifeq ($(call try-cc,$(SOURCE_BACKTRACE),,-DBACKTRACE_SUPPORT),y) | |
379 | BASIC_CFLAGS += -DBACKTRACE_SUPPORT | |
380 | endif | |
381 | endif | |
58a0abd7 JO |
382 | |
383 | ifndef NO_LIBNUMA | |
384 | FLAGS_LIBNUMA = $(ALL_CFLAGS) $(ALL_LDFLAGS) -lnuma | |
385 | ifneq ($(call try-cc,$(SOURCE_LIBNUMA),$(FLAGS_LIBNUMA),libnuma),y) | |
386 | msg := $(warning No numa.h found, disables 'perf bench numa mem' benchmark, please install numa-libs-devel or libnuma-dev); | |
387 | NO_LIBNUMA := 1 | |
388 | else | |
389 | BASIC_CFLAGS += -DLIBNUMA_SUPPORT | |
390 | EXTLIBS += -lnuma | |
391 | endif | |
392 | endif | |
cd1c39f2 JO |
393 | |
394 | # Among the variables below, these: | |
395 | # perfexecdir | |
396 | # template_dir | |
397 | # mandir | |
398 | # infodir | |
399 | # htmldir | |
400 | # ETC_PERFCONFIG (but not sysconfdir) | |
401 | # can be specified as a relative path some/where/else; | |
402 | # this is interpreted as relative to $(prefix) and "perf" at | |
403 | # runtime figures out where they are based on the path to the executable. | |
404 | # This can help installing the suite in a relocatable way. | |
405 | ||
406 | # Make the path relative to DESTDIR, not to prefix | |
407 | ifndef DESTDIR | |
408 | prefix = $(HOME) | |
409 | endif | |
410 | bindir_relative = bin | |
411 | bindir = $(prefix)/$(bindir_relative) | |
412 | mandir = share/man | |
413 | infodir = share/info | |
414 | perfexecdir = libexec/perf-core | |
415 | sharedir = $(prefix)/share | |
416 | template_dir = share/perf-core/templates | |
417 | htmldir = share/doc/perf-doc | |
418 | ifeq ($(prefix),/usr) | |
419 | sysconfdir = /etc | |
420 | ETC_PERFCONFIG = $(sysconfdir)/perfconfig | |
421 | else | |
422 | sysconfdir = $(prefix)/etc | |
423 | ETC_PERFCONFIG = etc/perfconfig | |
424 | endif | |
425 | lib = lib | |
426 | ||
427 | # Shell quote (do not use $(call) to accommodate ancient setups); | |
428 | ETC_PERFCONFIG_SQ = $(subst ','\'',$(ETC_PERFCONFIG)) | |
429 | DESTDIR_SQ = $(subst ','\'',$(DESTDIR)) | |
430 | bindir_SQ = $(subst ','\'',$(bindir)) | |
431 | mandir_SQ = $(subst ','\'',$(mandir)) | |
432 | infodir_SQ = $(subst ','\'',$(infodir)) | |
433 | perfexecdir_SQ = $(subst ','\'',$(perfexecdir)) | |
434 | template_dir_SQ = $(subst ','\'',$(template_dir)) | |
435 | htmldir_SQ = $(subst ','\'',$(htmldir)) | |
436 | prefix_SQ = $(subst ','\'',$(prefix)) | |
437 | sysconfdir_SQ = $(subst ','\'',$(sysconfdir)) | |
438 | ||
439 | ifneq ($(filter /%,$(firstword $(perfexecdir))),) | |
440 | perfexec_instdir = $(perfexecdir) | |
441 | else | |
442 | perfexec_instdir = $(prefix)/$(perfexecdir) | |
443 | endif | |
444 | perfexec_instdir_SQ = $(subst ','\'',$(perfexec_instdir)) |