From: Lady Date: Sat, 21 Sep 2024 05:16:33 +0000 (-0400) Subject: Simplify two‐step build X-Git-Tag: 0.13.0 X-Git-Url: https://git.ladys.computer/Shushe/commitdiff_plain/a96b7edb3d0fb828694fb09412073d502689375c?ds=inline Simplify two‐step build The two‐step build originally installed to `$(BUILDDIR)/data`, but this installation step is unnecessary (it just copies over files from the `public/` folder of the first build). This commit uses the `public/` folder of the first build directly, allowing both builds to have the same `$(DESTDIR)` which is only used when actually `make install`ing. This also enables renaming the folders for the first and second build from `stage1/` and `stage2/` to `data/` and `site/`, which are more informative. --- diff --git a/GNUmakefile b/GNUmakefile index 95fcbf4..77185a5 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -789,10 +789,10 @@ else ifeq ($(MODE),urn:fdc:ladys.computer:20231231:Shu1She4:mode:_2stage) override makefile := $(abspath $(THISDIR)/GNUmakefile) # (overridable) Options to use when calling β›©πŸ“° δΉ¦η€Ύ the first time. -shushedataopts := INCLUDEDIR=$(call quote,$(DATADIR)) BUILDDIR=$(call quote,$(BUILDDIR)/stage1) DESTDIR=$(call quote,$(BUILDDIR)/data) FINDRULES=$(call quote,$(FINDRULES) -a '(' $(FINDDATARULES) ')') FINDINCLUDERULES=$(call quote,$(FINDINCLUDERULES)) MODE='urn:fdc:ladys.computer:20231231:Shu1She4:mode:default' +shushedataopts := INCLUDEDIR=$(call quote,$(DATADIR)) BUILDDIR=$(call quote,$(BUILDDIR)/data) FINDRULES=$(call quote,$(FINDRULES) -a '(' $(FINDDATARULES) ')') FINDINCLUDERULES=$(call quote,$(FINDINCLUDERULES)) MODE='urn:fdc:ladys.computer:20231231:Shu1She4:mode:default' # (overridable) Options to use when calling β›©πŸ“° δΉ¦η€Ύ the second time. -shushesiteopts := INCLUDEDIR=$(call quote,$(INCLUDEDIR) $(BUILDDIR)/data) BUILDDIR=$(call quote,$(BUILDDIR)/stage2) FINDRULES=$(call quote,$(FINDRULES) -a '!' '(' $(FINDDATARULES) ')') FINDINCLUDERULES=$(call quote,$(FINDINCLUDERULES)) MODE='urn:fdc:ladys.computer:20231231:Shu1She4:mode:default' +shushesiteopts := INCLUDEDIR=$(call quote,$(INCLUDEDIR) $(BUILDDIR)/data/public) BUILDDIR=$(call quote,$(BUILDDIR)/site) FINDRULES=$(call quote,$(FINDRULES) -a '!' '(' $(FINDDATARULES) ')') FINDINCLUDERULES=$(call quote,$(FINDINCLUDERULES)) MODE='urn:fdc:ladys.computer:20231231:Shu1She4:mode:default' # ─ ΒΆ Recipe Variable Definitions ───────────────────────────────────── @@ -808,16 +808,15 @@ clean : # Build the data and remove outdated data files. data : $(BUILDDIR)/data.out - @$(MAKE) -f $(call quote,$(makefile)) install $(shushedataopts) - $(silent)$(FIND) $(call quote,$(BUILDDIR)/data) '!' -exec $(GREP) -F -q -x '{}' $(call quote,$<) ';' -a '(' -type d -o -print ')' | $(xargsmultiquote) | $(XARGS) -E '' $(RM) + $(silent)$(FIND) $(call quote,$(BUILDDIR)/data/public) '!' -exec $(GREP) -F -q -x '{}' $(call quote,$<) ';' -a '(' -type d -o -print ')' | $(xargsmultiquote) | $(XARGS) -E '' $(RM) # Destroy build directory and installed files. gone : clean uninstall ; # Install the compiled files into `DESTDIRΒ΄. install : all + @$(MAKE) -f $(call quote,$(makefile)) $@ $(shushedataopts) @$(MAKE) -f $(call quote,$(makefile)) $@ $(shushesiteopts) - @$(MAKE) -f $(call quote,$(makefile)) $(foreach dest,$(patsubst $(BUILDDIR)/data/%,$(DESTDIR)/%,$(shell $(CAT) $(call quote,$(BUILDDIR)/data.out))),$(call quote,$(dest))) # List all source files and includes and their computed types. list : data @@ -851,19 +850,16 @@ FORCE : ; $(BUILDDIR)/data.out : FORCE @$(MAKE) -f $(call quote,$(makefile)) $(shushedataopts) - @$(MAKE) -s -f $(call quote,$(makefile)) listout QUIET=1 $(shushedataopts) | $(TR) ' ' '\n' | $(xargsmultiquote) | $(XARGS) -E '' $(PRINTF) $(call quote,$(BUILDDIR)/data/%s\n) >$(call quote,$(BUILDDIR)/data.out) - -$(BUILDDIR)/stage1/% : FORCE - @$(MAKE) -f $(call quote,$(makefile)) $@ $(shushedataopts) + @$(MAKE) -s -f $(call quote,$(makefile)) listout QUIET=1 $(shushedataopts) | $(TR) ' ' '\n' | $(xargsmultiquote) | $(XARGS) -E '' $(PRINTF) $(call quote,$(BUILDDIR)/data/public/%s\n) >$(call quote,$(BUILDDIR)/data.out) $(BUILDDIR)/data/% : FORCE @$(MAKE) -f $(call quote,$(makefile)) $@ $(shushedataopts) -$(BUILDDIR)/stage2/% : data +$(BUILDDIR)/site/% : data @$(MAKE) -f $(call quote,$(makefile)) $@ $(shushesiteopts) $(DESTDIR)/% : data - $(if $(shell $(GREP) -F -x $(call quote,$(BUILDDIR)/data/$*) $(BUILDDIR)/data.out),$(call inform $(PRINTF) '%s\n' $(call quote,Copying over …) >&2)$(newline),$(CP) $(call quote,$(BUILDDIR)/data/$*) $(call quote,$@),@$(MAKE) -f $(call quote,$(makefile)) $@ $(shushesiteopts)) + @$(MAKE) -f $(call quote,$(makefile)) $@ $(if $(shell $(GREP) -F -x $(call quote,$(BUILDDIR)/data/$*) $(BUILDDIR)/data.out),$(shushedataopts),$(shushesiteopts)) # ━ Β§ END DEFINED MAKEΒ·FILE MODES ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━