X-Git-Url: https://git.ladys.computer/Vocab/blobdiff_plain/9f84b78cf0db742ab8222e2753933e15f5aebeb9..400b8f08c32d7783b9d2b3177303e33eb5cbcc14:/GNUmakefile?ds=sidebyside diff --git a/GNUmakefile b/GNUmakefile index 8714dc4..72bf292 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -1,9 +1,9 @@ -# SPDX-FileCopyrightText: 2023-2024 Lady +# SPDX-FileCopyrightText: 2023, 2024, 2025 Lady # SPDX-License-Identifier: MPL-2.0 SHELL = /bin/sh -# Copyright © 2023–2024 Lady [@ Ladys Computer]. +# Copyright © 2023–2025 Lady [@ Ladys Computer]. # # This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. # If a copy of the M·P·L was not distributed with this file, You can obtain one at . @@ -19,12 +19,9 @@ TEST := test TOUCH := touch XARGS := xargs -DATASRCDIR := data -SITESRCDIR := site +DATADIR := data +SRCDIR := site BUILDDIR := build -DATABUILDDIR := build/data -RDFBUILDDIR := build/rdf -SITEBUILDDIR := build/site BUILDTARGET := .grass DESTDIR := public @@ -32,56 +29,30 @@ THISDIR := $(patsubst %/,%,$(dir $(lastword $(MAKEFILE_LIST)))) SHUSHE := .⛩📰 MAKEOPTS := CP='$(CP)' FIND='$(FIND)' GIT='$(GIT)' MKDIR='$(MKDIR)' PRINTF='$(PRINTF)' RM='$(RM)' SED='$(SED)' TEST='$(TEST)' TOUCH='$(TOUCH)' XARGS='$(XARGS)' - -# Stage 1: Build R·D·F files to build/rdf -SHUSHEDATAOPTS := $(MAKEOPTS) SRCDIR='$(DATASRCDIR)' INCLUDEDIR='$(DATASRCDIR)' BUILDDIR='$(DATABUILDDIR)' DESTDIR='$(RDFBUILDDIR)' EXTRAPARSERS='$(wildcard $(THISDIR)/parsers/data/*.xslt)' EXTRAPARSERLIBS='$(DATASRCDIR)/ontologies/¦' EXTRAFINDINCLUDERULES='-not '"'"'('"'"' '"'"'('"'"' -name ontologies -o -name profiles '"'"')'"'"' -a -type d -a -prune '"'"')'"'"'' EXTRATRANSFORMS='$(wildcard $(THISDIR)/transforms/data/*.xslt)' - -# Stage 2: Build the actual site -SHUSHESITEOPTS := $(MAKEOPTS) SRCDIR='$(SITESRCDIR)' INCLUDEDIR='$(RDFBUILDDIR)' BUILDDIR='$(SITEBUILDDIR)' DESTDIR='$(DESTDIR)' EXTRAPARSERS='$(wildcard $(THISDIR)/parsers/site/*.xslt)' EXTRATRANSFORMS='$(wildcard $(THISDIR)/transforms/site/*.xslt)' +SHUSHEOPTS := $(MAKEOPTS) SRCDIR='$(SRCDIR)' DATADIR='$(DATADIR)' BUILDDIR='$(BUILDDIR)' DESTDIR='$(BUILDDIR)/public' EXTRAPARSERS='$(wildcard $(THISDIR)/parsers/*.xslt)' EXTRAPARSERLIBS='$(DATADIR)/ontologies/¦' EXTRATRANSFORMS='$(wildcard $(THISDIR)/transforms/*.xslt)' YSEME := .👥📤 -YSEMEOPTS := $(MAKEOPTS) BUILDTARGET='.grass' DESTDIR='$(DESTDIR)' SERVERPATH='lady/vocab' +YSEMEOPTS := $(MAKEOPTS) BUILDTARGET='$(BUILDTARGET)' DESTDIR='$(DESTDIR)' SERVERPATH='lady/vocab' -xmls := $(wildcard $(DATASRCDIR)/*/*) +xmls := $(wildcard $(DATADIR)/*/*) # ━ § Call out to ⛩📰 书社 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ install : $(SHUSHE)/GNUmakefile build - @for publicfile in $(patsubst %,"%",$(wildcard $(DESTDIR)/*)); do if $(GIT) check-ignore -q "$$publicfile"; then $(RM) -rf "$$publicfile"; fi; done - @for target in $$($(MAKE) -s -f '$<' listout QUIET=1 $(SHUSHEDATAOPTS)); do $(PRINTF) '%s\n' "$$target" | $(SED) 's/¦/:/g' | $(XARGS) $(PRINTF) 'Copying …\n' >&2; $(PRINTF) '%s\n' "$$target" | $(SED) 's:^:$(DESTDIR)/:;s/¦/:/g' | $(XARGS) $(CP) '$(RDFBUILDDIR)/'"$$target"; done - @for target in $$($(MAKE) -s -f '$<' listout QUIET=1 $(SHUSHESITEOPTS)); do for dir in $$($(FIND) "$(SITEBUILDDIR)/public/$$target" -not -name '.*' -and -type d); do if $(TEST) '!' -d "$(DESTDIR)/$$dir"; then $(PRINTF) '%s\n' "$$dir" | $(SED) 's:$(SITEBUILDDIR)/public/:$(DESTDIR)/:' | $(XARGS) $(MKDIR) -p; fi; done; for file in $$($(FIND) "$(SITEBUILDDIR)/public/$$target" -not '(' -name '.*' -or -type d ')'); do $(PRINTF) '%s\n' "$$file" | $(SED) 's:$(SITEBUILDDIR)/public/:/:;s:/_\(.*\)_\(\..*\)$$:/(\1)\2:g;s/¦/:/g' | $(XARGS) $(PRINTF) 'Copying <%s>…\n' >&2; $(PRINTF) '%s\n' "$$file" | $(SED) 's:$(SITEBUILDDIR)/public/:$(DESTDIR)/:;s:/_\(.*\)_\(\..*\)$$:/(\1)\2:g;s/¦/:/g' | $(XARGS) $(CP) "$$file"; done; done + @for publicfile in $(patsubst %,"%",$(shell $(FIND) '$(DESTDIR)'/*)); do if $(GIT) check-ignore -q "$$publicfile"; then $(RM) -R -f "$$publicfile"; fi; done + @for dir in $$($(FIND) '$(BUILDDIR)/public' -type d | $(SED) 's:$(BUILDDIR)/public/::'); do if $(TEST) '!' -d "$(DESTDIR)/$$dir"; then $(MKDIR) -p "$(DESTDIR)/$$dir"; fi; done + @for file in $$($(FIND) '$(BUILDDIR)/public' -type f | $(SED) 's:$(BUILDDIR)/public/::'); do $(PRINTF) '%s\n' "$$file" | $(SED) 's:/_\(.*\)_\(\..*\)$$:/(\1)\2:g;s/¦/:/g' | $(XARGS) $(PRINTF) 'Copying <%s>…\n' >&2; $(PRINTF) '%s\n' "$$file" | $(SED) 's:^:$(DESTDIR)/:;s:/_\(.*\)_\(\..*\)$$:/(\1)\2:g;s/¦/:/g' | $(XARGS) $(CP) "$(BUILDDIR)/public/$$file"; done $(TOUCH) '$(BUILDTARGET)' build : $(SHUSHE)/GNUmakefile - @$(RM) -rf '$(RDFBUILDDIR)/profiles' - @$(MAKE) -f '$<' install $(SHUSHEDATAOPTS) - @$(MAKE) -f '$<' $(SHUSHESITEOPTS) - -clean : $(SHUSHE)/GNUmakefile - @$(MAKE) -f '$<' $@ $(SHUSHEDATAOPTS) - @$(RM) -rf '$(RDFBUILDDIR)' - @$(MAKE) -f '$<' $@ $(SHUSHESITEOPTS) - -list listout : $(SHUSHE)/GNUmakefile - @$(RM) -rf '$(RDFBUILDDIR)/profiles' - @$(MAKE) -f '$<' install $(SHUSHEDATAOPTS) - @$(MAKE) -f '$<' $@ $(SHUSHESITEOPTS) - -$(BUILDDIR)/data/% : $(SHUSHE)/GNUmakefile FORCE - @$(MAKE) -f '$<' $@ $(SHUSHEDATAOPTS) - -$(BUILDDIR)/rdf/% : $(SHUSHE)/GNUmakefile FORCE - @$(MAKE) -f '$<' $@ $(SHUSHEDATAOPTS) - -$(BUILDDIR)/site/% : $(SHUSHE)/GNUmakefile FORCE - @$(RM) -rf '$(RDFBUILDDIR)/profiles' - @$(MAKE) -f '$<' install $(SHUSHEDATAOPTS) - @$(MAKE) -f '$<' $@ $(SHUSHESITEOPTS) - -$(DESTDIR)/% : $(SHUSHE)/GNUmakefile FORCE - @$(RM) -rf '$(RDFBUILDDIR)/profiles' - @$(MAKE) -f '$<' install $(SHUSHEDATAOPTS) - @$(MAKE) -f '$<' $@ $(SHUSHESITEOPTS) + @$(RM) -R -f '$(BUILDDIR)/public' + @$(MAKE) -f '$<' install $(SHUSHEOPTS) + +clean list listout : $(SHUSHE)/GNUmakefile + @$(MAKE) -f '$<' $@ $(SHUSHEOPTS) + +$(BUILDDIR)/% : $(SHUSHE)/GNUmakefile FORCE + @$(MAKE) -f '$<' $@ $(SHUSHEOPTS) # ━ § Call out to 👥📤 Yseme ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━