1 # SPDX-License-Identifier: GPL-2.0
7 test-dwarf_getlocations.bin \
9 test-fortify-source.bin \
10 test-sync-compare-and-swap.bin \
11 test-get_current_dir_name.bin \
14 test-gtk2-infobar.bin \
18 test-disassembler-four-args.bin \
19 test-reallocarray.bin \
20 test-libbfd-liberty.bin \
21 test-libbfd-liberty-z.bin \
22 test-cplus-demangle.bin \
25 test-libelf-getphdrnum.bin \
26 test-libelf-gelf_getnote.bin \
27 test-libelf-getshdrstrndx.bin \
28 test-libelf-mmap.bin \
30 test-numa_num_possible_cpus.bin \
33 test-libpython-version.bin \
35 test-libslang-include-subdir.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 \
46 test-pthread-barrier.bin \
47 test-stackprotector-all.bin \
49 test-libdw-dwarf-unwind.bin \
50 test-libbabeltrace.bin \
52 test-compile-x32.bin \
63 test-sched_getcpu.bin \
68 test-llvm-version.bin \
71 test-clang-bpf-co-re.bin \
72 test-file-handle.bin \
75 FILES := $(addprefix $(OUTPUT),$(FILES))
77 PKG_CONFIG ?= $(CROSS_COMPILE)pkg-config
78 LLVM_CONFIG ?= llvm-config
83 __BUILD = $(CC) $(CFLAGS) -MD -Wall -Werror -o $@ $(patsubst %.bin,%.c,$(@F)) $(LDFLAGS)
84 BUILD = $(__BUILD) > $(@:.bin=.make.output) 2>&1
86 __BUILDXX = $(CXX) $(CXXFLAGS) -MD -Wall -Werror -o $@ $(patsubst %.bin,%.cpp,$(@F)) $(LDFLAGS)
87 BUILDXX = $(__BUILDXX) > $(@:.bin=.make.output) 2>&1
89 ###############################
91 $(OUTPUT)test-all.bin:
92 $(BUILD) -fstack-protector-all -O2 -D_FORTIFY_SOURCE=2 -ldw -lelf -lnuma -lelf -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
94 $(OUTPUT)test-hello.bin:
97 $(OUTPUT)test-pthread-attr-setaffinity-np.bin:
98 $(BUILD) -D_GNU_SOURCE -lpthread
100 $(OUTPUT)test-pthread-barrier.bin:
103 $(OUTPUT)test-stackprotector-all.bin:
104 $(BUILD) -fstack-protector-all
106 $(OUTPUT)test-fortify-source.bin:
107 $(BUILD) -O2 -D_FORTIFY_SOURCE=2
109 $(OUTPUT)test-bionic.bin:
112 $(OUTPUT)test-libcap.bin:
115 $(OUTPUT)test-libelf.bin:
118 $(OUTPUT)test-eventfd.bin:
121 $(OUTPUT)test-get_current_dir_name.bin:
124 $(OUTPUT)test-glibc.bin:
127 $(OUTPUT)test-sched_getcpu.bin:
130 $(OUTPUT)test-setns.bin:
133 $(OUTPUT)test-libopencsd.bin:
134 $(BUILD) # -lopencsd_c_api -lopencsd provided by
135 # $(FEATURE_CHECK_LDFLAGS-libopencsd)
138 ifeq ($(findstring -static,${LDFLAGS}),-static)
139 DWARFLIBS += -lelf -lebl -lz -llzma -lbz2
142 $(OUTPUT)test-dwarf.bin:
143 $(BUILD) $(DWARFLIBS)
145 $(OUTPUT)test-dwarf_getlocations.bin:
146 $(BUILD) $(DWARFLIBS)
148 $(OUTPUT)test-libelf-mmap.bin:
151 $(OUTPUT)test-libelf-getphdrnum.bin:
154 $(OUTPUT)test-libelf-gelf_getnote.bin:
157 $(OUTPUT)test-libelf-getshdrstrndx.bin:
160 $(OUTPUT)test-libnuma.bin:
163 $(OUTPUT)test-numa_num_possible_cpus.bin:
166 $(OUTPUT)test-libunwind.bin:
169 $(OUTPUT)test-libunwind-debug-frame.bin:
171 $(OUTPUT)test-libunwind-x86.bin:
172 $(BUILD) -lelf -lunwind-x86
174 $(OUTPUT)test-libunwind-x86_64.bin:
175 $(BUILD) -lelf -lunwind-x86_64
177 $(OUTPUT)test-libunwind-arm.bin:
178 $(BUILD) -lelf -lunwind-arm
180 $(OUTPUT)test-libunwind-aarch64.bin:
181 $(BUILD) -lelf -lunwind-aarch64
183 $(OUTPUT)test-libunwind-debug-frame-arm.bin:
184 $(BUILD) -lelf -lunwind-arm
186 $(OUTPUT)test-libunwind-debug-frame-aarch64.bin:
187 $(BUILD) -lelf -lunwind-aarch64
189 $(OUTPUT)test-libaudit.bin:
192 $(OUTPUT)test-libslang.bin:
195 $(OUTPUT)test-libslang-include-subdir.bin:
198 $(OUTPUT)test-libcrypto.bin:
201 $(OUTPUT)test-gtk2.bin:
202 $(BUILD) $(shell $(PKG_CONFIG) --libs --cflags gtk+-2.0 2>/dev/null) -Wno-deprecated-declarations
204 $(OUTPUT)test-gtk2-infobar.bin:
205 $(BUILD) $(shell $(PKG_CONFIG) --libs --cflags gtk+-2.0 2>/dev/null)
207 grep-libs = $(filter -l%,$(1))
208 strip-libs = $(filter-out -l%,$(1))
210 PERL_EMBED_LDOPTS = $(shell perl -MExtUtils::Embed -e ldopts 2>/dev/null)
211 PERL_EMBED_LDFLAGS = $(call strip-libs,$(PERL_EMBED_LDOPTS))
212 PERL_EMBED_LIBADD = $(call grep-libs,$(PERL_EMBED_LDOPTS))
213 PERL_EMBED_CCOPTS = `perl -MExtUtils::Embed -e ccopts 2>/dev/null`
214 FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS)
216 $(OUTPUT)test-libperl.bin:
217 $(BUILD) $(FLAGS_PERL_EMBED)
219 $(OUTPUT)test-libpython.bin:
220 $(BUILD) $(FLAGS_PYTHON_EMBED)
222 $(OUTPUT)test-libpython-version.bin:
225 $(OUTPUT)test-libbfd.bin:
226 $(BUILD) -DPACKAGE='"perf"' -lbfd -ldl
228 $(OUTPUT)test-disassembler-four-args.bin:
229 $(BUILD) -DPACKAGE='"perf"' -lbfd -lopcodes
231 $(OUTPUT)test-reallocarray.bin:
234 $(OUTPUT)test-libbfd-liberty.bin:
235 $(CC) $(CFLAGS) -Wall -Werror -o $@ test-libbfd.c -DPACKAGE='"perf"' $(LDFLAGS) -lbfd -ldl -liberty
237 $(OUTPUT)test-libbfd-liberty-z.bin:
238 $(CC) $(CFLAGS) -Wall -Werror -o $@ test-libbfd.c -DPACKAGE='"perf"' $(LDFLAGS) -lbfd -ldl -liberty -lz
240 $(OUTPUT)test-cplus-demangle.bin:
243 $(OUTPUT)test-backtrace.bin:
246 $(OUTPUT)test-timerfd.bin:
249 $(OUTPUT)test-libdw-dwarf-unwind.bin:
250 $(BUILD) # -ldw provided by $(FEATURE_CHECK_LDFLAGS-libdw-dwarf-unwind)
252 $(OUTPUT)test-libbabeltrace.bin:
253 $(BUILD) # -lbabeltrace provided by $(FEATURE_CHECK_LDFLAGS-libbabeltrace)
255 $(OUTPUT)test-sync-compare-and-swap.bin:
258 $(OUTPUT)test-compile-32.bin:
259 $(CC) -m32 -o $@ test-compile.c
261 $(OUTPUT)test-compile-x32.bin:
262 $(CC) -mx32 -o $@ test-compile.c
264 $(OUTPUT)test-zlib.bin:
267 $(OUTPUT)test-lzma.bin:
270 $(OUTPUT)test-get_cpuid.bin:
273 $(OUTPUT)test-bpf.bin:
276 $(OUTPUT)test-libbpf.bin:
279 $(OUTPUT)test-sdt.bin:
282 $(OUTPUT)test-cxx.bin:
283 $(BUILDXX) -std=gnu++11
285 $(OUTPUT)test-gettid.bin:
288 $(OUTPUT)test-jvmti.bin:
291 $(OUTPUT)test-jvmti-cmlr.bin:
294 $(OUTPUT)test-llvm.bin:
295 $(BUILDXX) -std=gnu++11 \
296 -I$(shell $(LLVM_CONFIG) --includedir) \
297 -L$(shell $(LLVM_CONFIG) --libdir) \
298 $(shell $(LLVM_CONFIG) --libs Core BPF) \
299 $(shell $(LLVM_CONFIG) --system-libs) \
300 > $(@:.bin=.make.output) 2>&1
302 $(OUTPUT)test-llvm-version.bin:
303 $(BUILDXX) -std=gnu++11 \
304 -I$(shell $(LLVM_CONFIG) --includedir) \
305 > $(@:.bin=.make.output) 2>&1
307 $(OUTPUT)test-clang.bin:
308 $(BUILDXX) -std=gnu++11 \
309 -I$(shell $(LLVM_CONFIG) --includedir) \
310 -L$(shell $(LLVM_CONFIG) --libdir) \
311 -Wl,--start-group -lclangBasic -lclangDriver \
312 -lclangFrontend -lclangEdit -lclangLex \
313 -lclangAST -Wl,--end-group \
314 $(shell $(LLVM_CONFIG) --libs Core option) \
315 $(shell $(LLVM_CONFIG) --system-libs) \
316 > $(@:.bin=.make.output) 2>&1
318 -include $(OUTPUT)*.d
320 $(OUTPUT)test-libaio.bin:
323 $(OUTPUT)test-libzstd.bin:
326 $(OUTPUT)test-clang-bpf-co-re.bin:
327 $(CLANG) -S -g -target bpf -o - $(patsubst %.bin,%.c,$(@F)) | \
330 $(OUTPUT)test-file-handle.bin:
333 $(OUTPUT)test-libpfm4.bin:
336 ###############################
339 rm -f $(FILES) $(OUTPUT)*.d $(FILES:.bin=.make.output)