summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Hendricks <dhendrix@chromium.org>2011-11-16 14:09:42 -0800
committerDavid Hendricks <dhendrix@chromium.org>2011-11-16 14:10:13 -0800
commitf287021864c70d3b642152f27d2f1ae8bb5a1a02 (patch)
tree8f74e9a188d7b2dfa7d7a35f9c1b8a897d461f88
parent25c36746a2c91831e8d7a36246e7413420bec6f8 (diff)
downloadvboot-f287021864c70d3b642152f27d2f1ae8bb5a1a02.tar.gz
Revert "Revert "Revert "Break out common compile flags"""
reverted again (due to build breakage on ARM) This reverts commit 00e7bb9dd02287db868bc291e25d27066fc486da Change-Id: I9d7d7c653bfac91180ec6e4a8047be8dc2e73448 Reviewed-on: https://gerrit.chromium.org/gerrit/11789 Reviewed-by: David Hendricks <dhendrix@chromium.org> Tested-by: David Hendricks <dhendrix@chromium.org>
-rw-r--r--Makefile50
1 files changed, 22 insertions, 28 deletions
diff --git a/Makefile b/Makefile
index 7652bde8..0d381d35 100644
--- a/Makefile
+++ b/Makefile
@@ -5,43 +5,39 @@
export FIRMWARE_ARCH
export MOCK_TPM
-#
-# Provide default CC and CFLAGS for firmware builds; if you have any -D flags,
-# please add them after this point (e.g., -DVBOOT_DEBUG).
+export CC ?= gcc
+export CXX ?= g++
+export CFLAGS = -Wall -Werror
+
+ifeq (${DEBUG},)
+CFLAGS += -O3
+else
+CFLAGS += -O0 -g
+endif
+
#
# 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.
#
-# As a first step, this makes the setting of CC and CFLAGS here optional, to
-# permit a calling script or Makefile to set these.
+# Override CC and CFLAGS for firmware builds; if you have any -D flags, please
+# add them after this point (e.g., -DVBOOT_DEBUG).
#
-# 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 ?= -march=armv5 \
- -fno-common -ffixed-r8 \
- -msoft-float -marm -mabi=aapcs-linux -mno-thumb-interwork \
- $(COMMON_FLAGS)
+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
endif
ifeq ($(FIRMWARE_ARCH), i386)
-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)
+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
endif
-CC ?= gcc
-CXX ?= g++
-
# Fix compiling directly on host (outside of emake)
ifeq ($(ARCH),)
export ARCH=amd64
@@ -59,8 +55,6 @@ ifeq (${DISABLE_NDEBUG},)
CFLAGS += -DNDEBUG
endif
-export CC CXX CFLAGS
-
export TOP = $(shell pwd)
export FWDIR=$(TOP)/firmware
export HOSTDIR=$(TOP)/host