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 \
18 test-cplus-demangle.bin \
20 test-libelf-getphdrnum.bin \
21 test-libelf-gelf_getnote.bin \
22 test-libelf-getshdrstrndx.bin \
23 test-libelf-mmap.bin \
25 test-numa_num_possible_cpus.bin \
28 test-libpython-version.bin \
32 test-libunwind-debug-frame.bin \
33 test-libunwind-x86.bin \
34 test-libunwind-x86_64.bin \
35 test-libunwind-arm.bin \
36 test-libunwind-aarch64.bin \
37 test-libunwind-debug-frame-arm.bin \
38 test-libunwind-debug-frame-aarch64.bin \
39 test-pthread-attr-setaffinity-np.bin \
40 test-stackprotector-all.bin \
42 test-libdw-dwarf-unwind.bin \
43 test-libbabeltrace.bin \
45 test-compile-x32.bin \
53 test-sched_getcpu.bin \
56 FILES
:= $(addprefix $(OUTPUT
),$(FILES
))
58 CC ?
= $(CROSS_COMPILE
)gcc
59 CXX ?
= $(CROSS_COMPILE
)g
++
60 PKG_CONFIG ?
= $(CROSS_COMPILE
)pkg-config
61 LLVM_CONFIG ?
= llvm-config
65 __BUILD
= $(CC
) $(CFLAGS
) -MD
-Wall
-Werror
-o
$@
$(patsubst %.bin
,%.c
,$(@F
)) $(LDFLAGS
)
66 BUILD
= $(__BUILD
) > $(@
:.bin
=.make.output
) 2>&1
68 __BUILDXX
= $(CXX
) $(CXXFLAGS
) -MD
-Wall
-Werror
-o
$@
$(patsubst %.bin
,%.
cpp,$(@F
)) $(LDFLAGS
)
69 BUILDXX
= $(__BUILDXX
) > $(@
:.bin
=.make.output
) 2>&1
71 ###############################
73 $(OUTPUT
)test-all.bin
:
74 $(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
76 $(OUTPUT
)test-hello.bin
:
79 $(OUTPUT
)test-pthread-attr-setaffinity-np.bin
:
80 $(BUILD
) -D_GNU_SOURCE
-lpthread
82 $(OUTPUT
)test-stackprotector-all.bin
:
83 $(BUILD
) -fstack-protector-all
85 $(OUTPUT
)test-fortify-source.bin
:
86 $(BUILD
) -O2
-D_FORTIFY_SOURCE
=2
88 $(OUTPUT
)test-bionic.bin
:
91 $(OUTPUT
)test-libelf.bin
:
94 $(OUTPUT
)test-glibc.bin
:
97 $(OUTPUT
)test-sched_getcpu.bin
:
100 $(OUTPUT
)test-setns.bin
:
104 ifeq ($(findstring -static
,${LDFLAGS}),-static
)
105 DWARFLIBS
+= -lelf
-lebl
-lz
-llzma
-lbz2
108 $(OUTPUT
)test-dwarf.bin
:
109 $(BUILD
) $(DWARFLIBS
)
111 $(OUTPUT
)test-dwarf_getlocations.bin
:
112 $(BUILD
) $(DWARFLIBS
)
114 $(OUTPUT
)test-libelf-mmap.bin
:
117 $(OUTPUT
)test-libelf-getphdrnum.bin
:
120 $(OUTPUT
)test-libelf-gelf_getnote.bin
:
123 $(OUTPUT
)test-libelf-getshdrstrndx.bin
:
126 $(OUTPUT
)test-libnuma.bin
:
129 $(OUTPUT
)test-numa_num_possible_cpus.bin
:
132 $(OUTPUT
)test-libunwind.bin
:
135 $(OUTPUT
)test-libunwind-debug-frame.bin
:
137 $(OUTPUT
)test-libunwind-x86.bin
:
138 $(BUILD
) -lelf
-lunwind-x86
140 $(OUTPUT
)test-libunwind-x86_64.bin
:
141 $(BUILD
) -lelf
-lunwind-x86_64
143 $(OUTPUT
)test-libunwind-arm.bin
:
144 $(BUILD
) -lelf
-lunwind-arm
146 $(OUTPUT
)test-libunwind-aarch64.bin
:
147 $(BUILD
) -lelf
-lunwind-aarch64
149 $(OUTPUT
)test-libunwind-debug-frame-arm.bin
:
150 $(BUILD
) -lelf
-lunwind-arm
152 $(OUTPUT
)test-libunwind-debug-frame-aarch64.bin
:
153 $(BUILD
) -lelf
-lunwind-aarch64
155 $(OUTPUT
)test-libaudit.bin
:
158 $(OUTPUT
)test-libslang.bin
:
159 $(BUILD
) -I
/usr
/include/slang
-lslang
161 $(OUTPUT
)test-libcrypto.bin
:
164 $(OUTPUT
)test-gtk2.bin
:
165 $(BUILD
) $(shell $(PKG_CONFIG
) --libs
--cflags gtk
+-2.0 2>/dev
/null
)
167 $(OUTPUT
)test-gtk2-infobar.bin
:
168 $(BUILD
) $(shell $(PKG_CONFIG
) --libs
--cflags gtk
+-2.0 2>/dev
/null
)
170 grep-libs
= $(filter -l
%,$(1))
171 strip-libs
= $(filter-out -l
%,$(1))
173 PERL_EMBED_LDOPTS
= $(shell perl
-MExtUtils
::Embed
-e ldopts
2>/dev
/null
)
174 PERL_EMBED_LDFLAGS
= $(call strip-libs
,$(PERL_EMBED_LDOPTS
))
175 PERL_EMBED_LIBADD
= $(call grep-libs
,$(PERL_EMBED_LDOPTS
))
176 PERL_EMBED_CCOPTS
= `perl -MExtUtils::Embed -e ccopts 2>/dev/null`
177 FLAGS_PERL_EMBED
=$(PERL_EMBED_CCOPTS
) $(PERL_EMBED_LDOPTS
)
179 $(OUTPUT
)test-libperl.bin
:
180 $(BUILD
) $(FLAGS_PERL_EMBED
)
182 $(OUTPUT
)test-libpython.bin
:
183 $(BUILD
) $(FLAGS_PYTHON_EMBED
)
185 $(OUTPUT
)test-libpython-version.bin
:
188 $(OUTPUT
)test-libbfd.bin
:
189 $(BUILD
) -DPACKAGE
='"perf"' -lbfd
-lz
-liberty
-ldl
191 $(OUTPUT
)test-liberty.bin
:
192 $(CC
) $(CFLAGS
) -Wall
-Werror
-o
$@ test-libbfd.c
-DPACKAGE
='"perf"' $(LDFLAGS
) -lbfd
-ldl
-liberty
194 $(OUTPUT
)test-liberty-z.bin
:
195 $(CC
) $(CFLAGS
) -Wall
-Werror
-o
$@ test-libbfd.c
-DPACKAGE
='"perf"' $(LDFLAGS
) -lbfd
-ldl
-liberty
-lz
197 $(OUTPUT
)test-cplus-demangle.bin
:
200 $(OUTPUT
)test-backtrace.bin
:
203 $(OUTPUT
)test-timerfd.bin
:
206 $(OUTPUT
)test-libdw-dwarf-unwind.bin
:
207 $(BUILD
) # -ldw provided by $(FEATURE_CHECK_LDFLAGS-libdw-dwarf-unwind)
209 $(OUTPUT
)test-libbabeltrace.bin
:
210 $(BUILD
) # -lbabeltrace provided by $(FEATURE_CHECK_LDFLAGS-libbabeltrace)
212 $(OUTPUT
)test-sync-compare-and-swap.bin
:
215 $(OUTPUT
)test-compile-32.bin
:
216 $(CC
) -m32
-o
$@ test-compile.c
218 $(OUTPUT
)test-compile-x32.bin
:
219 $(CC
) -mx32
-o
$@ test-compile.c
221 $(OUTPUT
)test-zlib.bin
:
224 $(OUTPUT
)test-lzma.bin
:
227 $(OUTPUT
)test-get_cpuid.bin
:
230 $(OUTPUT
)test-bpf.bin
:
233 $(OUTPUT
)test-sdt.bin
:
236 $(OUTPUT
)test-cxx.bin
:
237 $(BUILDXX
) -std
=gnu
++11
239 $(OUTPUT
)test-jvmti.bin
:
242 $(OUTPUT
)test-llvm.bin
:
243 $(BUILDXX
) -std
=gnu
++11 \
244 -I
$(shell $(LLVM_CONFIG
) --includedir) \
245 -L
$(shell $(LLVM_CONFIG
) --libdir) \
246 $(shell $(LLVM_CONFIG
) --libs Core BPF
) \
247 $(shell $(LLVM_CONFIG
) --system-libs
)
249 $(OUTPUT
)test-llvm-version.bin
:
250 $(BUILDXX
) -std
=gnu
++11 \
251 -I
$(shell $(LLVM_CONFIG
) --includedir)
253 $(OUTPUT
)test-clang.bin
:
254 $(BUILDXX
) -std
=gnu
++11 \
255 -I
$(shell $(LLVM_CONFIG
) --includedir) \
256 -L
$(shell $(LLVM_CONFIG
) --libdir) \
257 -Wl
,--start-group
-lclangBasic
-lclangDriver \
258 -lclangFrontend
-lclangEdit
-lclangLex \
259 -lclangAST
-Wl
,--end-group \
260 $(shell $(LLVM_CONFIG
) --libs Core option
) \
261 $(shell $(LLVM_CONFIG
) --system-libs
)
263 -include $(OUTPUT
)*.d
265 ###############################
268 rm -f
$(FILES
) $(OUTPUT
)*.d
$(FILES
:.bin
=.make.output
)