The Singular Nexus
Ensure only one instance of a global magical state exists across the build graph.
✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Singleton
ARCANUM SCHOOL: Abjuration // State Binding
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// CODEX INCANTATION //
# A Singleton in Make is often represented by a unique, one-time generated file or evaluated variable.
# We use the $(eval ...) function and a check to ensure it's only computed once.
ifndef NEXUS_CORE
$(info [Singleton] Initializing the Nexus Core...)
# Costly arcane computation
NEXUS_CORE := $(shell date +%N)
export NEXUS_CORE
endif
.PHONY: invoke_a invoke_b
invoke_a:
@echo "Invocation A draws upon Nexus: $(NEXUS_CORE)"
invoke_b:
@echo "Invocation B draws upon Nexus: $(NEXUS_CORE)"
.PHONY: all
all: invoke_a invoke_b
Runic Tags:
#makefile
#creational
#singleton
#nexus