summaryrefslogtreecommitdiff
path: root/examples/make.mk
diff options
context:
space:
mode:
authorHa Thach <[email protected]>2021-03-02 12:44:28 +0700
committerGitHub <[email protected]>2021-03-02 12:44:28 +0700
commita3a9a5efb91b56429ac75c0a81101dedd524eba0 (patch)
treecd83f56098b7f2022b5875aff6206bdbc9815241 /examples/make.mk
parent0374e085507cd23124d9cc6d5f2b10565717b72d (diff)
parentb066fdc2c69591412d2b7c9111a122266cd9f87a (diff)
Merge pull request #690 from hathach/submodule-on-the-fly
Submodule on the fly
Diffstat (limited to 'examples/make.mk')
-rw-r--r--examples/make.mk27
1 files changed, 14 insertions, 13 deletions
diff --git a/examples/make.mk b/examples/make.mk
index 5387a4ec4..173f5598a 100644
--- a/examples/make.mk
+++ b/examples/make.mk
@@ -15,24 +15,14 @@ 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)))
+ifneq ($(wildcard $(TOP)/hw/bsp/$(BOARD)/board.mk),)
+BOARD_PATH := hw/bsp/$(BOARD)
FAMILY :=
+endif
# Board within family
ifeq ($(BOARD_PATH),)
@@ -42,6 +32,7 @@ ifeq ($(BOARD_PATH),)
endif
ifeq ($(BOARD_PATH),)
+ $(info You must provide a BOARD parameter with 'BOARD=')
$(error Invalid BOARD specified)
endif
@@ -56,6 +47,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-