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-libbfd-buildid.bin \
19 test-disassembler-four-args.bin \
20 test-reallocarray.bin \
21 test-libbfd-liberty.bin \
22 test-libbfd-liberty-z.bin \
23 test-cplus-demangle.bin \
26 test-libelf-getphdrnum.bin \
27 test-libelf-gelf_getnote.bin \
28 test-libelf-getshdrstrndx.bin \
29 test-libdebuginfod.bin \
31 test-numa_num_possible_cpus.bin \
34 test-libpython-version.bin \
36 test-libslang-include-subdir.bin \
39 test-libunwind-debug-frame.bin \
40 test-libunwind-x86.bin \
41 test-libunwind-x86_64.bin \
42 test-libunwind-arm.bin \
43 test-libunwind-aarch64.bin \
44 test-libunwind-debug-frame-arm.bin \
45 test-libunwind-debug-frame-aarch64.bin \
46 test-pthread-attr-setaffinity-np.bin \
47 test-pthread-barrier.bin \
48 test-stackprotector-all.bin \
50 test-libdw-dwarf-unwind.bin \
51 test-libbabeltrace.bin \
53 test-compile-x32.bin \
64 test-sched_getcpu.bin \
69 test-llvm-version.bin \
72 test-clang-bpf-co-re.bin \
73 test-file-handle.bin \
76 FILES
:= $(addprefix $(OUTPUT
),$(FILES
))
78 PKG_CONFIG ?
= $(CROSS_COMPILE
)pkg-config
79 LLVM_CONFIG ?
= llvm-config
84 __BUILD
= $(CC
) $(CFLAGS
) -MD
-Wall
-Werror
-o
$@
$(patsubst %.bin
,%.c
,$(@F
)) $(LDFLAGS
)
85 BUILD
= $(__BUILD
) > $(@
:.bin
=.make.output
) 2>&1
87 __BUILDXX
= $(CXX
) $(CXXFLAGS
) -MD
-Wall
-Werror
-o
$@
$(patsubst %.bin
,%.
cpp,$(@F
)) $(LDFLAGS
)
88 BUILDXX
= $(__BUILDXX
) > $(@
:.bin
=.make.output
) 2>&1
90 ###############################
92 $(OUTPUT
)test-all.bin
:
93 $(BUILD
) -fstack-protector-all
-O2
-D_FORTIFY_SOURCE
=2 -ldw
-lelf
-lnuma
-lelf
-I
/usr
/include/slang
-lslang
$(FLAGS_PERL_EMBED
) $(FLAGS_PYTHON_EMBED
) -DPACKAGE
='"perf"' -lbfd
-ldl
-lz
-llzma
-lzstd
-lcap
95 $(OUTPUT
)test-hello.bin
:
98 $(OUTPUT
)test-pthread-attr-setaffinity-np.bin
:
99 $(BUILD
) -D_GNU_SOURCE
-lpthread
101 $(OUTPUT
)test-pthread-barrier.bin
:
104 $(OUTPUT
)test-stackprotector-all.bin
:
105 $(BUILD
) -fstack-protector-all
107 $(OUTPUT
)test-fortify-source.bin
:
108 $(BUILD
) -O2
-D_FORTIFY_SOURCE
=2
110 $(OUTPUT
)test-bionic.bin
:
113 $(OUTPUT
)test-libcap.bin
:
116 $(OUTPUT
)test-libelf.bin
:
119 $(OUTPUT
)test-eventfd.bin
:
122 $(OUTPUT
)test-get_current_dir_name.bin
:
125 $(OUTPUT
)test-glibc.bin
:
128 $(OUTPUT
)test-sched_getcpu.bin
:
131 $(OUTPUT
)test-setns.bin
:
134 $(OUTPUT
)test-libopencsd.bin
:
135 $(BUILD
) # -lopencsd_c_api -lopencsd provided by
136 # $(FEATURE_CHECK_LDFLAGS-libopencsd)
139 ifeq ($(findstring -static
,${LDFLAGS}),-static
)
140 DWARFLIBS
+= -lelf
-lebl
-lz
-llzma
-lbz2
143 $(OUTPUT
)test-dwarf.bin
:
144 $(BUILD
) $(DWARFLIBS
)
146 $(OUTPUT
)test-dwarf_getlocations.bin
:
147 $(BUILD
) $(DWARFLIBS
)
149 $(OUTPUT
)test-libelf-getphdrnum.bin
:
152 $(OUTPUT
)test-libelf-gelf_getnote.bin
:
155 $(OUTPUT
)test-libelf-getshdrstrndx.bin
:
158 $(OUTPUT
)test-libdebuginfod.bin
:
159 $(BUILD
) -ldebuginfod
161 $(OUTPUT
)test-libnuma.bin
:
164 $(OUTPUT
)test-numa_num_possible_cpus.bin
:
167 $(OUTPUT
)test-libunwind.bin
:
170 $(OUTPUT
)test-libunwind-debug-frame.bin
:
172 $(OUTPUT
)test-libunwind-x86.bin
:
173 $(BUILD
) -lelf
-lunwind-x86
175 $(OUTPUT
)test-libunwind-x86_64.bin
:
176 $(BUILD
) -lelf
-lunwind-x86_64
178 $(OUTPUT
)test-libunwind-arm.bin
:
179 $(BUILD
) -lelf
-lunwind-arm
181 $(OUTPUT
)test-libunwind-aarch64.bin
:
182 $(BUILD
) -lelf
-lunwind-aarch64
184 $(OUTPUT
)test-libunwind-debug-frame-arm.bin
:
185 $(BUILD
) -lelf
-lunwind-arm
187 $(OUTPUT
)test-libunwind-debug-frame-aarch64.bin
:
188 $(BUILD
) -lelf
-lunwind-aarch64
190 $(OUTPUT
)test-libaudit.bin
:
193 $(OUTPUT
)test-libslang.bin
:
196 $(OUTPUT
)test-libslang-include-subdir.bin
:
199 $(OUTPUT
)test-libcrypto.bin
:
202 $(OUTPUT
)test-gtk2.bin
:
203 $(BUILD
) $(shell $(PKG_CONFIG
) --libs
--cflags gtk
+-2.0 2>/dev
/null
) -Wno-deprecated-declarations
205 $(OUTPUT
)test-gtk2-infobar.bin
:
206 $(BUILD
) $(shell $(PKG_CONFIG
) --libs
--cflags gtk
+-2.0 2>/dev
/null
)
208 grep-libs
= $(filter -l
%,$(1))
209 strip-libs
= $(filter-out -l
%,$(1))
211 PERL_EMBED_LDOPTS
= $(shell perl
-MExtUtils
::Embed
-e ldopts
2>/dev
/null
)
212 PERL_EMBED_LDFLAGS
= $(call strip-libs
,$(PERL_EMBED_LDOPTS
))
213 PERL_EMBED_LIBADD
= $(call grep-libs
,$(PERL_EMBED_LDOPTS
))
214 PERL_EMBED_CCOPTS
= `perl -MExtUtils::Embed -e ccopts 2>/dev/null`
215 FLAGS_PERL_EMBED
=$(PERL_EMBED_CCOPTS
) $(PERL_EMBED_LDOPTS
)
217 $(OUTPUT
)test-libperl.bin
:
218 $(BUILD
) $(FLAGS_PERL_EMBED
)
220 $(OUTPUT
)test-libpython.bin
:
221 $(BUILD
) $(FLAGS_PYTHON_EMBED
)
223 $(OUTPUT
)test-libpython-version.bin
:
226 $(OUTPUT
)test-libbfd.bin
:
227 $(BUILD
) -DPACKAGE
='"perf"' -lbfd
-ldl
229 $(OUTPUT
)test-libbfd-buildid.bin
:
230 $(BUILD
) -DPACKAGE
='"perf"' -lbfd
-ldl
232 $(OUTPUT
)test-disassembler-four-args.bin
:
233 $(BUILD
) -DPACKAGE
='"perf"' -lbfd
-lopcodes
235 $(OUTPUT
)test-reallocarray.bin
:
238 $(OUTPUT
)test-libbfd-liberty.bin
:
239 $(CC
) $(CFLAGS
) -Wall
-Werror
-o
$@ test-libbfd.c
-DPACKAGE
='"perf"' $(LDFLAGS
) -lbfd
-ldl
-liberty
241 $(OUTPUT
)test-libbfd-liberty-z.bin
:
242 $(CC
) $(CFLAGS
) -Wall
-Werror
-o
$@ test-libbfd.c
-DPACKAGE
='"perf"' $(LDFLAGS
) -lbfd
-ldl
-liberty
-lz
244 $(OUTPUT
)test-cplus-demangle.bin
:
247 $(OUTPUT
)test-backtrace.bin
:
250 $(OUTPUT
)test-timerfd.bin
:
253 $(OUTPUT
)test-libdw-dwarf-unwind.bin
:
254 $(BUILD
) # -ldw provided by $(FEATURE_CHECK_LDFLAGS-libdw-dwarf-unwind)
256 $(OUTPUT
)test-libbabeltrace.bin
:
257 $(BUILD
) # -lbabeltrace provided by $(FEATURE_CHECK_LDFLAGS-libbabeltrace)
259 $(OUTPUT
)test-sync-compare-and-swap.bin
:
262 $(OUTPUT
)test-compile-32.bin
:
263 $(CC
) -m32
-o
$@ test-compile.c
265 $(OUTPUT
)test-compile-x32.bin
:
266 $(CC
) -mx32
-o
$@ test-compile.c
268 $(OUTPUT
)test-zlib.bin
:
271 $(OUTPUT
)test-lzma.bin
:
274 $(OUTPUT
)test-get_cpuid.bin
:
277 $(OUTPUT
)test-bpf.bin
:
280 $(OUTPUT
)test-libbpf.bin
:
283 $(OUTPUT
)test-sdt.bin
:
286 $(OUTPUT
)test-cxx.bin
:
287 $(BUILDXX
) -std
=gnu
++11
289 $(OUTPUT
)test-gettid.bin
:
292 $(OUTPUT
)test-jvmti.bin
:
295 $(OUTPUT
)test-jvmti-cmlr.bin
:
298 $(OUTPUT
)test-llvm.bin
:
299 $(BUILDXX
) -std
=gnu
++11 \
300 -I
$(shell $(LLVM_CONFIG
) --includedir) \
301 -L
$(shell $(LLVM_CONFIG
) --libdir) \
302 $(shell $(LLVM_CONFIG
) --libs Core BPF
) \
303 $(shell $(LLVM_CONFIG
) --system-libs
) \
304 > $(@
:.bin
=.make.output
) 2>&1
306 $(OUTPUT
)test-llvm-version.bin
:
307 $(BUILDXX
) -std
=gnu
++11 \
308 -I
$(shell $(LLVM_CONFIG
) --includedir) \
309 > $(@
:.bin
=.make.output
) 2>&1
311 $(OUTPUT
)test-clang.bin
:
312 $(BUILDXX
) -std
=gnu
++11 \
313 -I
$(shell $(LLVM_CONFIG
) --includedir) \
314 -L
$(shell $(LLVM_CONFIG
) --libdir) \
315 -Wl
,--start-group
-lclangBasic
-lclangDriver \
316 -lclangFrontend
-lclangEdit
-lclangLex \
317 -lclangAST
-Wl
,--end-group \
318 $(shell $(LLVM_CONFIG
) --libs Core option
) \
319 $(shell $(LLVM_CONFIG
) --system-libs
) \
320 > $(@
:.bin
=.make.output
) 2>&1
322 -include $(OUTPUT
)*.d
324 $(OUTPUT
)test-libaio.bin
:
327 $(OUTPUT
)test-libzstd.bin
:
330 $(OUTPUT
)test-clang-bpf-co-re.bin
:
331 $(CLANG
) -S
-g
-target bpf
-o
- $(patsubst %.bin
,%.c
,$(@F
)) | \
334 $(OUTPUT
)test-file-handle.bin
:
337 $(OUTPUT
)test-libpfm4.bin
:
340 ###############################
343 rm -f
$(FILES
) $(OUTPUT
)*.d
$(FILES
:.bin
=.make.output
)