Break out common compile flags

Many of the compile flags are common between archs, so this makes that
more obvious.

BUG=chromium-os:16808
TEST=emerge vboot_reference-firmware for tegra2-seaboard, x86-mario

Change-Id: I62bfbaadac392e3dd03d6997f24055fafac162af
Reviewed-on: https://gerrit.chromium.org/gerrit/11549
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Simon Glass
2011-11-11 13:20:28 -08:00
parent c25904536f
commit 77ce2e864e

View File

@@ -5,39 +5,43 @@
export FIRMWARE_ARCH
export MOCK_TPM
export CC ?= gcc
export CXX ?= g++
export CFLAGS = -Wall -Werror
ifeq (${DEBUG},)
CFLAGS += -O3
else
CFLAGS += -O0 -g
endif
#
# Provide default CC and CFLAGS for firmware builds; if you have any -D flags,
# please add them after this point (e.g., -DVBOOT_DEBUG).
#
# TODO(crosbug.com/16808) We hard-code u-boot's compiler flags here just
# temporarily. As we are still investigating which flags are necessary for
# maintaining a compatible ABI, etc. between u-boot and vboot_reference.
#
# Override CC and CFLAGS for firmware builds; if you have any -D flags, please
# add them after this point (e.g., -DVBOOT_DEBUG).
# As a first step, this makes the setting of CC and CFLAGS here optional, to
# permit a calling script or Makefile to set these.
#
# Flag ordering: arch, then -f, then -m, then -W
DEBUG_FLAGS := $(if ${DEBUG},-g -O0,-Os)
COMMON_FLAGS := -nostdinc -pipe \
-ffreestanding -fno-builtin -fno-stack-protector \
-Werror -Wall -Wstrict-prototypes $(DEBUG_FLAGS)
ifeq ($(FIRMWARE_ARCH), arm)
CC = armv7a-cros-linux-gnueabi-gcc
CFLAGS = -g -Os -fno-common -ffixed-r8 -msoft-float -fno-builtin \
-ffreestanding -nostdinc \
-pipe -marm -mabi=aapcs-linux -mno-thumb-interwork -march=armv5 \
-Werror -Wall -Wstrict-prototypes -fno-stack-protector
CC ?= armv7a-cros-linux-gnueabi-gcc
CFLAGS ?= -march=armv5 \
-fno-common -ffixed-r8 \
-msoft-float -marm -mabi=aapcs-linux -mno-thumb-interwork \
$(COMMON_FLAGS)
endif
ifeq ($(FIRMWARE_ARCH), i386)
CC = i686-pc-linux-gnu-gcc
CFLAGS = -g -Os -ffunction-sections -fvisibility=hidden -fno-builtin \
-ffreestanding -nostdinc -pipe -Wstrict-prototypes -mregparm=3 \
-fomit-frame-pointer -fno-stack-protector \
-mpreferred-stack-boundary=2 -fno-dwarf2-cfi-asm -Werror -Wall
CC ?= i686-pc-linux-gnu-gcc
# Drop -march=i386 to permit use of SSE instructions
CFLAGS ?= \
-ffunction-sections -fvisibility=hidden -fno-strict-aliasing \
-fomit-frame-pointer -fno-toplevel-reorder -fno-dwarf2-cfi-asm \
-mpreferred-stack-boundary=2 -mregparm=3 \
$(COMMON_FLAGS)
endif
CC ?= gcc
CXX ?= g++
# Fix compiling directly on host (outside of emake)
ifeq ($(ARCH),)
export ARCH=amd64
@@ -55,6 +59,8 @@ ifeq (${DISABLE_NDEBUG},)
CFLAGS += -DNDEBUG
endif
export CC CXX CFLAGS
export TOP = $(shell pwd)
export FWDIR=$(TOP)/firmware
export HOSTDIR=$(TOP)/host