# This file is part of the OpenADK project. OpenADK is copyrighted
# material, please see the LICENCE file in the top-level directory.

config ADK_TARGET_CFLAGS_OPT
	string
	default "-Os -pipe" if ADK_TARGET_CFLAGS_OPT_OS
	default "-Og -pipe" if ADK_TARGET_CFLAGS_OPT_OG
	default "-O2 -pipe" if ADK_TARGET_CFLAGS_OPT_O2
	default "-O3 -pipe" if ADK_TARGET_CFLAGS_OPT_O3
	default "-O0 -pipe" if ADK_TARGET_CFLAGS_OPT_O0

choice
prompt "Optimization level"
bool

config ADK_TARGET_CFLAGS_OPT_OS
	prompt "optimize for size (-Os)"

config ADK_TARGET_CFLAGS_OPT_OG
	prompt "optimize, but allow debugging (-Og)"

config ADK_TARGET_CFLAGS_OPT_O2
	prompt "optimize for performance (-O2)"

config ADK_TARGET_CFLAGS_OPT_O3
	prompt "optimize for extra performance (-O3)"

config ADK_TARGET_CFLAGS_OPT_O0
	prompt "no optimization (-O0)"

endchoice

menu "Advanced Toolchain options"
config ADK_TOOLCHAIN_WITH_SSP
	bool

config ADK_TARGET_USE_SSP
	bool "Use Stack Smashing Protection for all packages"
	select ADK_TOOLCHAIN_WITH_SSP

config ADK_TARGET_USE_PIE
	bool "Use Position Independent Executable for packages with have support for it"

config ADK_TOOLCHAIN_WITH_LTO
	bool

config ADK_TARGET_USE_LTO
	bool "Use Link Time Optimization for all packages"
	select ADK_TOOLCHAIN_WITH_LTO

config ADK_TARGET_USE_LD_RELRO
	bool "Use LD read-only (-z relro) relocations for all packages"

config ADK_TARGET_USE_LD_BIND_NOW
	bool "Use LD bind now (-z now) for all packages"

config ADK_TARGET_USE_LD_GC
	bool "Use LD garbage collection for all packages"

config ADK_TOOLCHAIN_WITH_GOLD
	bool

config ADK_TARGET_USE_GOLD
	bool "Use GOLD as linker for all packages"
	select ADK_TOOLCHAIN_WITH_GOLD
	depends on !ADK_TARGET_ARCH_MIPS
	depends on !ADK_TARGET_ARCH_MIPS64

config ADK_TARGET_USE_GNU_HASHSTYLE
	bool "Use GNU hashstyle for all packages"
	depends on !ADK_TARGET_ARCH_MIPS
	depends on !ADK_TARGET_ARCH_MIPS64
	help
	  Performance optimization for applications with lot of shared library
	  dependencies. See http://www.akkadia.org/drepper/dsohowto.pdf

config ADK_DEBUG
	bool "Compile applications with debug support and do not strip"
	help
	  All software for the target will be compiled with:
	  -fno-omit-frame-pointer
	  -funwind-tables
	  -fasynchronous-unwind-tables  
	  Software will not be stripped.
	  Mostly useful for NFS root or big USB/CF or hard disk setups.

config ADK_DEBUG_STRIP
	bool "strip target binaries/libraries for gdbserver usage"
	depends on ADK_DEBUG
	help
	  All packages and C library will be compiled with debug information, 
	  but stripped for the target.

config ADK_TARGET_USE_STATIC_LIBS
	bool "Link applications statically by default"
	select BUSYBOX_STATIC
	help
	  Useful for debugging of dynamic linker problems. Be aware of the fact, that uClibc and glibc
	  still requires libgcc_so.so.1 for pthread_cancel. Glibc also requires libnss_*.so libraries
	  at runtime. Full static builds are only supported for musl libc.

config ADK_STATIC_TOOLCHAIN
	bool "Build the toolchain components statically"
	help
	  If you want to create more portable toolchains, build them static.

config ADK_UCLIBC_TEST
	bool "Build testsuite for C library"
	depends on ADK_TARGET_LIB_UCLIBC_NG || ADK_TARGET_LIB_UCLIBC
	help
	  Build uClibc/uClibc-ng test suite.
endmenu
