1 # Copyright (C) 2006-2013 OpenWrt.org
3 # This is free software, licensed under the GNU General Public License v2.
4 # See /LICENSE for more information.
7 menuconfig TARGET_OPTIONS
8 bool "Target Options" if DEVEL
10 config TARGET_OPTIMIZATION
11 string "Target Optimizations" if TARGET_OPTIONS
12 default DEFAULT_TARGET_OPTIMIZATION
14 Optimizations to use when building for the target host.
17 bool "Use software floating point by default" if TARGET_OPTIONS
19 depends on arm || armeb || powerpc || mipsel || mips || mips64el || mips64
21 If your target CPU does not have a Floating Point Unit (FPU) or a
22 kernel FPU emulator, but you still wish to support floating point
23 functions, then everything will need to be compiled with soft floating
24 point support (-msoft-float).
26 Most people will answer N.
29 bool "Build packages with MIPS16 instructions" if TARGET_OPTIONS
33 If your target CPU does support the MIPS16 instruction set
34 and you want to use it for packages, enable this option.
35 MIPS16 produces smaller binaries thus reducing pressure on
38 Most people will answer N.
42 prompt "BPF toolchain" if DEVEL
43 default BPF_TOOLCHAIN_PREBUILT if HAS_PREBUILT_LLVM_TOOLCHAIN
44 default BPF_TOOLCHAIN_BUILD_LLVM
46 config BPF_TOOLCHAIN_NONE
49 config BPF_TOOLCHAIN_PREBUILT
50 bool "Use prebuilt LLVM toolchain"
51 depends on HAS_PREBUILT_LLVM_TOOLCHAIN
52 select USE_LLVM_PREBUILT
54 config BPF_TOOLCHAIN_HOST
56 bool "Use host LLVM toolchain"
58 config BPF_TOOLCHAIN_BUILD_LLVM
59 select USE_LLVM_BUILD if NEED_BPF_TOOLCHAIN
60 bool "Build LLVM toolchain for eBPF"
62 If enabled, a LLVM toolchain for building eBPF binaries will be built.
63 If this is not enabled, eBPF packages can only be built if the host
64 has a suitable toolchain
67 config BPF_TOOLCHAIN_HOST_PATH
69 depends on BPF_TOOLCHAIN_HOST
70 prompt "Host LLVM toolchain path (prefix)" if DEVEL
71 default "/usr/local/opt/llvm" if HOST_OS_MACOS
74 menuconfig EXTERNAL_TOOLCHAIN
76 prompt "Use external toolchain" if DEVEL
78 If enabled, the buildroot will compile using an existing toolchain instead of
81 config NATIVE_TOOLCHAIN
83 prompt "Use host's toolchain" if DEVEL
84 depends on EXTERNAL_TOOLCHAIN
87 If enabled, the buildroot will compile using the native toolchain for your
88 host instead of compiling one.
92 prompt "Target name" if DEVEL
93 depends on EXTERNAL_TOOLCHAIN && !NATIVE_TOOLCHAIN
94 default "aarch64-unknown-linux-gnu" if aarch64
95 default "aarch64_be-unknown-linux-gnu" if aarch64_be
96 default "arm-unknown-linux-gnu" if arm
97 default "armeb-unknown-linux-gnu" if armeb
98 default "i486-unknown-linux-gnu" if i386
99 default "loongarch64-unknown-linux-gnu" if loongarch64
100 default "mips-unknown-linux-gnu" if mips
101 default "mipsel-unknown-linux-gnu" if mipsel
102 default "powerpc-unknown-linux-gnu" if powerpc
103 default "x86_64-unknown-linux-gnu" if x86_64
105 config TOOLCHAIN_PREFIX
107 prompt "Toolchain prefix" if DEVEL
108 depends on EXTERNAL_TOOLCHAIN && !NATIVE_TOOLCHAIN
109 default "aarch64-unknown-linux-gnu" if aarch64
110 default "aarch64_be-unknown-linux-gnu" if aarch64_be
111 default "arm-unknown-linux-gnu-" if arm
112 default "armeb-unknown-linux-gnu-" if armeb
113 default "i486-unknown-linux-gnu-" if i386
114 default "loongarch64-unknown-linux-gnu-" if loongarch64
115 default "mips-unknown-linux-gnu-" if mips
116 default "mipsel-unknown-linux-gnu-" if mipsel
117 default "powerpc-unknown-linux-gnu-" if powerpc
118 default "x86_64-unknown-linux-gnu-" if x86_64
120 config TOOLCHAIN_ROOT
122 prompt "Toolchain root" if DEVEL
123 depends on EXTERNAL_TOOLCHAIN && !NATIVE_TOOLCHAIN
124 default "/opt/cross/aarch64-unknown-linux-gnu" if aarch64
125 default "/opt/cross/aarch64_be-unknown-linux-gnu" if aarch64_be
126 default "/opt/cross/arm-unknown-linux-gnu" if arm
127 default "/opt/cross/armeb-unknown-linux-gnu" if armeb
128 default "/opt/cross/i486-unknown-linux-gnu" if i386
129 default "/opt/cross/loongarch64-unknown-linux-gnu" if loongarch64
130 default "/opt/cross/mips-unknown-linux-gnu" if mips
131 default "/opt/cross/mipsel-unknown-linux-gnu" if mipsel
132 default "/opt/cross/powerpc-unknown-linux-gnu" if powerpc
133 default "/opt/cross/x86_64-unknown-linux-gnu" if x86_64
135 choice TOOLCHAIN_LIBC_TYPE
136 prompt "Toolchain libc" if DEVEL
137 depends on EXTERNAL_TOOLCHAIN && !NATIVE_TOOLCHAIN
138 default EXTERNAL_TOOLCHAIN_LIBC_USE_MUSL
140 Specify the libc type used by the external toolchain. The given value
141 is passed as -m flag to all gcc and g++ invocations. This is mainly
142 intended for multilib toolchains which support glibc and uclibc at
143 the same time. If no value is specified, no -m flag is passed.
145 config EXTERNAL_TOOLCHAIN_LIBC_USE_GLIBC
149 config EXTERNAL_TOOLCHAIN_LIBC_USE_MUSL
155 config EXTERNAL_GCC_VERSION
157 prompt "External Toolchain GCC Version" if DEVEL
158 depends on EXTERNAL_TOOLCHAIN && !NATIVE_TOOLCHAIN
160 Manually specify the GCC version used by the selected
163 config TOOLCHAIN_LIBC
165 depends on EXTERNAL_TOOLCHAIN && !NATIVE_TOOLCHAIN
166 default "glibc" if EXTERNAL_TOOLCHAIN_LIBC_USE_GLIBC
167 default "musl" if EXTERNAL_TOOLCHAIN_LIBC_USE_MUSL
169 config TOOLCHAIN_BIN_PATH
171 prompt "Toolchain program path" if DEVEL
172 depends on EXTERNAL_TOOLCHAIN && !NATIVE_TOOLCHAIN
173 default "./usr/bin ./bin"
175 Specify additional directories searched for toolchain binaries
176 (override PATH). Use ./DIR for directories relative to the root above.
178 config TOOLCHAIN_INC_PATH
180 prompt "Toolchain include path" if DEVEL
181 depends on EXTERNAL_TOOLCHAIN && !NATIVE_TOOLCHAIN
182 default "./usr/include ./include/fortify ./include" if EXTERNAL_TOOLCHAIN_LIBC_USE_MUSL
183 default "./usr/include ./include"
185 Specify additional directories searched for header files (override
186 CPPFLAGS). Use ./DIR for directories relative to the root above.
188 config TOOLCHAIN_LIB_PATH
190 prompt "Toolchain library path" if DEVEL
191 depends on EXTERNAL_TOOLCHAIN && !NATIVE_TOOLCHAIN
192 default "./usr/lib ./lib"
194 Specify additional directories searched for libraries (override LDFLAGS).
195 Use ./DIR for directories relative to the root above.
197 config NEED_TOOLCHAIN
200 default y if !EXTERNAL_TOOLCHAIN
202 menuconfig TOOLCHAINOPTS
203 bool "Toolchain Options" if DEVEL
204 depends on NEED_TOOLCHAIN
206 menuconfig EXTRA_TARGET_ARCH
208 prompt "Enable an extra toolchain target architecture" if TOOLCHAINOPTS
211 Some builds may require a 'biarch' toolchain. This option
212 allows you to specify an additional target arch.
214 Most people will answer N here.
216 config EXTRA_TARGET_ARCH_NAME
218 prompt "Extra architecture name" if EXTRA_TARGET_ARCH
220 Specify the cpu name (eg powerpc64 or x86_64) of the
221 additional target architecture.
223 config EXTRA_TARGET_ARCH_OPTS
225 prompt "Extra architecture compiler options" if EXTRA_TARGET_ARCH
227 If you're specifying an addition target architecture,
228 you'll probably need to also provide options to make
229 the compiler use this alternate arch.
231 For example, if you're building a compiler that can build
232 both powerpc and powerpc64 binaries, you'll need to
237 prompt "MIPS64 user-land ABI" if TOOLCHAINOPTS && (mips64 || mips64el)
238 default MIPS64_ABI_N64
240 MIPS64 supports 3 different user-land ABIs: o32 (legacy),
243 config MIPS64_ABI_N64
246 config MIPS64_ABI_N32
247 depends on !LIBC_USE_MUSL
250 config MIPS64_ABI_O32
255 comment "Binary tools"
256 depends on TOOLCHAINOPTS
258 source "toolchain/binutils/Config.in"
262 prompt "Build pahole" if TOOLCHAINOPTS
263 depends on !HOST_OS_MACOS
265 Enable if you want to build pahole and the dwarves tools.
268 depends on TOOLCHAINOPTS
270 source "toolchain/gcc/Config.in"
274 depends on ( i386 || x86_64 )
275 prompt "Build nasm" if TOOLCHAINOPTS
278 Enable if you want to build nasm
281 depends on TOOLCHAINOPTS
284 prompt "C Library implementation" if TOOLCHAINOPTS
285 default LIBC_USE_GLIBC if arc
286 default LIBC_USE_MUSL
288 Select the C library implementation.
290 config LIBC_USE_GLIBC
301 source "toolchain/musl/Config.in"
304 depends on TOOLCHAINOPTS
308 prompt "Build gdb" if TOOLCHAINOPTS
309 default y if !EXTERNAL_TOOLCHAIN
311 Enable if you want to build the gdb.
316 prompt "Build gdb with python binding"
319 Enable the python bindings for GDB to allow using python in the gdb shell.
321 config HAS_BPF_TOOLCHAIN
322 default y if !BPF_TOOLCHAIN_NONE
325 config NEED_BPF_TOOLCHAIN
328 config HAS_PREBUILT_LLVM_TOOLCHAIN
329 def_bool $(shell, [ -f llvm-bpf/.llvm-version ] && echo y || echo n)
334 config USE_LLVM_PREBUILT
335 default y if !DEVEL && !BUILDBOT && HAS_PREBUILT_LLVM_TOOLCHAIN
338 config USE_LLVM_BUILD
339 default y if !DEVEL && NEED_BPF_TOOLCHAIN && (BUILDBOT || !HAS_PREBUILT_LLVM_TOOLCHAIN)
343 default y if !TOOLCHAINOPTS && !EXTERNAL_TOOLCHAIN && !NATIVE_TOOLCHAIN && (arc)
347 default y if !TOOLCHAINOPTS && !EXTERNAL_TOOLCHAIN && !NATIVE_TOOLCHAIN && !(arc)
351 default y if !PKG_CC_STACKPROTECTOR_NONE
354 config USE_EXTERNAL_LIBC
356 default y if EXTERNAL_TOOLCHAIN || NATIVE_TOOLCHAIN
358 source "toolchain/binutils/Config.version"
359 source "toolchain/gcc/Config.version"
363 default "glibc" if USE_GLIBC
364 default "musl" if USE_MUSL
368 default "gnueabi" if USE_GLIBC && (arm || armeb)
369 default "gnu" if USE_GLIBC && !(arm || armeb)
370 default "muslgnueabi" if USE_MUSL && (arm || armeb)
371 default "musl" if USE_MUSL && !(arm || armeb)
374 depends on mips64 || mips64el
376 default "64" if MIPS64_ABI_N64
377 default "n32" if MIPS64_ABI_N32
378 default "32" if MIPS64_ABI_O32