From: Lady Date: Mon, 1 Apr 2024 23:38:48 +0000 (-0400) Subject: Don’t “compile” assets, just “build” X-Git-Tag: 0.7.0~2 X-Git-Url: https://git.ladys.computer/Shushe/commitdiff_plain/8f60c082aa14e189db3de44d460b76967fa6dd1b?ds=inline Don’t “compile” assets, just “build” This reserves the `build/results/` directory for _just_ the results of transformations, and delays the copying of asset files into the build directory until the actual “build” step. (Likewise for recursive files, altho these still just error). `make all` now builds all installable files, including assets, which were formerly excluded. A downstream script might expect assets to appear in `build/public` after a `make all` and shouldn’t require a `make install` to get them. --- diff --git a/GNUmakefile b/GNUmakefile index 98a08cb..efa5c19 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -373,12 +373,15 @@ override sourcecompiledpair := $(foreach file,$(sourcefiles),$(file)|$(BUILDDIR) # (callable) Get the location of the transformed X·M·L files for the given source files. override compiled = $(foreach file,$1,$(patsubst $(file)|%,%,$(filter $(file)|%,$(sourcecompiledpair)))) -# (callable) Get the source files for the given compiled file. +# (callable) Get the location of the source files for the given compiled file. override uncompiled = $(foreach file,$1,$(patsubst %|$(file),%,$(filter %|$(file),$(sourcecompiledpair)))) -# (callable) Get the location of the final built file for the given source files. +# (callable) Get the location of the final built files for the given source files. override built = $(foreach file,$1,$(patsubst $(BUILDDIR)/results/%,$(BUILDDIR)/public/%,$(call compiled,$(file)))) +# (callable) Get the location of the source files for the given built files. +override unbuilt = $(foreach file,$1,$(call uncompiled,$(patsubst $(BUILDDIR)/public/%,$(BUILDDIR)/results/%,$(file)))) + # (callable) Get the installed locations for the given source files. override installed = $(foreach file,$1,$(DESTDIR)/$(call destination,$(file))) endif @@ -410,7 +413,7 @@ override extracttext = $(PRINTF) '%s' ' $(call quote,$@); elif $(call xpath,/*[local-name()="base64-binary" and namespace-uri()="urn:fdc:ladys.computer:20231231:Shu1She4"],$<); then $(RM) -f $(call quote,$@); $(call extracttext,$<) | $(TR) -d '\t\n\f\r ' | $(UUDECODE) -m -r > $(call quote,$@); else $(LN) -s -f $(call quote,$(subst $(space),,$(foreach component,$(subst /, ,$*),../))results/$*) $(call quote,$@); fi -$(call built,$(filter $(assetfiles),$(sourcefiles)) $(recursivefiles)) : $(BUILDDIR)/public/% : $(BUILDDIR)/results/% +$(call built,$(filter $(assetfiles),$(sourcefiles))) : $(BUILDDIR)/public/% : $$(call unbuilt,$$@) @$(PRINTF) '%s\n' $(call quote,Building …) $(silent)$(call ensuredirectory,$(dir $@)) - $(silent)$(LN) -s -f $(call quote,../results/$*) $(call quote,$@) + $(silent)$(CP) $(call quote,$<) $(call quote,$@) # Install compiled files (or error in the case of recursive ones). -$(call installed,$(filter $(assetfiles),$(sourcefiles)) $(recursivefiles) $(compilablefiles)) : $(DESTDIR)/% : $(BUILDDIR)/public/% +$(call installed,$(recursivefiles) $(installablefiles)) : $(DESTDIR)/% : $(BUILDDIR)/public/% @$(PRINTF) '%s\n' $(call quote,Installing …) $(silent)$(call ensuredirectory,$(dir $@)) $(silent)$(CP) $(call quote,$<) $(call quote,$@)