From 892da2d46edff7ad2e244557268309f92f7a0f60 Mon Sep 17 00:00:00 2001 From: Petr Ledvina Date: Thu, 16 Jan 2025 19:14:43 +0100 Subject: [PATCH] Add betaflight/config as submodule (#14158) --- .gitignore | 5 +++-- .gitmodules | 3 +++ mk/config.mk | 7 ++++++- src/config | 1 + 4 files changed, 13 insertions(+), 3 deletions(-) create mode 100644 .gitmodules create mode 160000 src/config diff --git a/.gitignore b/.gitignore index af249aa66c..89126f12e8 100644 --- a/.gitignore +++ b/.gitignore @@ -43,7 +43,7 @@ stm32.mak # artefacts for VS Code /.vscode/ -# artefacts for Visual Studio +# artefacts for Visual Studio /.vs # artefacts for CLion @@ -57,5 +57,6 @@ ubuntu*.log eeprom.bin # config used for building targets -/src/config +# changed to submodule +#/src/config diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000000..d663ecb86f --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "config"] + path = src/config + url = https://github.com/betaflight/config.git diff --git a/mk/config.mk b/mk/config.mk index ab2386da40..0cbe356da3 100644 --- a/mk/config.mk +++ b/mk/config.mk @@ -1,6 +1,7 @@ CONFIGS_REPO_URL ?= https://github.com/betaflight/config - +# handle only this directory as config submodule +CONFIGS_SUBMODULE_DIR = src/config BASE_CONFIGS = $(sort $(notdir $(patsubst %/,%,$(dir $(wildcard $(CONFIG_DIR)/configs/*/config.h))))) ifneq ($(filter-out %_install test% %_clean clean% %-print %.hex %.h hex checks help configs $(BASE_TARGETS) $(BASE_CONFIGS),$(MAKECMDGOALS)),) @@ -50,12 +51,16 @@ endif #config .PHONY: configs configs: +ifeq ($(shell realpath $(CONFIG_DIR)),$(shell realpath $(CONFIGS_SUBMODULE_DIR))) + git submodule update --init -- $(CONFIGS_SUBMODULE_DIR) +else ifeq ($(wildcard $(CONFIG_DIR)),) @echo "Hydrating clone for configs: $(CONFIG_DIR)" $(V0) git clone $(CONFIGS_REPO_URL) $(CONFIG_DIR) else $(V0) git -C $(CONFIG_DIR) pull origin endif +endif $(BASE_CONFIGS): @echo "Building target config $@" diff --git a/src/config b/src/config new file mode 160000 index 0000000000..b0f3ab0cc9 --- /dev/null +++ b/src/config @@ -0,0 +1 @@ +Subproject commit b0f3ab0cc91f80ab930d599da03446f8c54feb8c