Infer PLATFORM variable in make when nothing is provided (#350)

pull/351/head
Dmitry Ilyin 2022-08-14 12:52:59 +03:00 committed by GitHub
parent e7fca9c6f5
commit 6e142ae5f0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 16 additions and 0 deletions

View File

@ -2,6 +2,22 @@
ROOT_DIR := $(CURDIR)
BR_VER := 2021.02.12
BR_DIR := $(ROOT_DIR)/buildroot-$(BR_VER)
ifeq ($(PLATFORM),)
ifeq ($(BOARD),)
BOARD = $(error BOARD must be set)
endif
FULL_PATH := $(shell find br-ext-chip-* -name "$(BOARD)*_defconfig")
ifeq ($(FULL_PATH),)
FULL_PATH := $(error Cannot find anything for $(BOARD))
else ifneq ($(shell echo $(FULL_PATH) | wc -w), 1)
FULL_PATH := $(error For provided '$(BOARD)' multiple options found: $(FULL_PATH))
endif
PLATFORM := $(shell echo $(FULL_PATH) | cut -d '/' -f 1 | cut -d '-' -f 4 )
endif
BR_EXT_DIR := $(ROOT_DIR)/br-ext-chip-$(PLATFORM)
SCRIPTS_DIR := $(ROOT_DIR)/scripts
#BOARDS := $(shell ls -1 $(BR_EXT_DIR)/configs)