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