rp2,esp32,extmod: Implement UPDATE_SUBMODULES in CMake.

Rather than having Make calling CMake to generate a list of submodules and
then run a Make target (which is complex and prone to masking other
errors), implement the submodule update logic in CMake itself.

Internal CMake-side changes are that GIT_SUBMODULES is now a CMake list,
and the trigger variable name is changed from ECHO_SUBMODULES to
UPDATE_SUBMODULES.

The run is otherwise 100% a normal CMake run now, so most of the other
special casing can be removed.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
This commit is contained in:
Angus Gratton
2025-03-11 17:17:39 +11:00
committed by Damien George
parent 2db0c0225f
commit cccac2cc01
7 changed files with 111 additions and 104 deletions

View File

@@ -262,19 +262,14 @@ endif
# If available, do blobless partial clones of submodules to save time and space.
# A blobless partial clone lazily fetches data as needed, but has all the metadata available (tags, etc.).
# Fallback to standard submodule update if blobless isn't available (earlier than 2.36.0)
#
# Note: This target has a CMake equivalent in py/mkrules.cmake
submodules:
$(ECHO) "Updating submodules: $(GIT_SUBMODULES)"
ifneq ($(GIT_SUBMODULES),)
$(Q)cd $(TOP) && git submodule sync $(GIT_SUBMODULES)
$(Q)cd $(TOP) && git submodule update --init --filter=blob:none $(GIT_SUBMODULES) || \
git submodule update --init $(GIT_SUBMODULES)
else
ifeq ($(GIT_SUBMODULES_FAIL_IF_EMPTY),1)
# If you see this error, it may mean the internal step run by the port's build
# system to find git submodules has failed. Double-check dependencies are set correctly.
$(ECHO) "Internal build error: The submodule list should not be empty."
exit 1
endif
endif
.PHONY: submodules