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 \
17 test-reallocarray.bin \
20 test-cplus-demangle.bin \
22 test-libelf-getphdrnum.bin \
23 test-libelf-gelf_getnote.bin \
24 test-libelf-getshdrstrndx.bin \
25 test-libelf-mmap.bin \
27 test-numa_num_possible_cpus.bin \
30 test-libpython-version.bin \
34 test-libunwind-debug-frame.bin \
35 test-libunwind-x86.bin \
36 test-libunwind-x86_64.bin \
37 test-libunwind-arm.bin \
38 test-libunwind-aarch64.bin \
39 test-libunwind-debug-frame-arm.bin \
40 test-libunwind-debug-frame-aarch64.bin \
41 test-pthread-attr-setaffinity-np.bin \
42 test-pthread-barrier.bin \
43 test-stackprotector-all.bin \
45 test-libdw-dwarf-unwind.bin \
46 test-libbabeltrace.bin \
48 test-compile-x32.bin \
56 test-sched_getcpu.bin \
63 FILES
:= $(addprefix $(OUTPUT
),$(FILES
))
65 CC ?
= $(CROSS_COMPILE
)gcc
66 CXX ?
= $(CROSS_COMPILE
)g
++
67 PKG_CONFIG ?
= $(CROSS_COMPILE
)pkg-config
68 LLVM_CONFIG ?
= llvm-config
72 __BUILD
= $(CC
) $(CFLAGS
) -MD
-Wall
-Werror
-o
$@
$(patsubst %.bin
,%.c
,$(@F
)) $(LDFLAGS
)
73 BUILD
= $(__BUILD
) > $(@
:.bin
=.make.output
) 2>&1
75 __BUILDXX
= $(CXX
) $(CXXFLAGS
) -MD
-Wall
-Werror
-o
$@
$(patsubst %.bin
,%.
cpp,$(@F
)) $(LDFLAGS
)
76 BUILDXX
= $(__BUILDXX
) > $(@
:.bin
=.make.output
) 2>&1
78 ###############################
80 $(OUTPUT
)test-all.bin
:
81 $(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
83 $(OUTPUT
)test-hello.bin
:
86 $(OUTPUT
)test-pthread-attr-setaffinity-np.bin
:
87 $(BUILD
) -D_GNU_SOURCE
-lpthread
89 $(OUTPUT
)test-pthread-barrier.bin
:
92 $(OUTPUT
)test-stackprotector-all.bin
:
93 $(BUILD
) -fstack-protector-all
95 $(OUTPUT
)test-fortify-source.bin
:
96 $(BUILD
) -O2
-D_FORTIFY_SOURCE
=2
98 $(OUTPUT
)test-bionic.bin
:
101 $(OUTPUT
)test-libelf.bin
:
104 $(OUTPUT
)test-glibc.bin
:
107 $(OUTPUT
)test-sched_getcpu.bin
:
110 $(OUTPUT
)test-setns.bin
:
113 $(OUTPUT
)test-libopencsd.bin
:
114 $(BUILD
) # -lopencsd_c_api -lopencsd provided by
115 # $(FEATURE_CHECK_LDFLAGS-libopencsd)
118 ifeq ($(findstring -static
,${LDFLAGS}),-static
)
119 DWARFLIBS
+= -lelf
-lebl
-lz
-llzma
-lbz2
122 $(OUTPUT
)test-dwarf.bin
:
123 $(BUILD
) $(DWARFLIBS
)
125 $(OUTPUT
)test-dwarf_getlocations.bin
:
126 $(BUILD
) $(DWARFLIBS
)
128 $(OUTPUT
)test-libelf-mmap.bin
:
131 $(OUTPUT
)test-libelf-getphdrnum.bin
:
134 $(OUTPUT
)test-libelf-gelf_getnote.bin
:
137 $(OUTPUT
)test-libelf-getshdrstrndx.bin
:
140 $(OUTPUT
)test-libnuma.bin
:
143 $(OUTPUT
)test-numa_num_possible_cpus.bin
:
146 $(OUTPUT
)test-libunwind.bin
:
149 $(OUTPUT
)test-libunwind-debug-frame.bin
:
151 $(OUTPUT
)test-libunwind-x86.bin
:
152 $(BUILD
) -lelf
-lunwind-x86
154 $(OUTPUT
)test-libunwind-x86_64.bin
:
155 $(BUILD
) -lelf
-lunwind-x86_64
157 $(OUTPUT
)test-libunwind-arm.bin
:
158 $(BUILD
) -lelf
-lunwind-arm
160 $(OUTPUT
)test-libunwind-aarch64.bin
:
161 $(BUILD
) -lelf
-lunwind-aarch64
163 $(OUTPUT
)test-libunwind-debug-frame-arm.bin
:
164 $(BUILD
) -lelf
-lunwind-arm
166 $(OUTPUT
)test-libunwind-debug-frame-aarch64.bin
:
167 $(BUILD
) -lelf
-lunwind-aarch64
169 $(OUTPUT
)test-libaudit.bin
:
172 $(OUTPUT
)test-libslang.bin
:
173 $(BUILD
) -I
/usr
/include/slang
-lslang
175 $(OUTPUT
)test-libcrypto.bin
:
178 $(OUTPUT
)test-gtk2.bin
:
179 $(BUILD
) $(shell $(PKG_CONFIG
) --libs
--cflags gtk
+-2.0 2>/dev
/null
)
181 $(OUTPUT
)test-gtk2-infobar.bin
:
182 $(BUILD
) $(shell $(PKG_CONFIG
) --libs
--cflags gtk
+-2.0 2>/dev
/null
)
184 grep-libs
= $(filter -l
%,$(1))
185 strip-libs
= $(filter-out -l
%,$(1))
187 PERL_EMBED_LDOPTS
= $(shell perl
-MExtUtils
::Embed
-e ldopts
2>/dev
/null
)
188 PERL_EMBED_LDFLAGS
= $(call strip-libs
,$(PERL_EMBED_LDOPTS
))
189 PERL_EMBED_LIBADD
= $(call grep-libs
,$(PERL_EMBED_LDOPTS
))
190 PERL_EMBED_CCOPTS
= `perl -MExtUtils::Embed -e ccopts 2>/dev/null`
191 FLAGS_PERL_EMBED
=$(PERL_EMBED_CCOPTS
) $(PERL_EMBED_LDOPTS
)
193 $(OUTPUT
)test-libperl.bin
:
194 $(BUILD
) $(FLAGS_PERL_EMBED
)
196 $(OUTPUT
)test-libpython.bin
:
197 $(BUILD
) $(FLAGS_PYTHON_EMBED
)
199 $(OUTPUT
)test-libpython-version.bin
:
202 $(OUTPUT
)test-libbfd.bin
:
203 $(BUILD
) -DPACKAGE
='"perf"' -lbfd
-lz
-liberty
-ldl
205 $(OUTPUT
)test-disassembler-four-args.bin
:
206 $(BUILD
) -DPACKAGE
='"perf"' -lbfd
-lopcodes
208 $(OUTPUT
)test-reallocarray.bin
:
211 $(OUTPUT
)test-liberty.bin
:
212 $(CC
) $(CFLAGS
) -Wall
-Werror
-o
$@ test-libbfd.c
-DPACKAGE
='"perf"' $(LDFLAGS
) -lbfd
-ldl
-liberty
214 $(OUTPUT
)test-liberty-z.bin
:
215 $(CC
) $(CFLAGS
) -Wall
-Werror
-o
$@ test-libbfd.c
-DPACKAGE
='"perf"' $(LDFLAGS
) -lbfd
-ldl
-liberty
-lz
217 $(OUTPUT
)test-cplus-demangle.bin
:
220 $(OUTPUT
)test-backtrace.bin
:
223 $(OUTPUT
)test-timerfd.bin
:
226 $(OUTPUT
)test-libdw-dwarf-unwind.bin
:
227 $(BUILD
) # -ldw provided by $(FEATURE_CHECK_LDFLAGS-libdw-dwarf-unwind)
229 $(OUTPUT
)test-libbabeltrace.bin
:
230 $(BUILD
) # -lbabeltrace provided by $(FEATURE_CHECK_LDFLAGS-libbabeltrace)
232 $(OUTPUT
)test-sync-compare-and-swap.bin
:
235 $(OUTPUT
)test-compile-32.bin
:
236 $(CC
) -m32
-o
$@ test-compile.c
238 $(OUTPUT
)test-compile-x32.bin
:
239 $(CC
) -mx32
-o
$@ test-compile.c
241 $(OUTPUT
)test-zlib.bin
:
244 $(OUTPUT
)test-lzma.bin
:
247 $(OUTPUT
)test-get_cpuid.bin
:
250 $(OUTPUT
)test-bpf.bin
:
253 $(OUTPUT
)test-sdt.bin
:
256 $(OUTPUT
)test-cxx.bin
:
257 $(BUILDXX
) -std
=gnu
++11
259 $(OUTPUT
)test-jvmti.bin
:
262 $(OUTPUT
)test-llvm.bin
:
263 $(BUILDXX
) -std
=gnu
++11 \
264 -I
$(shell $(LLVM_CONFIG
) --includedir) \
265 -L
$(shell $(LLVM_CONFIG
) --libdir) \
266 $(shell $(LLVM_CONFIG
) --libs Core BPF
) \
267 $(shell $(LLVM_CONFIG
) --system-libs
) \
268 > $(@
:.bin
=.make.output
) 2>&1
270 $(OUTPUT
)test-llvm-version.bin
:
271 $(BUILDXX
) -std
=gnu
++11 \
272 -I
$(shell $(LLVM_CONFIG
) --includedir) \
273 > $(@
:.bin
=.make.output
) 2>&1
275 $(OUTPUT
)test-clang.bin
:
276 $(BUILDXX
) -std
=gnu
++11 \
277 -I
$(shell $(LLVM_CONFIG
) --includedir) \
278 -L
$(shell $(LLVM_CONFIG
) --libdir) \
279 -Wl
,--start-group
-lclangBasic
-lclangDriver \
280 -lclangFrontend
-lclangEdit
-lclangLex \
281 -lclangAST
-Wl
,--end-group \
282 $(shell $(LLVM_CONFIG
) --libs Core option
) \
283 $(shell $(LLVM_CONFIG
) --system-libs
) \
284 > $(@
:.bin
=.make.output
) 2>&1
286 -include $(OUTPUT
)*.d
288 ###############################
291 rm -f
$(FILES
) $(OUTPUT
)*.d
$(FILES
:.bin
=.make.output
)