X-Git-Url: https://git.ladys.computer/Shushe/blobdiff_plain/75c707bcd858a98be2286253e2c010350d4db8a7..91f3a166f07e5f260310799a1e1687f45f3c9870:/GNUmakefile diff --git a/GNUmakefile b/GNUmakefile index d0e4346..c601097 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -619,12 +619,12 @@ FORCE : ; .PHONY : FORCE all clean gone help install list listout uninstall $(call built,$(recursivefiles)) ; ifeq ($(notbuilding),) -# Reload this make·file if the magic file, parser, dependencies, or destinations have changed. +# Reload this make·file if the magic file, parser, or transform have changed. # # If the magic file or parser changed, then another restart will be required, as the dependencies and destinations will need to be regenerated. -$(THISDIR)/GNUmakefile : $(BUILDDIR)/magic.mgc $(BUILDDIR)/parser.xslt $(BUILDDIR)/dependencies $(BUILDDIR)/destinations +$(THISDIR)/GNUmakefile : $(BUILDDIR)/magic.mgc $(BUILDDIR)/parser.xslt $(BUILDDIR)/transform.xslt $(silent)$(TOUCH) $(THISDIR)/GNUmakefile - $(if $(filter $(BUILDDIR)/magic.mgc $(BUILDDIR)/parser.xslt,$?),$(call inform,$(PRINTF) '%b\n' '\0033[1mMagic file or parsers have updated. Restarting…\0033[22m' >&2)$(newline)$(silent)$(SLEEP) 1,$(if $(typeupdates),$(silent)$(RM) $(call quote,$(BUILDDIR)/.update-types)$(newline),)$(call inform,$(PRINTF) '%b\n' '\0033[1mDependency graph and output destinations updated. Restarting…\0033[22m' >&2)) + $(if $(filter $(BUILDDIR)/magic.mgc $(BUILDDIR)/parser.xslt,$?),$(call inform,$(PRINTF) '%b\n' '\0033[1mMagic file or parsers have updated. Restarting…\0033[22m' >&2)$(newline)$(silent)$(SLEEP) 1,$(if $(typeupdates),$(silent)$(RM) $(call quote,$(BUILDDIR)/.update-types)$(newline),)$(call inform,$(PRINTF) '%b\n' '\0033[1mDependency graph$(comma) output destinations$(comma) or transforms updated. Restarting…\0033[22m' >&2)) endif # ─ ¶ Build Targets ─────────────────────────────────────────────────── @@ -681,6 +681,8 @@ $(BUILDDIR)/dependencies $(BUILDDIR)/destinations $(BUILDDIR)/metadata : $(call $(silent)$(call unlesstypeswillupdate,{ $(PRINTF) '<书社vocab:BuildDirectory nfo:fileUrl="%s"/>' $(call quote,$(call attresc,$(call fileuri,$(BUILDDIR)))); {$(foreach meta,$(call metadata,$(sort $(sourcefiles) $(sourceincludes))), $(CAT) $(call quote,$(meta));) } | $(SED) 's///g'; $(PRINTF) '%s\n' ''; } | ( $(CD) $(call quote,$(BUILDDIR)); $(XSLTPROC) --nonet --novalid --nomkdir $(call quote,$(abspath $(THISDIR)/lib/expandmetadata.xslt)) - ) | $(XMLLINT) --nonet --nsclean - >|$(call quote,$(BUILDDIR)/metadata)) # Generate the main transform. +# +# Because this depends on the metadata, it will also update the dependencies and destinations. $(BUILDDIR)/transform.catalog : $(call diffprereqs,transforms,$(sort $(TRANSFORMS))) $(call inform,$(PRINTF) '%s\n' 'Generating catalog of transforms…' >&2) $(silent)$(XMLCATALOG) --create --noout $(call quote,$@) @@ -690,7 +692,14 @@ $(BUILDDIR)/transform.xslt : $(BUILDDIR)/transform.catalog $(BUILDDIR)/metadata $(silent)$(XSLTPROC) --nonet --novalid --nomkdir --nowrite --stringparam METADATA $(call quote,$(call fileuri,$(BUILDDIR))/metadata) $(call quote,$(THISDIR)/lib/catalog2transform.xslt) $(call quote,$<) >|$(call quote,$@) # Compile the result files using the dependencies as necessary. -$(call compiled,$(compilablefiles)) : $(BUILDDIR)/results/% : $$(call parsed,$$(call uncompiled,$$@)) $$(call parsed,$$(call dependencies,$$(call uncompiled,$$@))) $(BUILDDIR)/transform.xslt $(TRANSFORMLIBS) $(BUILDDIR)/metadata +# +# Altho this (obviously) depends on the main transform, it is not listed as a prerequisite (rather, the main transform is listed as a prerequisite for the make·file writ large). This is because the transform will update after every metadata change (i·e, basically constantly), but compiled files should only actually be updated in two cases :⁠— +# +# • When one of the actual transforms are updated (tracked by `transform.catalog´), and +# • When the metadata of ⹐source files they depend on⹑ change. +# +# This is to reduce the number of needless regenerations of files with no substantial change. +$(call compiled,$(compilablefiles)) : $(BUILDDIR)/results/% : $$(call parsed,$$(call uncompiled,$$@)) $$(call parsed,$$(call dependencies,$$(call uncompiled,$$@))) $(BUILDDIR)/transform.catalog $(TRANSFORMLIBS) $$(call metadata,$$(call dependencies,$$(call uncompiled,$$@))) $(call inform,$(PRINTF) '%s\n' $(call quote,Compiling …) >&2) $(silent)$(call ensuredirectory,$(dir $@)) $(silent)$(XSLTPROC) --nonet --novalid --nomkdir --nowrite --stringparam METADATA 'metadata' --stringparam BUILDTIME $$($(DATE) -u '+%Y-%m-%dT%H:%M:%SZ') --stringparam IDENTIFIER $(call quote,$(call localuri,$(call uncompiled,$@)))$(if $(THISREV), --stringparam THISREV $(call quote,$(THISREV)),)$(if $(SRCREV), --stringparam SRCREV $(call quote,$(SRCREV)),) $(call quote,$(BUILDDIR)/transform.xslt) $(call quote,$<) >|$(call quote,$@)