zephyr/make/target/toolchain/gcc/defs.flags
Inaky Perez-Gonzalez 8ddf82cf70 First commit
Signed-off-by:  <inaky.perez-gonzalez@intel.com>
2015-04-10 16:44:37 -07:00

85 lines
3.9 KiB
Plaintext

# defs.flags - build system
# Copyright (c) 2013-2014 Wind River Systems, Inc.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1) Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
#
# 2) Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
# 3) Neither the name of Wind River Systems nor the names of its contributors
# may be used to endorse or promote products derived from this software without
# specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
include ${iMAKE_GCC}/arch/${vARCH}/defs.flags
include ${iMAKE_GCC}/${vGCC_VER}/defs.flags
# vxmicro flags
vDEFAULT_COMPILER_OPT = -Os
iHAS_COMPILER_OPT ?= $(lastword $(CONFIG_COMPILER_OPT))
iDEFPERF_COMPILER_OPT ?= \
$(if $(iHAS_COMPILER_OPT),$(if $(filter -Os,$(iHAS_COMPILER_OPT)),,${-D}PERF_OPT),)
iKERN_STACK_CANARIES ?= $(if $(CONFIG_STACK_CANARIES),-fstack-protector-all,-fno-stack-protector)
iINCLUDE_AUTOCONF = $(if ${INCLUDE_AUTOCONF},-include ${INCLUDE_AUTOCONF}, )
iGCC_VXMICRO_CFLAGS ?= \
${vDEFAULT_COMPILER_OPT} $(CONFIG_COMPILER_OPT) $(OVERRIDE_COMPILER_OPT) $(iDEFPERF_COMPILER_OPT) \
-fno-reorder-functions \
-fno-asynchronous-unwind-tables -fno-omit-frame-pointer \
-fno-defer-pop -Wall \
-Wno-unused-but-set-variable \
-Wno-main -ffreestanding \
${iINCLUDE_AUTOCONF} \
${iKERN_STACK_CANARIES}
iGCC_VXMICRO_ASMFLAGS = ${iDEFPERF_COMPILER_OPT} ${iINCLUDE_AUTOCONF}
# generic flags
iGCC_GENERIC_CFLAGS ?= ${-c} ${-g} ${iGCC_VXMICRO_CFLAGS}
iGCC_GENERIC_ASMFLAGS ?= ${-c} ${-g} ${iGCC_VXMICRO_ASMFLAGS}
iGCC_GENERIC_LFLAGS ?= -X -N ${iGCC_VXMICRO_LFLAGS}
iGCC_GENERIC_ARFLAGS ?= cr ${iGCC_VXMICRO_ARFLAGS}
# generic and version-specific
iGCC_BASE_CFLAGS ?= ${iGCC_GENERIC_CFLAGS} ${iGCC_${vGCC_VER}_CFLAGS}
iGCC_BASE_ASMFLAGS ?= ${iGCC_GENERIC_ASMFLAGS} ${iGCC_${vGCC_VER}_ASMFLAGS}
iGCC_BASE_LFLAGS ?= ${iGCC_GENERIC_LFLAGS} ${iGCC_${vGCC_VER}_LFLAGS}
iGCC_BASE_ARFLAGS ?= ${iGCC_GENERIC_ARFLAGS} ${iGCC_${vGCC_VER}_ARFLAGS}
# architecture/CPU-specific
iGCC_MACH_CFLAGS ?= ${iGCC_${vARCH}_CFLAGS} ${iGCC_${vCPU}_CFLAGS}
iGCC_MACH_ASMFLAGS ?= ${iGCC_${vARCH}_ASMFLAGS} ${iGCC_${vCPU}_ASMFLAGS}
iGCC_MACH_LFLAGS ?= ${iGCC_${vARCH}_LFLAGS} ${iGCC_${vCPU}_LFLAGS}
iGCC_MACH_ARFLAGS ?= ${iGCC_${vARCH}_ARFLAGS} ${iGCC_${vCPU}_ARFLAGS}
# only set if user did not set his own
CFLAGS ?= ${iGCC_BASE_CFLAGS} ${iGCC_MACH_CFLAGS} ${vCUSTOM_TARGET_DEFS}
ASMFLAGS ?= ${iGCC_BASE_ASMFLAGS} ${iGCC_MACH_ASMFLAGS} ${vCUSTOM_TARGET_DEFS}
LFLAGS ?= ${iGCC_BASE_LFLAGS} ${iGCC_MACH_LFLAGS}
ARFLAGS ?= ${iGCC_BASE_ARFLAGS} ${iGCC_MACH_ARFLAGS}
# always add extra flags from user and necessary flags
CFLAGS += ${iCTX_CFLAGS} ${EXTRA_CFLAGS} -std=c99 ${STDLIB_CFLAGS}
ASMFLAGS += ${iCTX_ASMFLAGS} ${EXTRA_ASMFLAGS} -xassembler-with-cpp
LFLAGS += ${iCTX_LFLAGS} ${EXTRA_LFLAGS}
ARFLAGS += ${iCTX_ARFLAGS} ${EXTRA_ARFLAGS}