Orchestration specification

Make Module Registries

Make modules register their targets and requirements into shared lists, and aggregate targets are composed from whatever registered.

Applies at
scripts/build/
Status
Stable

01 Defines

How independent make modules contribute to repository-wide commands without editing them: each module appends to a registry variable, and the aggregate targets expand those registries after every module has loaded.

02 Applies when

  • A repository command such as build, validate, clean, or doctor must cover several unrelated toolchains.
  • Make modules are added to or removed from a repository over time.
  • Shared modules come from a global library as well as from the repository.

03 Boundaries

  • Registries carry target names and requirements, not the work itself; the work lives in each module’s own targets.
  • Which components exist — Hugo sites, Terraform roots — is declared in repository.mk, not discovered.

Expected behaviour

  1. 01
    Each module appends to registries such as BUILD_TARGETS, VALIDATE_TARGETS, CLEAN_TARGETS, and DOCTOR_TOOLS with +=.
  2. 02
    00-config.mk initialises every registry; 90-aggregates.mk sorts last and turns registries into targets.
  3. 03
    Removing a module file removes its registrations, and nothing else needs to change.
  4. 04
    Modules load in the fixed MAKE_MODULE_ORDER, resolved from library directories first and the repository second.

Behaviour#

The root Makefile is identical in every repository. It includes the repository’s configuration and then a fixed sequence of numbered modules. Each module is self-contained: it defines its own targets and registers them by appending to shared lists. No module edits another.

FlowAssembling the command surface
  1. 01 Configure repository.mk declares components; 00-config.mk initialises empty registries
  2. 02 Register Each module appends: BUILD_TARGETS += check.hugo, DOCTOR_TOOLS += terraform
  3. 03 Aggregate 90-aggregates.mk is read last, so build: $(BUILD_TARGETS) sees every registration
  4. 04 Run make build, make validate, and make clean cover whatever modules are present

The registries#

RegistryConsumed byExample registration
BUILD_TARGETSmake buildBUILD_TARGETS += check.hugo
VALIDATE_TARGETSmake validateVALIDATE_TARGETS += check.links
FORMAT_CHECK_TARGETSformat-checkFORMAT_CHECK_TARGETS += check.terraform.fmt
TEST_TARGETSmake test—
CLEAN_TARGETSmake cleanCLEAN_TARGETS += clean.hugo
DOCTOR_TOOLSmake doctorDOCTOR_TOOLS += hugo
DOCTOR_FILESmake doctorDOCTOR_FILES += .linter/ignore
DOCTOR_SNIPPETSmake doctora named shell check

Module resolution#

Modules load in a fixed order. Each name resolves to the first match across the global library directories and then the repository’s own scripts/build/, so a repository can rely on a shared module or carry its own.

  • scripts/build/
  • 00-config.mk Shared defaults; initialises every registry
  • 10-help.mk make help, generated from ## comments Self-Documenting Help
  • 20-doctor.mk Environment diagnostics Environment Doctor
  • 30-repo.mk Repository hygiene and formatting
  • 40-docs.mk Markdown and link checks
  • 52-hugo.mk Hugo sites Static Websites
  • 53-terraform.mk Terraform format, validate, lint
  • 70-security.mk Secret, vulnerability, and IaC scanning
  • 81-deploy.mk Deployment Static Site Delivery
  • 90-aggregates.mk Aggregate targets; must sort last
  • repository.mk Component lists for this repository

Examples#

A module registers itself and guards its own work. The Hugo module adds hugo to the doctor’s tool list only when the repository declares a site:

scripts/build/52-hugo.mk
ifneq ($(strip $(HUGO_DIRS)),)
DOCTOR_TOOLS += hugo
endif

BUILD_TARGETS += check.hugo
CLEAN_TARGETS += clean.hugo