diff options
author | Joel Challis <git@zvecr.com> | 2023-01-19 00:27:00 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-19 00:27:00 +0000 |
commit | 0ce3f6bcfe8241e51dd6936d24e6a88c907c535d (patch) | |
tree | 216c96bb7d8037120a256d0c707150b95f5866bd /builddefs | |
parent | a1f253cbef309906c989cfb3e123ee8fb3172bb4 (diff) |
De-duplicate platform detection (#19603)
Diffstat (limited to 'builddefs')
-rw-r--r-- | builddefs/build_keyboard.mk | 24 | ||||
-rw-r--r-- | builddefs/converters.mk | 1 |
2 files changed, 7 insertions, 18 deletions
diff --git a/builddefs/build_keyboard.mk b/builddefs/build_keyboard.mk index ec0336f7c3..6d355c9b85 100644 --- a/builddefs/build_keyboard.mk +++ b/builddefs/build_keyboard.mk @@ -184,6 +184,12 @@ include $(BUILDDEFS_PATH)/converters.mk include $(BUILDDEFS_PATH)/mcu_selection.mk +# PLATFORM_KEY should be detected in info.json via key 'processor' (or rules.mk 'MCU') +ifeq ($(PLATFORM_KEY),) + $(call CATASTROPHIC_ERROR,Platform not defined) +endif +PLATFORM=$(shell echo $(PLATFORM_KEY) | tr '[:lower:]' '[:upper:]') + # Find all the C source files to be compiled in subfolders. KEYBOARD_SRC := @@ -257,24 +263,6 @@ ifneq ("$(wildcard $(KEYBOARD_PATH_5)/$(KEYBOARD_FOLDER_5).h)","") FOUND_KEYBOARD_H = $(KEYBOARD_FOLDER_5).h endif -# Determine and set parameters based on the keyboard's processor family. -# We can assume a ChibiOS target When MCU_FAMILY is defined since it's -# not used for LUFA -ifdef MCU_FAMILY - PLATFORM=CHIBIOS - PLATFORM_KEY=chibios - FIRMWARE_FORMAT?=bin - OPT_DEFS += -DMCU_$(MCU_FAMILY) -else ifdef ARM_ATSAM - PLATFORM=ARM_ATSAM - PLATFORM_KEY=arm_atsam - FIRMWARE_FORMAT=bin -else - PLATFORM=AVR - PLATFORM_KEY=avr - FIRMWARE_FORMAT?=hex -endif - # Find all of the config.h files and add them to our CONFIG_H define. CONFIG_H := ifneq ("$(wildcard $(KEYBOARD_PATH_5)/config.h)","") diff --git a/builddefs/converters.mk b/builddefs/converters.mk index 581276c2e0..3ba0e50116 100644 --- a/builddefs/converters.mk +++ b/builddefs/converters.mk @@ -19,6 +19,7 @@ ifneq ($(CONVERT_TO),) -include $(CONVERTER)/pre_converter.mk + PLATFORM_KEY = $(shell echo $(CONVERTER) | rev | cut -d "/" -f4 | rev) TARGET := $(TARGET)_$(CONVERT_TO) # Configure any defaults |