6 test-dwarf_getlocations.bin \
7 test-fortify-source.bin \
8 test-sync-compare-and-swap.bin \
11 test-gtk2-infobar.bin \
17 test-cplus-demangle.bin \
19 test-libelf-getphdrnum.bin \
20 test-libelf-gelf_getnote.bin \
21 test-libelf-getshdrstrndx.bin \
22 test-libelf-mmap.bin \
24 test-numa_num_possible_cpus.bin \
27 test-libpython-version.bin \
31 test-libunwind-debug-frame.bin \
32 test-libunwind-x86.bin \
33 test-libunwind-x86_64.bin \
34 test-libunwind-arm.bin \
35 test-libunwind-aarch64.bin \
36 test-libunwind-debug-frame-arm.bin \
37 test-libunwind-debug-frame-aarch64.bin \
38 test-pthread-attr-setaffinity-np.bin \
39 test-stackprotector-all.bin \
41 test-libdw-dwarf-unwind.bin \
42 test-libbabeltrace.bin \
44 test-compile-x32.bin \
53 FILES := $(addprefix $(OUTPUT),$(FILES))
55 CC := $(CROSS_COMPILE)gcc -MD
56 CXX := $(CROSS_COMPILE)g++ -MD
57 PKG_CONFIG := $(CROSS_COMPILE)pkg-config
58 LLVM_CONFIG ?= llvm-config
62 __BUILD = $(CC) $(CFLAGS) -Wall -Werror -o $@ $(patsubst %.bin,%.c,$(@F)) $(LDFLAGS)
63 BUILD = $(__BUILD) > $(@:.bin=.make.output) 2>&1
65 __BUILDXX = $(CXX) $(CXXFLAGS) -Wall -Werror -o $@ $(patsubst %.bin,%.cpp,$(@F)) $(LDFLAGS)
66 BUILDXX = $(__BUILDXX) > $(@:.bin=.make.output) 2>&1
68 ###############################
70 $(OUTPUT)test-all.bin:
71 $(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
73 $(OUTPUT)test-hello.bin:
76 $(OUTPUT)test-pthread-attr-setaffinity-np.bin:
77 $(BUILD) -D_GNU_SOURCE -lpthread
79 $(OUTPUT)test-stackprotector-all.bin:
80 $(BUILD) -fstack-protector-all
82 $(OUTPUT)test-fortify-source.bin:
83 $(BUILD) -O2 -D_FORTIFY_SOURCE=2
85 $(OUTPUT)test-bionic.bin:
88 $(OUTPUT)test-libelf.bin:
91 $(OUTPUT)test-glibc.bin:
95 ifeq ($(findstring -static,${LDFLAGS}),-static)
96 DWARFLIBS += -lelf -lebl -lz -llzma -lbz2
99 $(OUTPUT)test-dwarf.bin:
100 $(BUILD) $(DWARFLIBS)
102 $(OUTPUT)test-dwarf_getlocations.bin:
103 $(BUILD) $(DWARFLIBS)
105 $(OUTPUT)test-libelf-mmap.bin:
108 $(OUTPUT)test-libelf-getphdrnum.bin:
111 $(OUTPUT)test-libelf-gelf_getnote.bin:
114 $(OUTPUT)test-libelf-getshdrstrndx.bin:
117 $(OUTPUT)test-libnuma.bin:
120 $(OUTPUT)test-numa_num_possible_cpus.bin:
123 $(OUTPUT)test-libunwind.bin:
126 $(OUTPUT)test-libunwind-debug-frame.bin:
128 $(OUTPUT)test-libunwind-x86.bin:
129 $(BUILD) -lelf -lunwind-x86
131 $(OUTPUT)test-libunwind-x86_64.bin:
132 $(BUILD) -lelf -lunwind-x86_64
134 $(OUTPUT)test-libunwind-arm.bin:
135 $(BUILD) -lelf -lunwind-arm
137 $(OUTPUT)test-libunwind-aarch64.bin:
138 $(BUILD) -lelf -lunwind-aarch64
140 $(OUTPUT)test-libunwind-debug-frame-arm.bin:
141 $(BUILD) -lelf -lunwind-arm
143 $(OUTPUT)test-libunwind-debug-frame-aarch64.bin:
144 $(BUILD) -lelf -lunwind-aarch64
146 $(OUTPUT)test-libaudit.bin:
149 $(OUTPUT)test-libslang.bin:
150 $(BUILD) -I/usr/include/slang -lslang
152 $(OUTPUT)test-libcrypto.bin:
155 $(OUTPUT)test-gtk2.bin:
156 $(BUILD) $(shell $(PKG_CONFIG) --libs --cflags gtk+-2.0 2>/dev/null)
158 $(OUTPUT)test-gtk2-infobar.bin:
159 $(BUILD) $(shell $(PKG_CONFIG) --libs --cflags gtk+-2.0 2>/dev/null)
161 grep-libs = $(filter -l%,$(1))
162 strip-libs = $(filter-out -l%,$(1))
164 PERL_EMBED_LDOPTS = $(shell perl -MExtUtils::Embed -e ldopts 2>/dev/null)
165 PERL_EMBED_LDFLAGS = $(call strip-libs,$(PERL_EMBED_LDOPTS))
166 PERL_EMBED_LIBADD = $(call grep-libs,$(PERL_EMBED_LDOPTS))
167 PERL_EMBED_CCOPTS = `perl -MExtUtils::Embed -e ccopts 2>/dev/null`
168 FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS)
170 $(OUTPUT)test-libperl.bin:
171 $(BUILD) $(FLAGS_PERL_EMBED)
173 $(OUTPUT)test-libpython.bin:
176 $(OUTPUT)test-libpython-version.bin:
179 $(OUTPUT)test-libbfd.bin:
180 $(BUILD) -DPACKAGE='"perf"' -lbfd -lz -liberty -ldl
182 $(OUTPUT)test-liberty.bin:
183 $(CC) $(CFLAGS) -Wall -Werror -o $@ test-libbfd.c -DPACKAGE='"perf"' $(LDFLAGS) -lbfd -ldl -liberty
185 $(OUTPUT)test-liberty-z.bin:
186 $(CC) $(CFLAGS) -Wall -Werror -o $@ test-libbfd.c -DPACKAGE='"perf"' $(LDFLAGS) -lbfd -ldl -liberty -lz
188 $(OUTPUT)test-cplus-demangle.bin:
191 $(OUTPUT)test-backtrace.bin:
194 $(OUTPUT)test-timerfd.bin:
197 $(OUTPUT)test-libdw-dwarf-unwind.bin:
198 $(BUILD) # -ldw provided by $(FEATURE_CHECK_LDFLAGS-libdw-dwarf-unwind)
200 $(OUTPUT)test-libbabeltrace.bin:
201 $(BUILD) # -lbabeltrace provided by $(FEATURE_CHECK_LDFLAGS-libbabeltrace)
203 $(OUTPUT)test-sync-compare-and-swap.bin:
206 $(OUTPUT)test-compile-32.bin:
207 $(CC) -m32 -o $@ test-compile.c
209 $(OUTPUT)test-compile-x32.bin:
210 $(CC) -mx32 -o $@ test-compile.c
212 $(OUTPUT)test-zlib.bin:
215 $(OUTPUT)test-lzma.bin:
218 $(OUTPUT)test-get_cpuid.bin:
221 $(OUTPUT)test-bpf.bin:
224 $(OUTPUT)test-sdt.bin:
227 $(OUTPUT)test-cxx.bin:
228 $(BUILDXX) -std=gnu++11
230 $(OUTPUT)test-jvmti.bin:
233 $(OUTPUT)test-llvm.bin:
234 $(BUILDXX) -std=gnu++11 \
235 -I$(shell $(LLVM_CONFIG) --includedir) \
236 -L$(shell $(LLVM_CONFIG) --libdir) \
237 $(shell $(LLVM_CONFIG) --libs Core BPF) \
238 $(shell $(LLVM_CONFIG) --system-libs)
240 $(OUTPUT)test-clang.bin:
241 $(BUILDXX) -std=gnu++11 \
242 -I$(shell $(LLVM_CONFIG) --includedir) \
243 -L$(shell $(LLVM_CONFIG) --libdir) \
244 -Wl,--start-group -lclangBasic -lclangDriver \
245 -lclangFrontend -lclangEdit -lclangLex \
246 -lclangAST -Wl,--end-group \
247 $(shell $(LLVM_CONFIG) --libs Core option) \
248 $(shell $(LLVM_CONFIG) --system-libs)
250 -include $(OUTPUT)*.d
252 ###############################
255 rm -f $(FILES) $(OUTPUT)*.d $(FILES:.bin=.make.output)