diff options
-rw-r--r-- | Makefile.rules | 25 | ||||
-rw-r--r-- | Makefile.toolchain | 6 | ||||
-rw-r--r-- | core/cortex-m/build.mk | 2 | ||||
-rw-r--r-- | core/cortex-m0/build.mk | 2 | ||||
-rw-r--r-- | core/minute-ia/build.mk | 2 | ||||
-rw-r--r-- | core/nds32/build.mk | 2 |
6 files changed, 24 insertions, 15 deletions
diff --git a/Makefile.rules b/Makefile.rules index efc9c1e23e..2dae63a26e 100644 --- a/Makefile.rules +++ b/Makefile.rules @@ -456,19 +456,22 @@ endif help: @echo "Google Chromium EC build" @echo "Common Targets:" - @echo " all [BOARD=] - Build a single board (Default target)" - @echo " clean [BOARD=] - Clean a single board" - @echo " buildall - Build and test all boards" - @echo " clobber - Clean all boards" - @echo " proj-<boardname> - Build a single board (similar to 'all BOARD=boardname')" - @echo " savesizes - Save the filesizes of currently built boards for comparison" - @echo " newsizes - Compare previously saved filesizes against new sizes" + @echo " all [BOARD=] - Build a single board (Default target)" + @echo " clean [BOARD=] - Clean a single board" + @echo " buildall - Build and test all boards" + @echo " clobber - Clean all boards" + @echo " proj-<boardname> - Build a single board (similar to 'all BOARD=boardname')" + @echo " savesizes - Save the filesizes of currently built boards for comparison" + @echo " newsizes - Compare previously saved filesizes against new sizes" @echo "Common Variables:" - @echo " BOARD= - Set the board name to build (Default is $(BOARD))" - @echo " CROSS_COMPILE= - Set the compiler for the board" - @echo " V=1 - Show make output" + @echo " V=1 - Show make output" + @echo " BOARD= - Set the board name to build (Default is $(BOARD))" + @echo " CROSS_COMPILE= - Set the compiler for the board" + @echo " CROSS_COMPILE_arch= - Set the compiler for arch" + @echo " The board picks its CROSS_COMPILE_arch if CROSS_COMPILE is not set." + @echo " arch may be one of 'arm', 'i386', 'nds32'." @echo "Example:" - @echo " make BOARD=reef CROSS_COMPILE='arm-eabi-'" + @echo " make BOARD=reef CROSS_COMPILE_arm='arm-eabi-'" .PHONY: savesizes savesizes: diff --git a/Makefile.toolchain b/Makefile.toolchain index 8bbac56dcd..1d1b458e3e 100644 --- a/Makefile.toolchain +++ b/Makefile.toolchain @@ -88,3 +88,9 @@ LDFLAGS=-nostdlib -Wl,-X -Wl,--gc-sections -Wl,--build-id=none $(LDFLAGS_EXTRA) BUILD_LDFLAGS=$(LIBFTDI_LDLIBS) HOST_TEST_LDFLAGS=-T core/host/host_exe.lds -lrt -pthread -rdynamic -lm\ $(if $(TEST_COVERAGE),-fprofile-arcs,) + +# utility function to provide overridable defaults +# $1: name of variable to set +# $2: first default to use +# $3: second default to use +set-option = $(eval $1?=$$(if $(2),$(2),$(3))) diff --git a/core/cortex-m/build.mk b/core/cortex-m/build.mk index 5724a9ba39..cc323a2dca 100644 --- a/core/cortex-m/build.mk +++ b/core/cortex-m/build.mk @@ -7,7 +7,7 @@ # # Select ARMv7-m bare-metal toolchain -CROSS_COMPILE?=arm-none-eabi- +$(call set-option,CROSS_COMPILE,$(CROSS_COMPILE_arm),arm-none-eabi-) # FPU compilation flags CFLAGS_FPU-$(CONFIG_FPU)=-mfpu=fpv4-sp-d16 -mfloat-abi=hard diff --git a/core/cortex-m0/build.mk b/core/cortex-m0/build.mk index f8f33aa2a3..6a0f44b367 100644 --- a/core/cortex-m0/build.mk +++ b/core/cortex-m0/build.mk @@ -7,7 +7,7 @@ # # Select ARMv6-m compatible bare-metal toolchain -CROSS_COMPILE?=arm-none-eabi- +$(call set-option,CROSS_COMPILE,$(CROSS_COMPILE_arm),arm-none-eabi-) # CPU specific compilation flags CFLAGS_CPU+=-mthumb -Os -mno-sched-prolog diff --git a/core/minute-ia/build.mk b/core/minute-ia/build.mk index c58f5fff4e..4fae1ac107 100644 --- a/core/minute-ia/build.mk +++ b/core/minute-ia/build.mk @@ -7,7 +7,7 @@ # # Select Minute-IA bare-metal toolchain -CROSS_COMPILE=i686-pc-linux-gnu- +$(call set-option,CROSS_COMPILE,$(CROSS_COMPILE_i386),i686-pc-linux-gnu-) # FPU compilation flags CFLAGS_FPU-$(CONFIG_FPU)= diff --git a/core/nds32/build.mk b/core/nds32/build.mk index 68dd1585ab..5b87d85b15 100644 --- a/core/nds32/build.mk +++ b/core/nds32/build.mk @@ -7,7 +7,7 @@ # # Select Andes bare-metal toolchain -CROSS_COMPILE?=nds32le-cros-elf- +$(call set-option,CROSS_COMPILE,$(CROSS_COMPILE_nds32),nds32le-cros-elf-) # CPU specific compilation flags CFLAGS_CPU+=-march=v3m -Os |