try to fetch needed mcu submodule while running make

This commit is contained in:
hathach
2021-03-01 20:25:55 +07:00
parent 0374e08550
commit c222f6f111
5 changed files with 24 additions and 15 deletions

View File

@@ -15,20 +15,8 @@ check_defined = \
__check_defined = \
$(if $(value $1),, \
$(error Undefined make flag: $1$(if $2, ($2))))
# TODO Check if submodule haven't checkout yet
fetch_submodule_if_empty = \
ifeq ($(wildcard $(TOP)/$1/*),) \
$(info $(shell git -C $(TOP) submodule update --init)) \
endif
#-------------- Select the board to build for. ------------
#BOARD_LIST = $(sort $(subst /.,,$(subst $(TOP)/hw/bsp/,,$(wildcard $(TOP)/hw/bsp/*/.))))
#ifeq ($(filter $(BOARD),$(BOARD_LIST)),)
# $(info You must provide a BOARD parameter with 'BOARD=', supported boards are:)
# $(foreach b,$(BOARD_LIST),$(info - $(b)))
# $(error Invalid BOARD specified)
#endif
# Board without family
BOARD_PATH := $(subst $(TOP)/,,$(wildcard $(TOP)/hw/bsp/$(BOARD)))
@@ -42,6 +30,7 @@ ifeq ($(BOARD_PATH),)
endif
ifeq ($(BOARD_PATH),)
$(info You must provide a BOARD parameter with 'BOARD=')
$(error Invalid BOARD specified)
endif
@@ -56,6 +45,16 @@ endif
#TODO $(call fetch_submodule_if_empty,lib/sct_neopixel)
# Fetch submodules depended by family
fetch_submodule_if_empty = \
ifeq ($(wildcard $(TOP)/$1/*),) \
$(info $(shell git -C $(TOP) submodule update --init $1)) \
endif
ifdef FAMILY_SUBMODULES
$(foreach s,$(FAMILY_SUBMODULES),:$(call fetch_submodule_if_empty,$(s)))
endif
#-------------- Cross Compiler ------------
# Can be set by board, default to ARM GCC
CROSS_COMPILE ?= arm-none-eabi-