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