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>
This commit is contained in:
Jan Lindemann 2026-07-08 19:34:41 +02:00
commit 6325f9ea19
Signed by: Jan Lindemann
GPG key ID: 3750640C9E25DD61

View file

@ -12,8 +12,10 @@ endef
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,$(CACHE_PROJECTS_MK)))
endif
$(eval $(call try_include,$(JWBDIR)/make/pre-local.mk))
$(eval $(call try_include,$(TOPDIR)/make/pre-local.mk))
$(eval $(call try_include,pre-local.mk))