At present, the PREREQ-variable is effectively only used to detect if prerequiste packages haven't run "make all" before make is run in a given package. Also, it's only useful in $(TOPDIR). This commit splits the variable up into PREREQ_BUILD and PREREQ_RUN, and makes the variables available in every Makefile of a package by placing them in defs.mk instead of topdir.mk.
This also fixes a problem that PREREQ was cached before being filled, hence empty. Which effectively wasn't much of a problem, because it was basically unused, but still.
Signed-off-by: Jan Lindemann <jan@janware.com>
34 lines
997 B
Makefile
34 lines
997 B
Makefile
# ----- define these variables
|
|
# CACHED_FILES = $(TOPDIR)/VERSION
|
|
# CACHED_VARS = VERSION
|
|
.PHONY: cache clean-cache clean-cache-projects
|
|
|
|
CACHE_PROJECT_MK ?= .cache-project.mk
|
|
CACHED_VARS_ONLY_PROJECT ?= \
|
|
PROJECT \
|
|
PREREQ_BUILD \
|
|
PREREQ_RUN \
|
|
PREREQ \
|
|
VERSION \
|
|
HEX_VERSION \
|
|
FULL_NAME \
|
|
JW_PKG_LD_LIBRARY_PATH \
|
|
JW_PKG_EXE_PATH \
|
|
JW_PKG_PYTHON_PATH
|
|
all: cache
|
|
clean: clean-cache
|
|
clean-cache:
|
|
rm -f $(CACHE_PROJECT_MK)
|
|
|
|
cache: $(CACHE_PROJECT_MK)
|
|
$(CACHE_PROJECT_MK): $(CACHED_FILES) $(JWBDIR)/make/cache.mk
|
|
@echo 'ifneq ($$(JW_PKG_NO_CACHE),true)' | tee $@.tmp
|
|
@echo $(foreach v,$(CACHED_VARS),$v = $(value $(v)) EOL) | \
|
|
$(SED) 's/\s\+EOL/\n/g;' | \
|
|
$(SED) 's/\s*\(\S\+\)\s*=\s*\(.*\)\s*/ifndef \1\n \1 = \2\nendif\n/g;' | \
|
|
$(SED) 's|$(realpath $(TOPDIR))|$$(TOPDIR)|g' | \
|
|
$(SED) 's|$(realpath $(PROJECTS_DIR))|$$(PROJECTS_DIR)|g' | \
|
|
$(GREP) . | \
|
|
tee -a $@.tmp
|
|
@echo 'endif # ifneq ($$(JW_PKG_NO_CACHE),true)' | tee -a $@.tmp
|
|
mv $@.tmp $@
|