Merge branch 'locking-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
[cris-mirror.git] / tools / build / feature / Makefile
blob0a490cb1514916faf5f7e21ea3ab30870bd085d0
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-fortify-source.bin \
9 test-sync-compare-and-swap.bin \
10 test-glibc.bin \
11 test-gtk2.bin \
12 test-gtk2-infobar.bin \
13 test-hello.bin \
14 test-libaudit.bin \
15 test-libbfd.bin \
16 test-disassembler-four-args.bin \
17 test-liberty.bin \
18 test-liberty-z.bin \
19 test-cplus-demangle.bin \
20 test-libelf.bin \
21 test-libelf-getphdrnum.bin \
22 test-libelf-gelf_getnote.bin \
23 test-libelf-getshdrstrndx.bin \
24 test-libelf-mmap.bin \
25 test-libnuma.bin \
26 test-numa_num_possible_cpus.bin \
27 test-libperl.bin \
28 test-libpython.bin \
29 test-libpython-version.bin \
30 test-libslang.bin \
31 test-libcrypto.bin \
32 test-libunwind.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 \
43 test-timerfd.bin \
44 test-libdw-dwarf-unwind.bin \
45 test-libbabeltrace.bin \
46 test-compile-32.bin \
47 test-compile-x32.bin \
48 test-zlib.bin \
49 test-lzma.bin \
50 test-bpf.bin \
51 test-get_cpuid.bin \
52 test-sdt.bin \
53 test-cxx.bin \
54 test-jvmti.bin \
55 test-sched_getcpu.bin \
56 test-setns.bin \
57 test-libopencsd.bin
59 FILES := $(addprefix $(OUTPUT),$(FILES))
61 CC ?= $(CROSS_COMPILE)gcc
62 CXX ?= $(CROSS_COMPILE)g++
63 PKG_CONFIG ?= $(CROSS_COMPILE)pkg-config
64 LLVM_CONFIG ?= llvm-config
66 all: $(FILES)
68 __BUILD = $(CC) $(CFLAGS) -MD -Wall -Werror -o $@ $(patsubst %.bin,%.c,$(@F)) $(LDFLAGS)
69 BUILD = $(__BUILD) > $(@:.bin=.make.output) 2>&1
71 __BUILDXX = $(CXX) $(CXXFLAGS) -MD -Wall -Werror -o $@ $(patsubst %.bin,%.cpp,$(@F)) $(LDFLAGS)
72 BUILDXX = $(__BUILDXX) > $(@:.bin=.make.output) 2>&1
74 ###############################
76 $(OUTPUT)test-all.bin:
77 $(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
79 $(OUTPUT)test-hello.bin:
80 $(BUILD)
82 $(OUTPUT)test-pthread-attr-setaffinity-np.bin:
83 $(BUILD) -D_GNU_SOURCE -lpthread
85 $(OUTPUT)test-pthread-barrier.bin:
86 $(BUILD) -lpthread
88 $(OUTPUT)test-stackprotector-all.bin:
89 $(BUILD) -fstack-protector-all
91 $(OUTPUT)test-fortify-source.bin:
92 $(BUILD) -O2 -D_FORTIFY_SOURCE=2
94 $(OUTPUT)test-bionic.bin:
95 $(BUILD)
97 $(OUTPUT)test-libelf.bin:
98 $(BUILD) -lelf
100 $(OUTPUT)test-glibc.bin:
101 $(BUILD)
103 $(OUTPUT)test-sched_getcpu.bin:
104 $(BUILD)
106 $(OUTPUT)test-setns.bin:
107 $(BUILD)
109 $(OUTPUT)test-libopencsd.bin:
110 $(BUILD) # -lopencsd_c_api -lopencsd provided by
111 # $(FEATURE_CHECK_LDFLAGS-libopencsd)
113 DWARFLIBS := -ldw
114 ifeq ($(findstring -static,${LDFLAGS}),-static)
115 DWARFLIBS += -lelf -lebl -lz -llzma -lbz2
116 endif
118 $(OUTPUT)test-dwarf.bin:
119 $(BUILD) $(DWARFLIBS)
121 $(OUTPUT)test-dwarf_getlocations.bin:
122 $(BUILD) $(DWARFLIBS)
124 $(OUTPUT)test-libelf-mmap.bin:
125 $(BUILD) -lelf
127 $(OUTPUT)test-libelf-getphdrnum.bin:
128 $(BUILD) -lelf
130 $(OUTPUT)test-libelf-gelf_getnote.bin:
131 $(BUILD) -lelf
133 $(OUTPUT)test-libelf-getshdrstrndx.bin:
134 $(BUILD) -lelf
136 $(OUTPUT)test-libnuma.bin:
137 $(BUILD) -lnuma
139 $(OUTPUT)test-numa_num_possible_cpus.bin:
140 $(BUILD) -lnuma
142 $(OUTPUT)test-libunwind.bin:
143 $(BUILD) -lelf
145 $(OUTPUT)test-libunwind-debug-frame.bin:
146 $(BUILD) -lelf
147 $(OUTPUT)test-libunwind-x86.bin:
148 $(BUILD) -lelf -lunwind-x86
150 $(OUTPUT)test-libunwind-x86_64.bin:
151 $(BUILD) -lelf -lunwind-x86_64
153 $(OUTPUT)test-libunwind-arm.bin:
154 $(BUILD) -lelf -lunwind-arm
156 $(OUTPUT)test-libunwind-aarch64.bin:
157 $(BUILD) -lelf -lunwind-aarch64
159 $(OUTPUT)test-libunwind-debug-frame-arm.bin:
160 $(BUILD) -lelf -lunwind-arm
162 $(OUTPUT)test-libunwind-debug-frame-aarch64.bin:
163 $(BUILD) -lelf -lunwind-aarch64
165 $(OUTPUT)test-libaudit.bin:
166 $(BUILD) -laudit
168 $(OUTPUT)test-libslang.bin:
169 $(BUILD) -I/usr/include/slang -lslang
171 $(OUTPUT)test-libcrypto.bin:
172 $(BUILD) -lcrypto
174 $(OUTPUT)test-gtk2.bin:
175 $(BUILD) $(shell $(PKG_CONFIG) --libs --cflags gtk+-2.0 2>/dev/null)
177 $(OUTPUT)test-gtk2-infobar.bin:
178 $(BUILD) $(shell $(PKG_CONFIG) --libs --cflags gtk+-2.0 2>/dev/null)
180 grep-libs = $(filter -l%,$(1))
181 strip-libs = $(filter-out -l%,$(1))
183 PERL_EMBED_LDOPTS = $(shell perl -MExtUtils::Embed -e ldopts 2>/dev/null)
184 PERL_EMBED_LDFLAGS = $(call strip-libs,$(PERL_EMBED_LDOPTS))
185 PERL_EMBED_LIBADD = $(call grep-libs,$(PERL_EMBED_LDOPTS))
186 PERL_EMBED_CCOPTS = `perl -MExtUtils::Embed -e ccopts 2>/dev/null`
187 FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS)
189 $(OUTPUT)test-libperl.bin:
190 $(BUILD) $(FLAGS_PERL_EMBED)
192 $(OUTPUT)test-libpython.bin:
193 $(BUILD) $(FLAGS_PYTHON_EMBED)
195 $(OUTPUT)test-libpython-version.bin:
196 $(BUILD)
198 $(OUTPUT)test-libbfd.bin:
199 $(BUILD) -DPACKAGE='"perf"' -lbfd -lz -liberty -ldl
201 $(OUTPUT)test-disassembler-four-args.bin:
202 $(BUILD) -DPACKAGE='"perf"' -lbfd -lopcodes
204 $(OUTPUT)test-liberty.bin:
205 $(CC) $(CFLAGS) -Wall -Werror -o $@ test-libbfd.c -DPACKAGE='"perf"' $(LDFLAGS) -lbfd -ldl -liberty
207 $(OUTPUT)test-liberty-z.bin:
208 $(CC) $(CFLAGS) -Wall -Werror -o $@ test-libbfd.c -DPACKAGE='"perf"' $(LDFLAGS) -lbfd -ldl -liberty -lz
210 $(OUTPUT)test-cplus-demangle.bin:
211 $(BUILD) -liberty
213 $(OUTPUT)test-backtrace.bin:
214 $(BUILD)
216 $(OUTPUT)test-timerfd.bin:
217 $(BUILD)
219 $(OUTPUT)test-libdw-dwarf-unwind.bin:
220 $(BUILD) # -ldw provided by $(FEATURE_CHECK_LDFLAGS-libdw-dwarf-unwind)
222 $(OUTPUT)test-libbabeltrace.bin:
223 $(BUILD) # -lbabeltrace provided by $(FEATURE_CHECK_LDFLAGS-libbabeltrace)
225 $(OUTPUT)test-sync-compare-and-swap.bin:
226 $(BUILD)
228 $(OUTPUT)test-compile-32.bin:
229 $(CC) -m32 -o $@ test-compile.c
231 $(OUTPUT)test-compile-x32.bin:
232 $(CC) -mx32 -o $@ test-compile.c
234 $(OUTPUT)test-zlib.bin:
235 $(BUILD) -lz
237 $(OUTPUT)test-lzma.bin:
238 $(BUILD) -llzma
240 $(OUTPUT)test-get_cpuid.bin:
241 $(BUILD)
243 $(OUTPUT)test-bpf.bin:
244 $(BUILD)
246 $(OUTPUT)test-sdt.bin:
247 $(BUILD)
249 $(OUTPUT)test-cxx.bin:
250 $(BUILDXX) -std=gnu++11
252 $(OUTPUT)test-jvmti.bin:
253 $(BUILD)
255 $(OUTPUT)test-llvm.bin:
256 $(BUILDXX) -std=gnu++11 \
257 -I$(shell $(LLVM_CONFIG) --includedir) \
258 -L$(shell $(LLVM_CONFIG) --libdir) \
259 $(shell $(LLVM_CONFIG) --libs Core BPF) \
260 $(shell $(LLVM_CONFIG) --system-libs)
262 $(OUTPUT)test-llvm-version.bin:
263 $(BUILDXX) -std=gnu++11 \
264 -I$(shell $(LLVM_CONFIG) --includedir)
266 $(OUTPUT)test-clang.bin:
267 $(BUILDXX) -std=gnu++11 \
268 -I$(shell $(LLVM_CONFIG) --includedir) \
269 -L$(shell $(LLVM_CONFIG) --libdir) \
270 -Wl,--start-group -lclangBasic -lclangDriver \
271 -lclangFrontend -lclangEdit -lclangLex \
272 -lclangAST -Wl,--end-group \
273 $(shell $(LLVM_CONFIG) --libs Core option) \
274 $(shell $(LLVM_CONFIG) --system-libs)
276 -include $(OUTPUT)*.d
278 ###############################
280 clean:
281 rm -f $(FILES) $(OUTPUT)*.d $(FILES:.bin=.make.output)