make: Further improve build time

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>
This commit is contained in:
Jan Lindemann 2019-02-28 13:22:12 +00:00
commit 9e245c986e
7 changed files with 176 additions and 109 deletions

View file

@ -1,7 +1,7 @@
# == Variables for inter-project-communication
# -- What do I know about myself?
VERSION_FILE ?= $(firstword $(wildcard VERSION) $(TOPDIR)/VERSION)
VERSION_FILE := $(firstword $(wildcard VERSION) $(TOPDIR)/VERSION)
ifndef DEVELOPMENT
ifeq ($(wildcard $(VERSION_FILE)),)
DEVELOPMENT := true
@ -17,13 +17,13 @@ ifeq ($(DEVELOPMENT),true)
else
PRJS_DIR ?= /opt
endif
MOD_SCRIPT_DIR ?= $(firstword $(wildcard $(MODDIR)/scripts $(MODDIR)/bin))
MOD_SCRIPT_DIR := $(firstword $(wildcard $(MODDIR)/scripts $(MODDIR)/bin))
# -- Query the build system about other projects:
PYTHON ?= /usr/bin/python2
ifneq ($(TOPDIR),)
proj_query_cmd = $(PYTHON) $(MOD_SCRIPT_DIR)/projects.py -p $(PRJS_DIR) -t $(TOPDIR) $(PROJECTS_PY_EXTRA_ARGS)
proj_query = $(shell $(proj_query_cmd) $(1))
proj_dir = $(call proj_query,proj-dir $(1))
htdocs_dir = $(call proj_query,htdocs-dir $(1))
proj_query_cmd = $(PYTHON) $(MOD_SCRIPT_DIR)/projects.py -p $(PRJS_DIR) -t $(TOPDIR) $(PROJECTS_PY_EXTRA_ARGS)
proj_query = $(shell $(proj_query_cmd) $(1))
proj_dir = $(call proj_query,proj-dir $(1))
htdocs_dir = $(call proj_query,htdocs-dir $(1))
endif