mirror of
ssh://git.janware.com/srv/git/janware/proj/jw-pkg
synced 2026-01-15 12:03:31 +01:00
This commit sees several improvements to the build performance: - Introduce cache.mk, which creates makefiles caching often used variables, per tree and per project. - Define more variables with := enclosed in condistions, instead of defining them with ?=, because the RHS of ?= is expanded deferredly. - Add more definitions for executables. - Move some more specialized definitions out into specialized makefiles, notably htdocs.mk and tmpl.mk Signed-off-by: Jan Lindemann <jan@janware.com>
22 lines
637 B
Makefile
22 lines
637 B
Makefile
# ----- define these variables
|
|
# CACHED_FILES = $(TOPDIR)/VERSION
|
|
# CACHED_VARS = VERSION
|
|
|
|
CACHE_FILE_MK ?= .cache.mk
|
|
|
|
# if not checked against MAKECMDGOALS, a standard rule kicks in from rules.mk,
|
|
# and $(CACHE_FILE_MK) is remade with the clean target
|
|
ifeq ($(findstring clean,$(MAKECMDGOALS)),)
|
|
all: $(CACHE_FILE_MK)
|
|
$(CACHE_FILE_MK): $(CACHED_FILES) $(MODDIR)/make/cache.mk
|
|
ifeq ($(wildcard $(CACHE_FILE_MK)),)
|
|
@echo $(foreach v,$(CACHED_VARS),$v := $(value $(v))EOL) | $(SED) 's/EOL */\n/g;' | $(GREP) . | tee $@.tmp
|
|
mv $@.tmp $@
|
|
else
|
|
rm $@
|
|
make $@
|
|
endif
|
|
endif
|
|
clean: clean-cache
|
|
clean-cache:
|
|
$(RM) -f $(CACHE_FILE_MK)
|