1 # SPDX-License-Identifier: GPL-2.0
7 test-dwarf_getlocations.bin \
8 test-fortify-source.bin \
9 test-sync-compare-and-swap.bin \
12 test-gtk2-infobar.bin \
16 test-disassembler-four-args.bin \
19 test-cplus-demangle.bin \
21 test-libelf-getphdrnum.bin \
22 test-libelf-gelf_getnote.bin \
23 test-libelf-getshdrstrndx.bin \
24 test-libelf-mmap.bin \
26 test-numa_num_possible_cpus.bin \
29 test-libpython-version.bin \
33 test-libunwind-debug-frame.bin \
34 test-libunwind-x86.bin \
35 test-libunwind-x86_64.bin \
36 test-libunwind-arm.bin \
37 test-libunwind-aarch64.bin \
38 test-libunwind-debug-frame-arm.bin \
39 test-libunwind-debug-frame-aarch64.bin \
40 test-pthread-attr-setaffinity-np.bin \
41 test-pthread-barrier.bin \
42 test-stackprotector-all.bin \
44 test-libdw-dwarf-unwind.bin \
45 test-libbabeltrace.bin \
47 test-compile-x32.bin \
55 test-sched_getcpu.bin \
62 FILES
:= $(addprefix $(OUTPUT
),$(FILES
))
64 CC ?
= $(CROSS_COMPILE
)gcc
65 CXX ?
= $(CROSS_COMPILE
)g
++
66 PKG_CONFIG ?
= $(CROSS_COMPILE
)pkg-config
67 LLVM_CONFIG ?
= llvm-config
71 __BUILD
= $(CC
) $(CFLAGS
) -MD
-Wall
-Werror
-o
$@
$(patsubst %.bin
,%.c
,$(@F
)) $(LDFLAGS
)
72 BUILD
= $(__BUILD
) > $(@
:.bin
=.make.output
) 2>&1
74 __BUILDXX
= $(CXX
) $(CXXFLAGS
) -MD
-Wall
-Werror
-o
$@
$(patsubst %.bin
,%.
cpp,$(@F
)) $(LDFLAGS
)
75 BUILDXX
= $(__BUILDXX
) > $(@
:.bin
=.make.output
) 2>&1
77 ###############################
79 $(OUTPUT
)test-all.bin
:
80 $(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
82 $(OUTPUT
)test-hello.bin
:
85 $(OUTPUT
)test-pthread-attr-setaffinity-np.bin
:
86 $(BUILD
) -D_GNU_SOURCE
-lpthread
88 $(OUTPUT
)test-pthread-barrier.bin
:
91 $(OUTPUT
)test-stackprotector-all.bin
:
92 $(BUILD
) -fstack-protector-all
94 $(OUTPUT
)test-fortify-source.bin
:
95 $(BUILD
) -O2
-D_FORTIFY_SOURCE
=2
97 $(OUTPUT
)test-bionic.bin
:
100 $(OUTPUT
)test-libelf.bin
:
103 $(OUTPUT
)test-glibc.bin
:
106 $(OUTPUT
)test-sched_getcpu.bin
:
109 $(OUTPUT
)test-setns.bin
:
112 $(OUTPUT
)test-libopencsd.bin
:
113 $(BUILD
) # -lopencsd_c_api -lopencsd provided by
114 # $(FEATURE_CHECK_LDFLAGS-libopencsd)
117 ifeq ($(findstring -static
,${LDFLAGS}),-static
)
118 DWARFLIBS
+= -lelf
-lebl
-lz
-llzma
-lbz2
121 $(OUTPUT
)test-dwarf.bin
:
122 $(BUILD
) $(DWARFLIBS
)
124 $(OUTPUT
)test-dwarf_getlocations.bin
:
125 $(BUILD
) $(DWARFLIBS
)
127 $(OUTPUT
)test-libelf-mmap.bin
:
130 $(OUTPUT
)test-libelf-getphdrnum.bin
:
133 $(OUTPUT
)test-libelf-gelf_getnote.bin
:
136 $(OUTPUT
)test-libelf-getshdrstrndx.bin
:
139 $(OUTPUT
)test-libnuma.bin
:
142 $(OUTPUT
)test-numa_num_possible_cpus.bin
:
145 $(OUTPUT
)test-libunwind.bin
:
148 $(OUTPUT
)test-libunwind-debug-frame.bin
:
150 $(OUTPUT
)test-libunwind-x86.bin
:
151 $(BUILD
) -lelf
-lunwind-x86
153 $(OUTPUT
)test-libunwind-x86_64.bin
:
154 $(BUILD
) -lelf
-lunwind-x86_64
156 $(OUTPUT
)test-libunwind-arm.bin
:
157 $(BUILD
) -lelf
-lunwind-arm
159 $(OUTPUT
)test-libunwind-aarch64.bin
:
160 $(BUILD
) -lelf
-lunwind-aarch64
162 $(OUTPUT
)test-libunwind-debug-frame-arm.bin
:
163 $(BUILD
) -lelf
-lunwind-arm
165 $(OUTPUT
)test-libunwind-debug-frame-aarch64.bin
:
166 $(BUILD
) -lelf
-lunwind-aarch64
168 $(OUTPUT
)test-libaudit.bin
:
171 $(OUTPUT
)test-libslang.bin
:
172 $(BUILD
) -I
/usr
/include/slang
-lslang
174 $(OUTPUT
)test-libcrypto.bin
:
177 $(OUTPUT
)test-gtk2.bin
:
178 $(BUILD
) $(shell $(PKG_CONFIG
) --libs
--cflags gtk
+-2.0 2>/dev
/null
)
180 $(OUTPUT
)test-gtk2-infobar.bin
:
181 $(BUILD
) $(shell $(PKG_CONFIG
) --libs
--cflags gtk
+-2.0 2>/dev
/null
)
183 grep-libs
= $(filter -l
%,$(1))
184 strip-libs
= $(filter-out -l
%,$(1))
186 PERL_EMBED_LDOPTS
= $(shell perl
-MExtUtils
::Embed
-e ldopts
2>/dev
/null
)
187 PERL_EMBED_LDFLAGS
= $(call strip-libs
,$(PERL_EMBED_LDOPTS
))
188 PERL_EMBED_LIBADD
= $(call grep-libs
,$(PERL_EMBED_LDOPTS
))
189 PERL_EMBED_CCOPTS
= `perl -MExtUtils::Embed -e ccopts 2>/dev/null`
190 FLAGS_PERL_EMBED
=$(PERL_EMBED_CCOPTS
) $(PERL_EMBED_LDOPTS
)
192 $(OUTPUT
)test-libperl.bin
:
193 $(BUILD
) $(FLAGS_PERL_EMBED
)
195 $(OUTPUT
)test-libpython.bin
:
196 $(BUILD
) $(FLAGS_PYTHON_EMBED
)
198 $(OUTPUT
)test-libpython-version.bin
:
201 $(OUTPUT
)test-libbfd.bin
:
202 $(BUILD
) -DPACKAGE
='"perf"' -lbfd
-lz
-liberty
-ldl
204 $(OUTPUT
)test-disassembler-four-args.bin
:
205 $(BUILD
) -DPACKAGE
='"perf"' -lbfd
-lopcodes
207 $(OUTPUT
)test-liberty.bin
:
208 $(CC
) $(CFLAGS
) -Wall
-Werror
-o
$@ test-libbfd.c
-DPACKAGE
='"perf"' $(LDFLAGS
) -lbfd
-ldl
-liberty
210 $(OUTPUT
)test-liberty-z.bin
:
211 $(CC
) $(CFLAGS
) -Wall
-Werror
-o
$@ test-libbfd.c
-DPACKAGE
='"perf"' $(LDFLAGS
) -lbfd
-ldl
-liberty
-lz
213 $(OUTPUT
)test-cplus-demangle.bin
:
216 $(OUTPUT
)test-backtrace.bin
:
219 $(OUTPUT
)test-timerfd.bin
:
222 $(OUTPUT
)test-libdw-dwarf-unwind.bin
:
223 $(BUILD
) # -ldw provided by $(FEATURE_CHECK_LDFLAGS-libdw-dwarf-unwind)
225 $(OUTPUT
)test-libbabeltrace.bin
:
226 $(BUILD
) # -lbabeltrace provided by $(FEATURE_CHECK_LDFLAGS-libbabeltrace)
228 $(OUTPUT
)test-sync-compare-and-swap.bin
:
231 $(OUTPUT
)test-compile-32.bin
:
232 $(CC
) -m32
-o
$@ test-compile.c
234 $(OUTPUT
)test-compile-x32.bin
:
235 $(CC
) -mx32
-o
$@ test-compile.c
237 $(OUTPUT
)test-zlib.bin
:
240 $(OUTPUT
)test-lzma.bin
:
243 $(OUTPUT
)test-get_cpuid.bin
:
246 $(OUTPUT
)test-bpf.bin
:
249 $(OUTPUT
)test-sdt.bin
:
252 $(OUTPUT
)test-cxx.bin
:
253 $(BUILDXX
) -std
=gnu
++11
255 $(OUTPUT
)test-jvmti.bin
:
258 $(OUTPUT
)test-llvm.bin
:
259 $(BUILDXX
) -std
=gnu
++11 \
260 -I
$(shell $(LLVM_CONFIG
) --includedir) \
261 -L
$(shell $(LLVM_CONFIG
) --libdir) \
262 $(shell $(LLVM_CONFIG
) --libs Core BPF
) \
263 $(shell $(LLVM_CONFIG
) --system-libs
) \
264 > $(@
:.bin
=.make.output
) 2>&1
266 $(OUTPUT
)test-llvm-version.bin
:
267 $(BUILDXX
) -std
=gnu
++11 \
268 -I
$(shell $(LLVM_CONFIG
) --includedir) \
269 > $(@
:.bin
=.make.output
) 2>&1
271 $(OUTPUT
)test-clang.bin
:
272 $(BUILDXX
) -std
=gnu
++11 \
273 -I
$(shell $(LLVM_CONFIG
) --includedir) \
274 -L
$(shell $(LLVM_CONFIG
) --libdir) \
275 -Wl
,--start-group
-lclangBasic
-lclangDriver \
276 -lclangFrontend
-lclangEdit
-lclangLex \
277 -lclangAST
-Wl
,--end-group \
278 $(shell $(LLVM_CONFIG
) --libs Core option
) \
279 $(shell $(LLVM_CONFIG
) --system-libs
) \
280 > $(@
:.bin
=.make.output
) 2>&1
282 -include $(OUTPUT
)*.d
284 ###############################
287 rm -f
$(FILES
) $(OUTPUT
)*.d
$(FILES
:.bin
=.make.output
)