make: Improve make variable caching machinery #50
Loading…
Reference in a new issue
No description provided.
Delete branch "jan/feature/20260722-make-improve-make-variable-caching-machinery"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This PR improves the generation of makefile snippets caching variables:
.cache-project.mk(project scope) and.cache-projects.mk(caching across all managed projects)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.
py-topdir.mk: PY_CHECK_ROOTS: Don't += assign
py-topdir.mk has this:
That is too involved: Either PY_CHECK_ROOTS is defined, then nothing is appended, or it's undefined, then a simple "=" would be just fine. Use that instead.
cache.mk: Include from topdir.mk, not make.mk
During a topdir "make all", caching variables is currently not the first thing that happens. Instead, variables are cached as soon as a project recurses into the make subdirectory. That was necessary, because some makefiles were regenerated in the make subdirectory by autoconf, potentially contributing variables that needed to be cached.
As of now, autoconf is long gone and this is no longer true. And for some variables, the two step process becomes involved, notably for PYTHONPATH, which coding agents would like to look at from the topdir very early on.
This commit moves the .project-cache.mk creation to topdir.mk, and .projects-cache.mk creation to jw-pkg/Makefile to address that.
py-xxx.mk: Clean more python tool caches
.mypy_cache, .ruff_cache and .pytest_cache are not consistently cleaned in all subdirectories. Fix that.
py-topdir.mk has this: ifndef PY_CHECK_ROOTS PY_CHECK_ROOTS += ... endif That is too involved: Either PY_CHECK_ROOTS is defined, then nothing is appended, or it's undefined, then a simple "=" would be just fine. Use that instead. Signed-off-by: Jan Lindemann <jan@janware.com>7bea55e92636af4a590f