aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/config/feature-checks/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/config/feature-checks/Makefile')
-rw-r--r--tools/perf/config/feature-checks/Makefile152
1 files changed, 152 insertions, 0 deletions
diff --git a/tools/perf/config/feature-checks/Makefile b/tools/perf/config/feature-checks/Makefile
new file mode 100644
index 000000000000..87e790017c69
--- /dev/null
+++ b/tools/perf/config/feature-checks/Makefile
@@ -0,0 +1,152 @@
1
2FILES= \
3 test-all \
4 test-backtrace \
5 test-bionic \
6 test-dwarf \
7 test-fortify-source \
8 test-glibc \
9 test-gtk2 \
10 test-gtk2-infobar \
11 test-hello \
12 test-libaudit \
13 test-libbfd \
14 test-liberty \
15 test-liberty-z \
16 test-cplus-demangle \
17 test-libelf \
18 test-libelf-getphdrnum \
19 test-libelf-mmap \
20 test-libnuma \
21 test-libperl \
22 test-libpython \
23 test-libpython-version \
24 test-libslang \
25 test-libunwind \
26 test-libunwind-debug-frame \
27 test-on-exit \
28 test-stackprotector-all \
29 test-stackprotector \
30 test-timerfd
31
32CC := $(CC) -MD
33
34all: $(FILES)
35
36BUILD = $(CC) $(CFLAGS) $(LDFLAGS) -o $(OUTPUT)$@ $@.c
37
38###############################
39
40test-all:
41 $(BUILD) -Werror -fstack-protector -fstack-protector-all -O2 -Werror -D_FORTIFY_SOURCE=2 -ldw -lelf -lnuma $(LIBUNWIND_LIBS) -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"' -lbfd -ldl
42
43test-hello:
44 $(BUILD)
45
46test-stackprotector-all:
47 $(BUILD) -Werror -fstack-protector-all
48
49test-stackprotector:
50 $(BUILD) -Werror -fstack-protector -Wstack-protector
51
52test-fortify-source:
53 $(BUILD) -O2 -Werror -D_FORTIFY_SOURCE=2
54
55test-bionic:
56 $(BUILD)
57
58test-libelf:
59 $(BUILD) -lelf
60
61test-glibc:
62 $(BUILD)
63
64test-dwarf:
65 $(BUILD) -ldw
66
67test-libelf-mmap:
68 $(BUILD) -lelf
69
70test-libelf-getphdrnum:
71 $(BUILD) -lelf
72
73test-libnuma:
74 $(BUILD) -lnuma
75
76test-libunwind:
77 $(BUILD) $(LIBUNWIND_LIBS) -lelf
78
79test-libunwind-debug-frame:
80 $(BUILD) $(LIBUNWIND_LIBS) -lelf
81
82test-libaudit:
83 $(BUILD) -laudit
84
85test-libslang:
86 $(BUILD) -I/usr/include/slang -lslang
87
88test-gtk2:
89 $(BUILD) $(shell pkg-config --libs --cflags gtk+-2.0 2>/dev/null)
90
91test-gtk2-infobar:
92 $(BUILD) $(shell pkg-config --libs --cflags gtk+-2.0 2>/dev/null)
93
94grep-libs = $(filter -l%,$(1))
95strip-libs = $(filter-out -l%,$(1))
96
97PERL_EMBED_LDOPTS = $(shell perl -MExtUtils::Embed -e ldopts 2>/dev/null)
98PERL_EMBED_LDFLAGS = $(call strip-libs,$(PERL_EMBED_LDOPTS))
99PERL_EMBED_LIBADD = $(call grep-libs,$(PERL_EMBED_LDOPTS))
100PERL_EMBED_CCOPTS = `perl -MExtUtils::Embed -e ccopts 2>/dev/null`
101FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS)
102
103test-libperl:
104 $(BUILD) $(FLAGS_PERL_EMBED)
105
106override PYTHON := python
107override PYTHON_CONFIG := python-config
108
109escape-for-shell-sq = $(subst ','\'',$(1))
110shell-sq = '$(escape-for-shell-sq)'
111
112PYTHON_CONFIG_SQ = $(call shell-sq,$(PYTHON_CONFIG))
113
114PYTHON_EMBED_LDOPTS = $(shell $(PYTHON_CONFIG_SQ) --ldflags 2>/dev/null)
115PYTHON_EMBED_LDFLAGS = $(call strip-libs,$(PYTHON_EMBED_LDOPTS))
116PYTHON_EMBED_LIBADD = $(call grep-libs,$(PYTHON_EMBED_LDOPTS))
117PYTHON_EMBED_CCOPTS = $(shell $(PYTHON_CONFIG_SQ) --cflags 2>/dev/null)
118FLAGS_PYTHON_EMBED = $(PYTHON_EMBED_CCOPTS) $(PYTHON_EMBED_LDOPTS)
119
120test-libpython:
121 $(BUILD) $(FLAGS_PYTHON_EMBED)
122
123test-libpython-version:
124 $(BUILD) $(FLAGS_PYTHON_EMBED)
125
126test-libbfd:
127 $(BUILD) -DPACKAGE='"perf"' -lbfd -ldl
128
129test-liberty:
130 $(CC) -o $(OUTPUT)$@ test-libbfd.c -DPACKAGE='"perf"' -lbfd -ldl -liberty
131
132test-liberty-z:
133 $(CC) -o $(OUTPUT)$@ test-libbfd.c -DPACKAGE='"perf"' -lbfd -ldl -liberty -lz
134
135test-cplus-demangle:
136 $(BUILD) -liberty
137
138test-on-exit:
139 $(BUILD)
140
141test-backtrace:
142 $(BUILD)
143
144test-timerfd:
145 $(BUILD)
146
147-include *.d
148
149###############################
150
151clean:
152 rm -f $(FILES) *.d