]>
Commit | Line | Data |
---|---|---|
b2441318 | 1 | # SPDX-License-Identifier: GPL-2.0 |
2fedf79b JO |
2 | FILES= \ |
3 | test-all.bin \ | |
4 | test-backtrace.bin \ | |
5 | test-bionic.bin \ | |
6 | test-dwarf.bin \ | |
7 | test-dwarf_getlocations.bin \ | |
8 | test-fortify-source.bin \ | |
9 | test-sync-compare-and-swap.bin \ | |
10 | test-glibc.bin \ | |
11 | test-gtk2.bin \ | |
12 | test-gtk2-infobar.bin \ | |
13 | test-hello.bin \ | |
14 | test-libaudit.bin \ | |
15 | test-libbfd.bin \ | |
16 | test-liberty.bin \ | |
17 | test-liberty-z.bin \ | |
18 | test-cplus-demangle.bin \ | |
19 | test-libelf.bin \ | |
20 | test-libelf-getphdrnum.bin \ | |
21 | test-libelf-gelf_getnote.bin \ | |
22 | test-libelf-getshdrstrndx.bin \ | |
23 | test-libelf-mmap.bin \ | |
24 | test-libnuma.bin \ | |
25 | test-numa_num_possible_cpus.bin \ | |
26 | test-libperl.bin \ | |
27 | test-libpython.bin \ | |
28 | test-libpython-version.bin \ | |
29 | test-libslang.bin \ | |
30 | test-libcrypto.bin \ | |
31 | test-libunwind.bin \ | |
32 | test-libunwind-debug-frame.bin \ | |
33 | test-libunwind-x86.bin \ | |
34 | test-libunwind-x86_64.bin \ | |
35 | test-libunwind-arm.bin \ | |
36 | test-libunwind-aarch64.bin \ | |
37 | test-libunwind-debug-frame-arm.bin \ | |
38 | test-libunwind-debug-frame-aarch64.bin \ | |
39 | test-pthread-attr-setaffinity-np.bin \ | |
40 | test-stackprotector-all.bin \ | |
41 | test-timerfd.bin \ | |
42 | test-libdw-dwarf-unwind.bin \ | |
43 | test-libbabeltrace.bin \ | |
44 | test-compile-32.bin \ | |
45 | test-compile-x32.bin \ | |
46 | test-zlib.bin \ | |
47 | test-lzma.bin \ | |
48 | test-bpf.bin \ | |
49 | test-get_cpuid.bin \ | |
50 | test-sdt.bin \ | |
51 | test-cxx.bin \ | |
120010cb | 52 | test-jvmti.bin \ |
86bcdb5a ACM |
53 | test-sched_getcpu.bin \ |
54 | test-setns.bin | |
b6aa9979 | 55 | |
1925459b JP |
56 | FILES := $(addprefix $(OUTPUT),$(FILES)) |
57 | ||
9961aa66 DCC |
58 | CC ?= $(CROSS_COMPILE)gcc |
59 | CXX ?= $(CROSS_COMPILE)g++ | |
60 | PKG_CONFIG ?= $(CROSS_COMPILE)pkg-config | |
cb40d55b | 61 | LLVM_CONFIG ?= llvm-config |
8b6eb56a | 62 | |
b6aa9979 IM |
63 | all: $(FILES) |
64 | ||
9961aa66 | 65 | __BUILD = $(CC) $(CFLAGS) -MD -Wall -Werror -o $@ $(patsubst %.bin,%.c,$(@F)) $(LDFLAGS) |
1925459b | 66 | BUILD = $(__BUILD) > $(@:.bin=.make.output) 2>&1 |
b6aa9979 | 67 | |
9961aa66 | 68 | __BUILDXX = $(CXX) $(CXXFLAGS) -MD -Wall -Werror -o $@ $(patsubst %.bin,%.cpp,$(@F)) $(LDFLAGS) |
87095f7d WN |
69 | BUILDXX = $(__BUILDXX) > $(@:.bin=.make.output) 2>&1 |
70 | ||
b6aa9979 IM |
71 | ############################### |
72 | ||
1925459b | 73 | $(OUTPUT)test-all.bin: |
6c6f0f61 | 74 | $(BUILD) -fstack-protector-all -O2 -D_FORTIFY_SOURCE=2 -ldw -lelf -lnuma -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 -lz -llzma |
baa9c30e | 75 | |
1925459b | 76 | $(OUTPUT)test-hello.bin: |
b6aa9979 IM |
77 | $(BUILD) |
78 | ||
1925459b | 79 | $(OUTPUT)test-pthread-attr-setaffinity-np.bin: |
b49f1a4b | 80 | $(BUILD) -D_GNU_SOURCE -lpthread |
459a3df7 | 81 | |
1925459b | 82 | $(OUTPUT)test-stackprotector-all.bin: |
b49f1a4b | 83 | $(BUILD) -fstack-protector-all |
90ac5422 | 84 | |
1925459b | 85 | $(OUTPUT)test-fortify-source.bin: |
b49f1a4b | 86 | $(BUILD) -O2 -D_FORTIFY_SOURCE=2 |
1ea6f99e | 87 | |
1925459b | 88 | $(OUTPUT)test-bionic.bin: |
78e9d655 IM |
89 | $(BUILD) |
90 | ||
1925459b | 91 | $(OUTPUT)test-libelf.bin: |
8f7f8005 IM |
92 | $(BUILD) -lelf |
93 | ||
1925459b | 94 | $(OUTPUT)test-glibc.bin: |
e12762cf IM |
95 | $(BUILD) |
96 | ||
120010cb ACM |
97 | $(OUTPUT)test-sched_getcpu.bin: |
98 | $(BUILD) | |
99 | ||
86bcdb5a ACM |
100 | $(OUTPUT)test-setns.bin: |
101 | $(BUILD) | |
102 | ||
7aec51cb AK |
103 | DWARFLIBS := -ldw |
104 | ifeq ($(findstring -static,${LDFLAGS}),-static) | |
105 | DWARFLIBS += -lelf -lebl -lz -llzma -lbz2 | |
106 | endif | |
107 | ||
1925459b | 108 | $(OUTPUT)test-dwarf.bin: |
7aec51cb | 109 | $(BUILD) $(DWARFLIBS) |
8295d4e2 | 110 | |
bd0419e2 ACM |
111 | $(OUTPUT)test-dwarf_getlocations.bin: |
112 | $(BUILD) $(DWARFLIBS) | |
113 | ||
1925459b | 114 | $(OUTPUT)test-libelf-mmap.bin: |
8869b17e IM |
115 | $(BUILD) -lelf |
116 | ||
1925459b | 117 | $(OUTPUT)test-libelf-getphdrnum.bin: |
b7bcef6f IM |
118 | $(BUILD) -lelf |
119 | ||
1c1a3a47 ACM |
120 | $(OUTPUT)test-libelf-gelf_getnote.bin: |
121 | $(BUILD) -lelf | |
122 | ||
2492c465 ACM |
123 | $(OUTPUT)test-libelf-getshdrstrndx.bin: |
124 | $(BUILD) -lelf | |
125 | ||
1925459b | 126 | $(OUTPUT)test-libnuma.bin: |
3ae069cf IM |
127 | $(BUILD) -lnuma |
128 | ||
1925459b | 129 | $(OUTPUT)test-numa_num_possible_cpus.bin: |
f8ac8606 ACM |
130 | $(BUILD) -lnuma |
131 | ||
1925459b | 132 | $(OUTPUT)test-libunwind.bin: |
1448fef4 | 133 | $(BUILD) -lelf |
058f952d | 134 | |
1925459b | 135 | $(OUTPUT)test-libunwind-debug-frame.bin: |
1448fef4 | 136 | $(BUILD) -lelf |
b1d96000 HK |
137 | $(OUTPUT)test-libunwind-x86.bin: |
138 | $(BUILD) -lelf -lunwind-x86 | |
139 | ||
140 | $(OUTPUT)test-libunwind-x86_64.bin: | |
141 | $(BUILD) -lelf -lunwind-x86_64 | |
142 | ||
143 | $(OUTPUT)test-libunwind-arm.bin: | |
144 | $(BUILD) -lelf -lunwind-arm | |
145 | ||
146 | $(OUTPUT)test-libunwind-aarch64.bin: | |
147 | $(BUILD) -lelf -lunwind-aarch64 | |
148 | ||
f9be7eef HK |
149 | $(OUTPUT)test-libunwind-debug-frame-arm.bin: |
150 | $(BUILD) -lelf -lunwind-arm | |
151 | ||
152 | $(OUTPUT)test-libunwind-debug-frame-aarch64.bin: | |
153 | $(BUILD) -lelf -lunwind-aarch64 | |
e310718d | 154 | |
1925459b | 155 | $(OUTPUT)test-libaudit.bin: |
d795a658 IM |
156 | $(BUILD) -laudit |
157 | ||
1925459b | 158 | $(OUTPUT)test-libslang.bin: |
b9498b50 IM |
159 | $(BUILD) -I/usr/include/slang -lslang |
160 | ||
8ee46460 SE |
161 | $(OUTPUT)test-libcrypto.bin: |
162 | $(BUILD) -lcrypto | |
163 | ||
1925459b | 164 | $(OUTPUT)test-gtk2.bin: |
a8a5cd8b | 165 | $(BUILD) $(shell $(PKG_CONFIG) --libs --cflags gtk+-2.0 2>/dev/null) |
7ef9e055 | 166 | |
1925459b | 167 | $(OUTPUT)test-gtk2-infobar.bin: |
a8a5cd8b | 168 | $(BUILD) $(shell $(PKG_CONFIG) --libs --cflags gtk+-2.0 2>/dev/null) |
c7a79e96 | 169 | |
7181a671 IM |
170 | grep-libs = $(filter -l%,$(1)) |
171 | strip-libs = $(filter-out -l%,$(1)) | |
172 | ||
173 | PERL_EMBED_LDOPTS = $(shell perl -MExtUtils::Embed -e ldopts 2>/dev/null) | |
174 | PERL_EMBED_LDFLAGS = $(call strip-libs,$(PERL_EMBED_LDOPTS)) | |
175 | PERL_EMBED_LIBADD = $(call grep-libs,$(PERL_EMBED_LDOPTS)) | |
176 | PERL_EMBED_CCOPTS = `perl -MExtUtils::Embed -e ccopts 2>/dev/null` | |
177 | FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS) | |
178 | ||
1925459b | 179 | $(OUTPUT)test-libperl.bin: |
7181a671 IM |
180 | $(BUILD) $(FLAGS_PERL_EMBED) |
181 | ||
1925459b | 182 | $(OUTPUT)test-libpython.bin: |
7be6b316 | 183 | $(BUILD) $(FLAGS_PYTHON_EMBED) |
9734163b | 184 | |
1925459b | 185 | $(OUTPUT)test-libpython-version.bin: |
56c7d79e | 186 | $(BUILD) |
95d061c8 | 187 | |
1925459b | 188 | $(OUTPUT)test-libbfd.bin: |
280e7c48 | 189 | $(BUILD) -DPACKAGE='"perf"' -lbfd -lz -liberty -ldl |
3b7646e4 | 190 | |
1925459b JP |
191 | $(OUTPUT)test-liberty.bin: |
192 | $(CC) $(CFLAGS) -Wall -Werror -o $@ test-libbfd.c -DPACKAGE='"perf"' $(LDFLAGS) -lbfd -ldl -liberty | |
1c47661a | 193 | |
1925459b JP |
194 | $(OUTPUT)test-liberty-z.bin: |
195 | $(CC) $(CFLAGS) -Wall -Werror -o $@ test-libbfd.c -DPACKAGE='"perf"' $(LDFLAGS) -lbfd -ldl -liberty -lz | |
1c47661a | 196 | |
1925459b | 197 | $(OUTPUT)test-cplus-demangle.bin: |
1c47661a IM |
198 | $(BUILD) -liberty |
199 | ||
1925459b | 200 | $(OUTPUT)test-backtrace.bin: |
4cc9117a IM |
201 | $(BUILD) |
202 | ||
1925459b | 203 | $(OUTPUT)test-timerfd.bin: |
87419c9a DA |
204 | $(BUILD) |
205 | ||
1925459b | 206 | $(OUTPUT)test-libdw-dwarf-unwind.bin: |
53d0a573 JO |
207 | $(BUILD) # -ldw provided by $(FEATURE_CHECK_LDFLAGS-libdw-dwarf-unwind) |
208 | ||
1925459b | 209 | $(OUTPUT)test-libbabeltrace.bin: |
53d0a573 | 210 | $(BUILD) # -lbabeltrace provided by $(FEATURE_CHECK_LDFLAGS-libbabeltrace) |
45757895 | 211 | |
1925459b | 212 | $(OUTPUT)test-sync-compare-and-swap.bin: |
b49f1a4b | 213 | $(BUILD) |
f6d31369 | 214 | |
1925459b JP |
215 | $(OUTPUT)test-compile-32.bin: |
216 | $(CC) -m32 -o $@ test-compile.c | |
e477f3f0 | 217 | |
1925459b JP |
218 | $(OUTPUT)test-compile-x32.bin: |
219 | $(CC) -mx32 -o $@ test-compile.c | |
e477f3f0 | 220 | |
1925459b | 221 | $(OUTPUT)test-zlib.bin: |
e92ce12e NK |
222 | $(BUILD) -lz |
223 | ||
1925459b | 224 | $(OUTPUT)test-lzma.bin: |
6c6f0f61 JO |
225 | $(BUILD) -llzma |
226 | ||
1925459b | 227 | $(OUTPUT)test-get_cpuid.bin: |
b0063dbf ACM |
228 | $(BUILD) |
229 | ||
1925459b | 230 | $(OUTPUT)test-bpf.bin: |
1b76c13e WN |
231 | $(BUILD) |
232 | ||
e26e63be MH |
233 | $(OUTPUT)test-sdt.bin: |
234 | $(BUILD) | |
235 | ||
87095f7d WN |
236 | $(OUTPUT)test-cxx.bin: |
237 | $(BUILDXX) -std=gnu++11 | |
238 | ||
285932a2 JO |
239 | $(OUTPUT)test-jvmti.bin: |
240 | $(BUILD) | |
241 | ||
cb40d55b | 242 | $(OUTPUT)test-llvm.bin: |
a940cad3 | 243 | $(BUILDXX) -std=gnu++11 \ |
cb40d55b WN |
244 | -I$(shell $(LLVM_CONFIG) --includedir) \ |
245 | -L$(shell $(LLVM_CONFIG) --libdir) \ | |
246 | $(shell $(LLVM_CONFIG) --libs Core BPF) \ | |
247 | $(shell $(LLVM_CONFIG) --system-libs) | |
248 | ||
a940cad3 WN |
249 | $(OUTPUT)test-llvm-version.bin: |
250 | $(BUILDXX) -std=gnu++11 \ | |
251 | -I$(shell $(LLVM_CONFIG) --includedir) | |
252 | ||
c7fb4f62 | 253 | $(OUTPUT)test-clang.bin: |
a940cad3 | 254 | $(BUILDXX) -std=gnu++11 \ |
c7fb4f62 WN |
255 | -I$(shell $(LLVM_CONFIG) --includedir) \ |
256 | -L$(shell $(LLVM_CONFIG) --libdir) \ | |
257 | -Wl,--start-group -lclangBasic -lclangDriver \ | |
258 | -lclangFrontend -lclangEdit -lclangLex \ | |
259 | -lclangAST -Wl,--end-group \ | |
260 | $(shell $(LLVM_CONFIG) --libs Core option) \ | |
261 | $(shell $(LLVM_CONFIG) --system-libs) | |
262 | ||
1925459b | 263 | -include $(OUTPUT)*.d |
8b6eb56a | 264 | |
b6aa9979 IM |
265 | ############################### |
266 | ||
267 | clean: | |
1925459b | 268 | rm -f $(FILES) $(OUTPUT)*.d $(FILES:.bin=.make.output) |