Linux 5.7.7
[linux/fpc-iii.git] / tools / build / feature / Makefile
blob92012381393ad97e72c4eec27f56c691edec7bac
1 # SPDX-License-Identifier: GPL-2.0
2 FILES= \
3 test-all.bin \
4 test-backtrace.bin \
5 test-bionic.bin \
6 test-dwarf.bin \
7 test-dwarf_getlocations.bin \
8 test-eventfd.bin \
9 test-fortify-source.bin \
10 test-sync-compare-and-swap.bin \
11 test-get_current_dir_name.bin \
12 test-glibc.bin \
13 test-gtk2.bin \
14 test-gtk2-infobar.bin \
15 test-hello.bin \
16 test-libaudit.bin \
17 test-libbfd.bin \
18 test-disassembler-four-args.bin \
19 test-reallocarray.bin \
20 test-libbfd-liberty.bin \
21 test-libbfd-liberty-z.bin \
22 test-cplus-demangle.bin \
23 test-libcap.bin \
24 test-libelf.bin \
25 test-libelf-getphdrnum.bin \
26 test-libelf-gelf_getnote.bin \
27 test-libelf-getshdrstrndx.bin \
28 test-libelf-mmap.bin \
29 test-libnuma.bin \
30 test-numa_num_possible_cpus.bin \
31 test-libperl.bin \
32 test-libpython.bin \
33 test-libpython-version.bin \
34 test-libslang.bin \
35 test-libslang-include-subdir.bin \
36 test-libcrypto.bin \
37 test-libunwind.bin \
38 test-libunwind-debug-frame.bin \
39 test-libunwind-x86.bin \
40 test-libunwind-x86_64.bin \
41 test-libunwind-arm.bin \
42 test-libunwind-aarch64.bin \
43 test-libunwind-debug-frame-arm.bin \
44 test-libunwind-debug-frame-aarch64.bin \
45 test-pthread-attr-setaffinity-np.bin \
46 test-pthread-barrier.bin \
47 test-stackprotector-all.bin \
48 test-timerfd.bin \
49 test-libdw-dwarf-unwind.bin \
50 test-libbabeltrace.bin \
51 test-compile-32.bin \
52 test-compile-x32.bin \
53 test-zlib.bin \
54 test-lzma.bin \
55 test-bpf.bin \
56 test-libbpf.bin \
57 test-get_cpuid.bin \
58 test-sdt.bin \
59 test-cxx.bin \
60 test-gettid.bin \
61 test-jvmti.bin \
62 test-jvmti-cmlr.bin \
63 test-sched_getcpu.bin \
64 test-setns.bin \
65 test-libopencsd.bin \
66 test-clang.bin \
67 test-llvm.bin \
68 test-llvm-version.bin \
69 test-libaio.bin \
70 test-libzstd.bin \
71 test-clang-bpf-global-var.bin \
72 test-file-handle.bin
74 FILES := $(addprefix $(OUTPUT),$(FILES))
76 CC ?= $(CROSS_COMPILE)gcc
77 CXX ?= $(CROSS_COMPILE)g++
78 PKG_CONFIG ?= $(CROSS_COMPILE)pkg-config
79 LLVM_CONFIG ?= llvm-config
80 CLANG ?= clang
82 all: $(FILES)
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 -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
95 $(OUTPUT)test-hello.bin:
96 $(BUILD)
98 $(OUTPUT)test-pthread-attr-setaffinity-np.bin:
99 $(BUILD) -D_GNU_SOURCE -lpthread
101 $(OUTPUT)test-pthread-barrier.bin:
102 $(BUILD) -lpthread
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:
111 $(BUILD)
113 $(OUTPUT)test-libcap.bin:
114 $(BUILD) -lcap
116 $(OUTPUT)test-libelf.bin:
117 $(BUILD) -lelf
119 $(OUTPUT)test-eventfd.bin:
120 $(BUILD)
122 $(OUTPUT)test-get_current_dir_name.bin:
123 $(BUILD)
125 $(OUTPUT)test-glibc.bin:
126 $(BUILD)
128 $(OUTPUT)test-sched_getcpu.bin:
129 $(BUILD)
131 $(OUTPUT)test-setns.bin:
132 $(BUILD)
134 $(OUTPUT)test-libopencsd.bin:
135 $(BUILD) # -lopencsd_c_api -lopencsd provided by
136 # $(FEATURE_CHECK_LDFLAGS-libopencsd)
138 DWARFLIBS := -ldw
139 ifeq ($(findstring -static,${LDFLAGS}),-static)
140 DWARFLIBS += -lelf -lebl -lz -llzma -lbz2
141 endif
143 $(OUTPUT)test-dwarf.bin:
144 $(BUILD) $(DWARFLIBS)
146 $(OUTPUT)test-dwarf_getlocations.bin:
147 $(BUILD) $(DWARFLIBS)
149 $(OUTPUT)test-libelf-mmap.bin:
150 $(BUILD) -lelf
152 $(OUTPUT)test-libelf-getphdrnum.bin:
153 $(BUILD) -lelf
155 $(OUTPUT)test-libelf-gelf_getnote.bin:
156 $(BUILD) -lelf
158 $(OUTPUT)test-libelf-getshdrstrndx.bin:
159 $(BUILD) -lelf
161 $(OUTPUT)test-libnuma.bin:
162 $(BUILD) -lnuma
164 $(OUTPUT)test-numa_num_possible_cpus.bin:
165 $(BUILD) -lnuma
167 $(OUTPUT)test-libunwind.bin:
168 $(BUILD) -lelf
170 $(OUTPUT)test-libunwind-debug-frame.bin:
171 $(BUILD) -lelf
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:
191 $(BUILD) -laudit
193 $(OUTPUT)test-libslang.bin:
194 $(BUILD) -lslang
196 $(OUTPUT)test-libslang-include-subdir.bin:
197 $(BUILD) -lslang
199 $(OUTPUT)test-libcrypto.bin:
200 $(BUILD) -lcrypto
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:
224 $(BUILD)
226 $(OUTPUT)test-libbfd.bin:
227 $(BUILD) -DPACKAGE='"perf"' -lbfd -ldl
229 $(OUTPUT)test-disassembler-four-args.bin:
230 $(BUILD) -DPACKAGE='"perf"' -lbfd -lopcodes
232 $(OUTPUT)test-reallocarray.bin:
233 $(BUILD)
235 $(OUTPUT)test-libbfd-liberty.bin:
236 $(CC) $(CFLAGS) -Wall -Werror -o $@ test-libbfd.c -DPACKAGE='"perf"' $(LDFLAGS) -lbfd -ldl -liberty
238 $(OUTPUT)test-libbfd-liberty-z.bin:
239 $(CC) $(CFLAGS) -Wall -Werror -o $@ test-libbfd.c -DPACKAGE='"perf"' $(LDFLAGS) -lbfd -ldl -liberty -lz
241 $(OUTPUT)test-cplus-demangle.bin:
242 $(BUILD) -liberty
244 $(OUTPUT)test-backtrace.bin:
245 $(BUILD)
247 $(OUTPUT)test-timerfd.bin:
248 $(BUILD)
250 $(OUTPUT)test-libdw-dwarf-unwind.bin:
251 $(BUILD) # -ldw provided by $(FEATURE_CHECK_LDFLAGS-libdw-dwarf-unwind)
253 $(OUTPUT)test-libbabeltrace.bin:
254 $(BUILD) # -lbabeltrace provided by $(FEATURE_CHECK_LDFLAGS-libbabeltrace)
256 $(OUTPUT)test-sync-compare-and-swap.bin:
257 $(BUILD)
259 $(OUTPUT)test-compile-32.bin:
260 $(CC) -m32 -o $@ test-compile.c
262 $(OUTPUT)test-compile-x32.bin:
263 $(CC) -mx32 -o $@ test-compile.c
265 $(OUTPUT)test-zlib.bin:
266 $(BUILD) -lz
268 $(OUTPUT)test-lzma.bin:
269 $(BUILD) -llzma
271 $(OUTPUT)test-get_cpuid.bin:
272 $(BUILD)
274 $(OUTPUT)test-bpf.bin:
275 $(BUILD)
277 $(OUTPUT)test-libbpf.bin:
278 $(BUILD) -lbpf
280 $(OUTPUT)test-sdt.bin:
281 $(BUILD)
283 $(OUTPUT)test-cxx.bin:
284 $(BUILDXX) -std=gnu++11
286 $(OUTPUT)test-gettid.bin:
287 $(BUILD)
289 $(OUTPUT)test-jvmti.bin:
290 $(BUILD)
292 $(OUTPUT)test-jvmti-cmlr.bin:
293 $(BUILD)
295 $(OUTPUT)test-llvm.bin:
296 $(BUILDXX) -std=gnu++11 \
297 -I$(shell $(LLVM_CONFIG) --includedir) \
298 -L$(shell $(LLVM_CONFIG) --libdir) \
299 $(shell $(LLVM_CONFIG) --libs Core BPF) \
300 $(shell $(LLVM_CONFIG) --system-libs) \
301 > $(@:.bin=.make.output) 2>&1
303 $(OUTPUT)test-llvm-version.bin:
304 $(BUILDXX) -std=gnu++11 \
305 -I$(shell $(LLVM_CONFIG) --includedir) \
306 > $(@:.bin=.make.output) 2>&1
308 $(OUTPUT)test-clang.bin:
309 $(BUILDXX) -std=gnu++11 \
310 -I$(shell $(LLVM_CONFIG) --includedir) \
311 -L$(shell $(LLVM_CONFIG) --libdir) \
312 -Wl,--start-group -lclangBasic -lclangDriver \
313 -lclangFrontend -lclangEdit -lclangLex \
314 -lclangAST -Wl,--end-group \
315 $(shell $(LLVM_CONFIG) --libs Core option) \
316 $(shell $(LLVM_CONFIG) --system-libs) \
317 > $(@:.bin=.make.output) 2>&1
319 -include $(OUTPUT)*.d
321 $(OUTPUT)test-libaio.bin:
322 $(BUILD) -lrt
324 $(OUTPUT)test-libzstd.bin:
325 $(BUILD) -lzstd
327 $(OUTPUT)test-clang-bpf-global-var.bin:
328 $(CLANG) -S -g -target bpf -o - $(patsubst %.bin,%.c,$(@F)) | \
329 grep BTF_KIND_VAR
331 $(OUTPUT)test-file-handle.bin:
332 $(BUILD)
334 ###############################
336 clean:
337 rm -f $(FILES) $(OUTPUT)*.d $(FILES:.bin=.make.output)