]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blob - tools/perf/config/feature-checks/Makefile
tools/perf/build: Split out feature check: 'libpython'
[mirror_ubuntu-bionic-kernel.git] / tools / perf / config / feature-checks / Makefile
1
2 FILES= \
3 test-hello \
4 test-stackprotector-all \
5 test-stackprotector \
6 test-volatile-register-var \
7 test-fortify-source \
8 test-bionic \
9 test-libelf \
10 test-glibc \
11 test-dwarf \
12 test-libelf-mmap \
13 test-libelf-getphdrnum \
14 test-libunwind \
15 test-libaudit \
16 test-libslang \
17 test-gtk2 \
18 test-gtk2-infobar \
19 test-libperl \
20 test-libpython \
21 test-libnuma
22
23 CC := $(CC) -MD
24
25 all: $(FILES)
26
27 BUILD = $(CC) -o $(OUTPUT)$@ $@.c
28
29 ###############################
30
31 test-hello:
32 $(BUILD)
33
34 test-stackprotector-all:
35 $(BUILD) -Werror -fstack-protector-all
36
37 test-stackprotector:
38 $(BUILD) -Werror -fstack-protector
39
40 test-volatile-register-var:
41 $(BUILD) -Werror -Wvolatile-register-var
42
43 test-fortify-source:
44 $(BUILD) -O2 -Werror -D_FORTIFY_SOURCE=2
45
46 test-bionic:
47 $(BUILD)
48
49 test-libelf:
50 $(BUILD) -lelf
51
52 test-glibc:
53 $(BUILD)
54
55 test-dwarf:
56 $(BUILD) -ldw
57
58 test-libelf-mmap:
59 $(BUILD) -lelf
60
61 test-libelf-getphdrnum:
62 $(BUILD) -lelf
63
64 test-libnuma:
65 $(BUILD) -lnuma
66
67 test-libunwind:
68 $(BUILD) -lunwind -lunwind-x86_64 -lelf
69
70 test-libaudit:
71 $(BUILD) -laudit
72
73 test-libslang:
74 $(BUILD) -I/usr/include/slang -lslang
75
76 test-gtk2:
77 $(BUILD) $(shell pkg-config --libs --cflags gtk+-2.0 2>/dev/null)
78
79 test-gtk2-infobar:
80 $(BUILD) $(shell pkg-config --libs --cflags gtk+-2.0 2>/dev/null)
81
82 grep-libs = $(filter -l%,$(1))
83 strip-libs = $(filter-out -l%,$(1))
84
85 PERL_EMBED_LDOPTS = $(shell perl -MExtUtils::Embed -e ldopts 2>/dev/null)
86 PERL_EMBED_LDFLAGS = $(call strip-libs,$(PERL_EMBED_LDOPTS))
87 PERL_EMBED_LIBADD = $(call grep-libs,$(PERL_EMBED_LDOPTS))
88 PERL_EMBED_CCOPTS = `perl -MExtUtils::Embed -e ccopts 2>/dev/null`
89 FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS)
90
91 test-libperl:
92 $(BUILD) $(FLAGS_PERL_EMBED)
93
94 override PYTHON := python
95 override PYTHON_CONFIG := python-config
96
97 escape-for-shell-sq = $(subst ','\'',$(1))
98 shell-sq = '$(escape-for-shell-sq)'
99
100 PYTHON_CONFIG_SQ = $(call shell-sq,$(PYTHON_CONFIG))
101
102 PYTHON_EMBED_LDOPTS = $(shell $(PYTHON_CONFIG_SQ) --ldflags 2>/dev/null)
103 PYTHON_EMBED_LDFLAGS = $(call strip-libs,$(PYTHON_EMBED_LDOPTS))
104 PYTHON_EMBED_LIBADD = $(call grep-libs,$(PYTHON_EMBED_LDOPTS))
105 PYTHON_EMBED_CCOPTS = $(shell $(PYTHON_CONFIG_SQ) --cflags 2>/dev/null)
106 FLAGS_PYTHON_EMBED = $(PYTHON_EMBED_CCOPTS) $(PYTHON_EMBED_LDOPTS)
107
108 test-libpython:
109 $(BUILD) $(FLAGS_PYTHON_EMBED)
110
111 -include *.d */*.d
112
113 ###############################
114
115 clean:
116 rm -f $(FILES) *.d