summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRandall Spangler <rspangler@chromium.org>2011-12-08 09:37:32 -0800
committerRandall Spangler <rspangler@chromium.org>2011-12-08 10:55:27 -0800
commitbc4c1b4eb9ca3b30f07ba78d0c3f591e057874b1 (patch)
treee1f9b00a10d6d4d84a82375a51b580550ffd39d4
parente24fa592d2a215d8ae67917c1d89e68cdf847a03 (diff)
downloadchrome-ec-bc4c1b4eb9ca3b30f07ba78d0c3f591e057874b1.tar.gz
Separate utility build for build and host utils
Build is the system doing the build (e.g. 64-bit linux) and host is the target platform on top of the ec (e.g. 32-bit Chromium OS). Necessary to get ectool properly compiling for Chromium OS. Signed-off-by: Randall Spangler <rspangler@chromium.org> BUG=none TEST=make && file build/bds/util/ectool; ectool should be a 32-bit binary Change-Id: I50eba4c164ece236646a7c6087b1b86769beeb28
-rw-r--r--Makefile2
-rw-r--r--Makefile.rules13
-rw-r--r--Makefile.toolchain7
-rw-r--r--util/build.mk5
4 files changed, 19 insertions, 8 deletions
diff --git a/Makefile b/Makefile
index 024fa617b8..7f98ebc02b 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-# Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
+# Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/Makefile.rules b/Makefile.rules
index c60ba7034e..888425daa1 100644
--- a/Makefile.rules
+++ b/Makefile.rules
@@ -1,4 +1,4 @@
-# Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
+# Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
@@ -7,7 +7,8 @@
objs := $(all-objs)
deps := $(objs:%.o=%.o.d)
-all-utils := $(foreach u,$(util-bin),$(out)/util/$(u))
+build-utils := $(foreach u,$(build-util-bin),$(out)/util/$(u))
+host-utils := $(foreach u,$(host-util-bin),$(out)/util/$(u))
# Create output directories if necessary
_dir_create := $(foreach d,$(dirs),$(shell [ -d $(out)/$(d) ] || mkdir -p $(out)/$(d)))
@@ -28,6 +29,7 @@ cmd_elf_to_flat = $(OBJCOPY) -O binary $^ $@
cmd_elf_to_dis = $(OBJDUMP) -D $< > $@
cmd_elf = $(LD) $(LDFLAGS) $(objs) -o $@ -T $< -Map $(out)/$*.map
cmd_c_to_o = $(CC) $(CFLAGS) -MMD -MF $@.d -c $< -o $@
+cmd_c_to_build = $(BUILDCC) $(BUILD_CFLAGS) -MMD -MF $@.d $< -o $@
cmd_c_to_host = $(HOSTCC) $(HOST_CFLAGS) -MMD -MF $@.d $< -o $@
cmd_qemu = ./util/run_qemu_test --image=build/$(BOARD)/$*/$*.bin test/$*.py $(silent)
@@ -35,7 +37,7 @@ cmd_qemu = ./util/run_qemu_test --image=build/$(BOARD)/$*/$*.bin test/$*.py $(si
.PHONY: all tests utils
all: $(out)/$(PROJECT).bin $(foreach s,A B RO,$(out)/$(PROJECT).$(s).dis) utils
-utils: $(all-utils)
+utils: $(build-utils) $(host-utils)
test-targets=$(foreach t,$(test-list),test-$(t))
qemu-test-targets=$(foreach t,$(test-list),qemu-$(t))
@@ -79,7 +81,10 @@ $(out)/%.o:%.c
$(out)/%.o:%.S
$(call quiet,c_to_o,AS )
-$(all-utils): $(out)/%:%.c
+$(build-utils): $(out)/%:%.c
+ $(call quiet,c_to_build,BUILDCC)
+
+$(host-utils): $(out)/%:%.c
$(call quiet,c_to_host,HOSTCC )
.PHONY: clean
diff --git a/Makefile.toolchain b/Makefile.toolchain
index 982e1f9819..d52967edde 100644
--- a/Makefile.toolchain
+++ b/Makefile.toolchain
@@ -1,4 +1,4 @@
-# Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
+# Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
@@ -7,13 +7,15 @@
# Toolchain configuration
CROSS_COMPILE ?= armv7a-cros-linux-gnueabi-
+HOST_CROSS_COMPILE ?= i686-pc-linux-gnu-
CC=$(CROSS_COMPILE)gcc
CPP=$(CROSS_COMPILE)cpp
LD=$(CROSS_COMPILE)ld
OBJCOPY=$(CROSS_COMPILE)objcopy
OBJDUMP=$(CROSS_COMPILE)objdump
-HOSTCC?=gcc
+BUILDCC?=gcc
+HOSTCC?=$(HOST_CROSS_COMPILE)gcc
CFLAGS_WARN=-Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
-fno-strict-aliasing -fno-common \
@@ -25,5 +27,6 @@ CFLAGS_INCLUDE=$(foreach i,$(includes),-I$(i) )
CFLAGS_DEFINE=-DOUTDIR=$(out) -DCHIP=$(CHIP) -DTASKFILE=$(PROJECT).tasklist
CPPFLAGS=$(CFLAGS_DEFINE) $(CFLAGS_INCLUDE)
CFLAGS=$(CPPFLAGS) $(CFLAGS_CPU) $(CFLAGS_DEBUG) $(CFLAGS_WARN)
+BUILD_CFLAGS=$(CPPFLAGS) -O3 $(CFLAGS_DEBUG) $(CFLAGS_WARN)
HOST_CFLAGS=$(CPPFLAGS) -O3 $(CFLAGS_DEBUG) $(CFLAGS_WARN)
LDFLAGS=-nostdlib -X
diff --git a/util/build.mk b/util/build.mk
index 1bf1f7f372..6d44606562 100644
--- a/util/build.mk
+++ b/util/build.mk
@@ -1,5 +1,8 @@
+# Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
#
# Host tools build
#
-util-bin=ectool
+host-util-bin=ectool