From 8c6040f234fc0f3975e2dc4de36fec93a6f78b29 Mon Sep 17 00:00:00 2001 From: Doug Torrance Date: Thu, 11 Jun 2026 23:24:43 -0400 Subject: [PATCH] libraries: track submodule fetch via its .git entry, not a stamp file If a SUBMODULE = true library was fetched and then the submodule was deinitialized (e.g. via git submodule deinit), the old .submodule-updated stamp file would remain, causing the build to fail since the submodule directory is empty. Instead of a separate stamp file, make fetch depend directly on submodules/$(LIBNAME)/.git, which is created by update-submodule and removed by deinit. This makes the dependency self-correcting: if the submodule is deinitialized (or never initialized), make reruns update-submodule; if it's already present, fetch is a no-op. Co-Authored-By: Claude Sonnet 4.6 --- M2/libraries/Makefile.library.in | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/M2/libraries/Makefile.library.in b/M2/libraries/Makefile.library.in index f2466bc7867..ca740158c16 100644 --- a/M2/libraries/Makefile.library.in +++ b/M2/libraries/Makefile.library.in @@ -122,10 +122,9 @@ PACKAGE-DISTCLEAN-TARGET := distclean package-distclean: unmark ; if [ -d $(BUILDDIR) ]; then $(MAKE) $(NOTPARALLEL) -C $(BUILDDIR) $(PACKAGE-DISTCLEAN-TARGET) ; fi fetch: download-enabled ifeq ($(SUBMODULE),true) -fetch: .submodule-updated -.submodule-updated: +fetch: @abs_top_srcdir@/submodules/$(LIBNAME)/.git +@abs_top_srcdir@/submodules/$(LIBNAME)/.git: $(MAKE) update-submodule - touch $@ update-submodule: if git rev-parse 2> /dev/null; \ then \ @@ -140,7 +139,6 @@ update-submodule: fi clean:: - rm -f .submodule-updated if git rev-parse 2> /dev/null; \ then \ @GIT@ submodule deinit @abs_top_srcdir@/submodules/$(LIBNAME); \