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