From 7c1949341e0e50bfdc58055904944222dd027bb2 Mon Sep 17 00:00:00 2001 From: Marian Buschsieweke Date: Tue, 8 Sep 2020 22:28:41 +0200 Subject: [PATCH] build system: Overwrite TARGET_ARCH per arch Add `TARGET_ARCH_` for each architecture (e.g. `TARGET_ARCH_CORTEX` for Cortex M) to allow users to overwrite the target triple for a specific arch from ~/.profile or ~/.bashrc (or the like) without overwriting it for all others as well. --- cpu/arm7_common/Makefile.include | 3 ++- cpu/esp32/Makefile.include | 3 ++- cpu/esp8266/Makefile.include | 3 ++- makefiles/arch/atmega.inc.mk | 3 ++- makefiles/arch/cortexm.inc.mk | 3 ++- makefiles/arch/mips.inc.mk | 3 ++- makefiles/arch/msp430.inc.mk | 3 ++- makefiles/arch/riscv.inc.mk | 3 ++- 8 files changed, 16 insertions(+), 8 deletions(-) diff --git a/cpu/arm7_common/Makefile.include b/cpu/arm7_common/Makefile.include index 1d7edd59b4..b660cb2f69 100644 --- a/cpu/arm7_common/Makefile.include +++ b/cpu/arm7_common/Makefile.include @@ -1,5 +1,6 @@ # Target architecture for the build. Use arm-none-eabi if you are unsure. -TARGET_ARCH ?= arm-none-eabi +TARGET_ARCH_ARM7 ?= arm-none-eabi +TARGET_ARCH ?= $(TARGET_ARCH_ARM7) INCLUDES += -I$(RIOTBASE)/cpu/arm7_common/include/ diff --git a/cpu/esp32/Makefile.include b/cpu/esp32/Makefile.include index 0e6fa68188..c5da8ba9cb 100644 --- a/cpu/esp32/Makefile.include +++ b/cpu/esp32/Makefile.include @@ -18,7 +18,8 @@ include $(RIOTCPU)/esp_common/Makefile.include # regular Makefile -TARGET_ARCH ?= xtensa-esp32-elf +TARGET_ARCH_ESP32 ?= xtensa-esp32-elf +TARGET_ARCH ?= $(TARGET_ARCH_ESP32) PSEUDOMODULES += esp_eth_hw PSEUDOMODULES += esp_gdbstub diff --git a/cpu/esp8266/Makefile.include b/cpu/esp8266/Makefile.include index 09e2fbbf5c..d26966394a 100644 --- a/cpu/esp8266/Makefile.include +++ b/cpu/esp8266/Makefile.include @@ -24,7 +24,8 @@ include $(RIOTCPU)/esp_common/Makefile.include # regular Makefile -TARGET_ARCH ?= xtensa-esp8266-elf +TARGET_ARCH_ESP8266 ?= xtensa-esp8266-elf +TARGET_ARCH ?= $(TARGET_ARCH_ESP8266) PSEUDOMODULES += esp_sw_timer diff --git a/makefiles/arch/atmega.inc.mk b/makefiles/arch/atmega.inc.mk index 24e7cb08dd..36961ef5ee 100644 --- a/makefiles/arch/atmega.inc.mk +++ b/makefiles/arch/atmega.inc.mk @@ -1,5 +1,6 @@ # Target architecture for the build. Use avr if you are unsure. -TARGET_ARCH ?= avr +TARGET_ARCH_AVR ?= avr +TARGET_ARCH ?= $(TARGET_ARCH_AVR) CFLAGS_CPU = -mmcu=$(CPU) $(CFLAGS_FPU) CFLAGS_LINK = -ffunction-sections -fdata-sections -fno-builtin -fshort-enums diff --git a/makefiles/arch/cortexm.inc.mk b/makefiles/arch/cortexm.inc.mk index 2751389fad..74eb36b51b 100644 --- a/makefiles/arch/cortexm.inc.mk +++ b/makefiles/arch/cortexm.inc.mk @@ -3,7 +3,8 @@ ifeq (,$(CPU_MODEL)) endif # Target triple for the build. Use arm-none-eabi if you are unsure. -TARGET_ARCH ?= arm-none-eabi +TARGET_ARCH_CORTEXM ?= arm-none-eabi +TARGET_ARCH ?= $(TARGET_ARCH_CORTEXM) # define build specific options CFLAGS_CPU = -mcpu=$(MCPU) -mlittle-endian -mthumb $(CFLAGS_FPU) diff --git a/makefiles/arch/mips.inc.mk b/makefiles/arch/mips.inc.mk index eca7258865..61e7ef1c2d 100644 --- a/makefiles/arch/mips.inc.mk +++ b/makefiles/arch/mips.inc.mk @@ -1,5 +1,6 @@ # Target triple for the build. -TARGET_ARCH ?= mips-mti-elf +TARGET_ARCH_MIPS ?= mips-mti-elf +TARGET_ARCH ?= $(TARGET_ARCH_MIPS) ABI = 32 diff --git a/makefiles/arch/msp430.inc.mk b/makefiles/arch/msp430.inc.mk index c1af393778..011e2778ea 100644 --- a/makefiles/arch/msp430.inc.mk +++ b/makefiles/arch/msp430.inc.mk @@ -1,5 +1,6 @@ # Target architecture for the build. Use msp430-elf if you are unsure. -TARGET_ARCH ?= msp430-elf +TARGET_ARCH_MSP430 ?= msp430-elf +TARGET_ARCH ?= $(TARGET_ARCH_MSP430) MSP430_SUPPORT_FILES ?= $(RIOTCPU)/msp430_common/vendor/msp430-gcc-support-files diff --git a/makefiles/arch/riscv.inc.mk b/makefiles/arch/riscv.inc.mk index 120abb67dd..2fe6f032b2 100644 --- a/makefiles/arch/riscv.inc.mk +++ b/makefiles/arch/riscv.inc.mk @@ -1,5 +1,6 @@ # Target architecture for the build. -TARGET_ARCH ?= riscv-none-embed +TARGET_ARCH_RISCV ?= riscv-none-embed +TARGET_ARCH ?= $(TARGET_ARCH_RISCV) # define build specific options CFLAGS_CPU = -march=rv32imac -mabi=ilp32 -mcmodel=medlow -msmall-data-limit=8