make: Improve make variable caching machinery #50

Merged
Jan Lindemann merged 4 commits from jan/feature/20260722-make-improve-make-variable-caching-machinery into master 2026-07-22 14:53:17 +02:00 AGit
Showing only changes of commit 6325f9ea19 - Show all commits

platform.mk: Fix make -C $(TOPDIR)/make clean all

If run from $(TOPDIR), "make clean all" runs fine, because it
recurses twice into $(TOPDIR)/make, once for every target. If invoked
directly from $(TOPDIR)/make, it can break in two different ways:

If the cache files don't exist, "make clean all" in $(TOPDIR)/make
tries to create them too early as implicit make target. This leaves
variables empty which should have a value.

If the cache files do exist, "make clean all" in $(TOPDIR)/make
includes them, cleans them, and re-creates them from the same
variables just read from cache. Undesirable for cache purging.

Signed-off-by: Jan Lindemann <jan@janware.com>
Jan Lindemann 2026-07-08 19:34:41 +02:00
Signed by: Jan Lindemann
GPG key ID: 3750640C9E25DD61

View file

@ -12,8 +12,10 @@ endef
CACHE_PROJECTS_MK := $(JWBDIR)/cache-projects.mk CACHE_PROJECTS_MK := $(JWBDIR)/cache-projects.mk
ifeq ($(filter clean distclean,$(MAKECMDGOALS)),)
$(eval $(call try_include,$(TOPDIR)/make/.cache-project.mk)) $(eval $(call try_include,$(TOPDIR)/make/.cache-project.mk))
$(eval $(call try_include,$(CACHE_PROJECTS_MK))) $(eval $(call try_include,$(CACHE_PROJECTS_MK)))
endif
$(eval $(call try_include,$(JWBDIR)/make/pre-local.mk)) $(eval $(call try_include,$(JWBDIR)/make/pre-local.mk))
$(eval $(call try_include,$(TOPDIR)/make/pre-local.mk)) $(eval $(call try_include,$(TOPDIR)/make/pre-local.mk))
$(eval $(call try_include,pre-local.mk)) $(eval $(call try_include,pre-local.mk))