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