1 # SPDX-FileCopyrightText: 2023, 2024 Lady <https://www.ladys.computer/about/#lady>
 
   2 # SPDX-License-Identifier: MPL-2.0
 
   6 # Copyright © 2023–2024 Lady [@ Lady’s Computer].
 
   8 # This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
 
   9 # If a copy of the M·P·L was not distributed with this file, You can obtain one at <https://mozilla.org/MPL/2.0/>.
 
  16 THISDIR := $(patsubst %/,%,$(dir $(lastword $(MAKEFILE_LIST))))
 
  18 INCLUDEDIR := data site/data
 
  23 # SHUSHEOPTS := SRCDIR='$(SRCDIR)' INCLUDEDIR='$(INCLUDEDIR)' DESTDIR='$(DESTDIR)' EXTRAMAGIC='$(wildcard $(LESML)/magic/*) $(wildcard magic/*)' PARSERS='$(LESML)/parser.xslt $(SHUSHE)/parsers/record-jar.xslt $(SHUSHE)/parsers/tsv.xslt $(wildcard parsers/*.xslt)' EXTRATRANSFORMS='$(CAUDEX)/transform.xslt $(wildcard transforms/*.xslt)' EXTRAFINDRULES='-not -name '"'"'*.license'"'"''
 
  24 SHUSHEOPTS := SRCDIR='$(SRCDIR)' INCLUDEDIR='$(INCLUDEDIR)' DESTDIR='$(DESTDIR)' EXTRAMAGIC='$(wildcard magic/*)' PARSERS='$(SHUSHE)/parsers/record-jar.xslt $(SHUSHE)/parsers/tsv.xslt $(wildcard parsers/*.xslt)' EXTRATRANSFORMS='$(wildcard transforms/*.xslt)' EXTRAFINDRULES='-not -name '"'"'*.license'"'"''
 
  26 YSEMEOPTS := BUILDTARGET='$(BUILDTARGET)' DESTDIR='$(DESTDIR)' SERVERPATH='lady/langdev'
 
  28 # ━ § Call out to ⛩📰 书社 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
 
  30 # install : $(SHUSHE)/GNUmakefile $(LESML)/parser.xslt $(CAUDEX)/transform.xslt build
 
  31 install : $(SHUSHE)/GNUmakefile build
 
  32         @for publicfile in $(patsubst %,"%",$(wildcard $(DESTDIR)/*)); do if git check-ignore -q "$$publicfile"; then rm -rf "$$publicfile"; fi; done
 
  33         @$(MAKE) -f '$<' install $(SHUSHEOPTS)
 
  34         @touch '$(BUILDTARGET)'
 
  36 build : $(SHUSHE)/GNUmakefile
 
  37         @$(MAKE) -f '$<' $(SHUSHEOPTS)
 
  39 clean list : $(SHUSHE)/GNUmakefile
 
  40         @$(MAKE) -f '$<' $@ $(SHUSHEOPTS)
 
  42 $(BUILDDIR)/% : $(SHUSHE)/GNUmakefile
 
  43         @$(MAKE) -f '$<' $@ $(SHUSHEOPTS)
 
  45 $(DESTDIR)/% : $(SHUSHE)/GNUmakefile
 
  46         @$(MAKE) -f '$<' $@ $(SHUSHEOPTS)
 
  48 # ━ § Call out to 👥📤 Yseme ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
 
  50 dry-sync sync : $(YSEME)/GNUmakefile
 
  51         $(MAKE) -f '$<' $@ $(YSEMEOPTS)
 
  53 # ━ § Special targets ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
 
  55 .PHONY : FORCE build clean dry-sync gone list prebuild sync uninstall ;
 
  57 gone : clean uninstall ;
 
  60         @for publicfile in $(patsubst %,"%",$(wildcard $(DESTDIR)/*)); do if git check-ignore -q "$$publicfile"; then rm -rf "$$publicfile"; fi; done
 
  64 # ━ § Submodule targets ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
 
  66 ifneq ($(filter $(abspath $(THISDIR))/%,$(abspath $(LESML))),)
 
  67 $(LESML)/parser.xslt : %/GNUmakefile : FORCE
 
  68         git submodule update --init '$*'
 
  71 ifneq ($(filter $(abspath $(THISDIR))/%,$(abspath $(CAUDEX))),)
 
  72 $(CAUDEX)/transform.xslt : %/GNUmakefile : FORCE
 
  73         git submodule update --init '$*'
 
  76 ifneq ($(filter $(abspath $(THISDIR))/%,$(abspath $(SHUSHE))),)
 
  77 $(SHUSHE)/GNUmakefile : %/GNUmakefile : FORCE
 
  78         git submodule update --init '$*'
 
  81 ifneq ($(filter $(abspath $(THISDIR))/%,$(abspath $(YSEME))),)
 
  82 $(YSEME)/GNUmakefile : %/GNUmakefile : FORCE
 
  83         git submodule update --init '$*'