]> Lady’s Gitweb - Caudex/blobdiff - GNUmakefile
Update β›©πŸ“° δΉ¦η€Ύ; use πŸ’„πŸ“ LesΒ·MΒ·L as markup format
[Caudex] / GNUmakefile
index 8fa6dfc5f79c7cc2ab828a0b0de8bc5a2c55a491..274a0b448814b2e30b2ed8bac762ab80ba1d257e 100644 (file)
@@ -8,7 +8,7 @@ override define makefileinfo
 β•Ÿβ”¬ ΒΆ Prerequisites β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β•’
 β•‘β”‚                                                            β”‚β•‘
 β•‘β”‚ Requires GΒ·NΒ·U Make, at least version 3.81, and all of the β”‚β•‘
-β•‘β”‚ requirements of β›©οΈπŸ“° δΉ¦η€Ύ, which is included as a git      β”‚β•‘
+β•‘β”‚ requirements of β›©πŸ“° δΉ¦η€Ύ, which is included as a git      β”‚β•‘
 β•‘β”‚ submodule. Run `make help-shusheΒ΄ for more information.    β”‚β•‘
 β•‘╰────────────────────────────────────────────────────────────╯║
 β•Ÿβ”¬ ΒΆ Usage β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β•’
@@ -44,7 +44,7 @@ override define makefileinfo
 β•‘╰────────────────────────────────────────────────────────────╯║
 β•Ÿβ”¬ ΒΆ Copyright & License β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β•’
 β•‘β”‚                                                            β”‚β•‘
-β•‘β”‚ Copyright Β© 2024 Lady [@ Lady’s Computer].                 β”‚β•‘
+β•‘β”‚ Copyright Β© 2024 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  β”‚β•‘
@@ -60,10 +60,9 @@ endef
 #
 # If these are not installed on your computer, or you need to use a different implementation, you can override the appropriate variable.
 #
-# See also the documentation for β›©οΈπŸ“° δΉ¦η€Ύ, which specifies additional programs.
+# See also the documentation for β›©πŸ“° δΉ¦η€Ύ, which specifies additional programs.
 AWK := awk
 CAT := cat
-ECHO := echo
 GIT := git
 MKDIR := mkdir
 OD := od
@@ -90,38 +89,40 @@ BUILDDIR := build
 # The directory into which to output files on `makeΒ΄.
 DESTDIR := public
 
-# The location of this Makefile (and related β›©οΈπŸ“° δΉ¦η€Ύ files), relative to the current working directory.
+# The location of this Makefile, relative to the current working directory.
+#
+# It is expected that other files packaged as a part of πŸͺΎπŸ“° Caudex can also be found in this directory.
 #
 # By default, this is inferred from the variable `MAKEFILE_LISTΒ΄.
 THISDIR := $(patsubst %/,%,$(dir $(lastword $(MAKEFILE_LIST))))
 
-# Extra magic files to forward to β›©οΈπŸ“° δΉ¦η€Ύ.
+# Extra magic files to forward to β›©πŸ“° δΉ¦η€Ύ.
 #
 # Your computer probably has several already installed at `/usr/share/file/magicΒ΄.
 EXTRAMAGIC :=
 
-# Extra parsers to forward to β›©οΈπŸ“° δΉ¦η€Ύ.
+# Extra parsers to forward to β›©πŸ“° δΉ¦η€Ύ.
 #
 # Which parsers are provided will influence which kinds of files are recognized as plaintext.
 EXTRAPARSERS :=
 
-# Extra transforms to forward to β›©οΈπŸ“° δΉ¦η€Ύ.
+# Extra transforms to forward to β›©πŸ“° δΉ¦η€Ύ.
 EXTRATRANSFORMS :=
 
+# A description of the current git revision of πŸͺΎπŸ“° Caudex.
+THISREV := $(shell cd $(THISDIR); $(GIT) describe 2> /dev/null || $(GIT) rev-parse HEAD 2> /dev/null || true)
+
 # Variables to communicate to further calls to Make.
 #
 # By default, `MAKEOVERRIDESΒ΄ contains all variable overrides specified on the commandline.
 # However, some values are specific to πŸͺΎπŸ“° Caudex and may have different meaning in other makeΒ·files; filter these out.
-MAKEOVERRIDES := $(filter-out SRCDIR=% ASSETDIR=% BUILDDIR=% DESTDIR=% THISDIR=% EXTRAMAGIC=% EXTRAPARSERS=% EXTRATRANSFORMS=%,$(MAKEOVERRIDES))
+MAKEOVERRIDES := $(filter-out SRCDIR=% ASSETDIR=% BUILDDIR=% DESTDIR=% THISDIR=% EXTRAMAGIC=% EXTRAPARSERS=% EXTRATRANSFORMS=% THISREV=%,$(MAKEOVERRIDES))
 
-# The location of β›©οΈπŸ“° δΉ¦η€Ύ.
-SHUSHE := $(THISDIR)/.β›©οΈπŸ“°
+# The location of πŸ’„πŸ“ LesΒ·MΒ·L.
+LESML := $(THISDIR)/.πŸ’„πŸ“
 
-# The name of the generator program.
-GENERATOR := πŸͺΎπŸ“°Β Caudex
-
-# A description of the current git revision of πŸͺΎπŸ“° Caudex.
-VERSION := $(shell cd $(THISDIR); $(GIT) describe 2> /dev/null || $(GIT) rev-parse HEAD 2> /dev/null || true)
+# The location of β›©πŸ“° δΉ¦η€Ύ.
+SHUSHE := $(THISDIR)/.β›©πŸ“°
 
 # Set to a nonΒ·empty value to print all commands as they run.
 VERBOSE :=
@@ -160,7 +161,7 @@ override entriesforcategory = $(sort $(foreach category,$1,$(wildcard $(SRCDIR)/
 override wrmg = $(foreach attempt,$(shell $(OD) -t u4 -N 4 /dev/random | $(SED) 's/^[0-9]* *//' | $(TR) -d ' \n' | $(AWK) 'BEGIN{chars="0123456789ABCDEFGHJKMNPQRSTVWXYZ&~@=U"}{d=32^5;r=$$0%(32^6);printf("%s",substr(chars,r%37,1));while(d>0){printf("%s", substr(chars,int(r/d),1));if(d==32^4)printf("%s", "-");r%=d;d=int(d/32)}}'),$(if $(wildcard $(SRCDIR)/*/($(attempt))*),$(call wrmg),$(attempt)))
 
 # (callable) Returns the identifiers of the provided entries.
-override identifier = $(shell $(TR) ' ' '\n' <<< $(call quote,$1) | $(SED) 's/^\(.*[/]\)\{0,1\}\(.\{3\}-.\{4\}\)\(,[^/]*\)\{0,1\}$$/\2/')
+override identifier = $(shell $(PRINTF) '%s\n' $(call quote,$1) | $(TR) ' ' '\n' | $(SED) 's/^\(.*[/]\)\{0,1\}\(.\{3\}-.\{4\}\)\(,[^/]*\)\{0,1\}$$/\2/')
 
 # Output locations for compiled catalog files for categories.
 override categorycatalogs := $(patsubst %,$(BUILDDIR)/catalogs/categories/%/index,$(categories))
@@ -171,8 +172,8 @@ override entrycatalogs := $(foreach entry,$(call entriesforcategory,$(categories
 # Output locations for all compiled catalog files.
 override allcatalogs := $(BUILDDIR)/catalogs/indices/index $(BUILDDIR)/catalogs/indices/fullindex $(categorycatalogs) $(entrycatalogs)
 
-# (overridable) Options to pass to β›©οΈπŸ“° δΉ¦η€Ύ.
-override shusheopts := SRCDIR=$(call quote,$(if $(wildcard $(ASSETDIR)),$(ASSETDIR),) $(if $(entrycatalogs),$(BUILDDIR)/catalogs/entries,) $(BUILDDIR)/catalogs/indices) BUILDDIR=$(call quote,$(BUILDDIR)/β›©οΈπŸ“°) INCLUDEDIR=$(call quote,$(SRCDIR) $(if $(wildcard $(ASSETINCLUDEDIR)),$(ASSETINCLUDEDIR),) $(if $(categorycatalogs),$(BUILDDIR)/catalogs/categories,)) DESTDIR=$(call quote,$(DESTDIR)) EXTRAMAGIC=$(call quote,$(sort $(patsubst ./%,%,$(wildcard $(THISDIR)/magic/*)) $(EXTRAMAGIC))) EXTRAPARSERS=$(call quote,$(sort $(patsubst ./%,%,$(wildcard $(THISDIR)/parsers/*.xslt)) $(EXTRAPARSERS))) EXTRATRANSFORMS=$(call quote,$(sort $(patsubst ./%,%,$(wildcard $(THISDIR)/transforms/*.xslt)) $(EXTRATRANSFORMS))) GENERATOR=$(call quote,$(GENERATOR)) VERSION=$(call quote,$(VERSION))
+# (overridable) Options to pass to β›©πŸ“° δΉ¦η€Ύ.
+override shusheopts := SRCDIR=$(call quote,$(if $(wildcard $(ASSETDIR)),$(ASSETDIR),) $(if $(entrycatalogs),$(BUILDDIR)/catalogs/entries,) $(BUILDDIR)/catalogs/indices) BUILDDIR=$(call quote,$(BUILDDIR)/β›©πŸ“°) INCLUDEDIR=$(call quote,$(SRCDIR) $(if $(wildcard $(ASSETINCLUDEDIR)),$(ASSETINCLUDEDIR),) $(if $(categorycatalogs),$(BUILDDIR)/catalogs/categories,)) DESTDIR=$(call quote,$(DESTDIR)) EXTRAMAGIC=$(call quote,$(sort $(patsubst ./%,%,$(wildcard $(THISDIR)/magic/*)) $(LESML)/magic $(EXTRAMAGIC))) EXTRAPARSERS=$(call quote,$(sort $(patsubst ./%,%,$(wildcard $(THISDIR)/parsers/*.xslt)) $(LESML)/parser.xslt $(EXTRAPARSERS))) EXTRATRANSFORMS=$(call quote,$(sort $(patsubst ./%,%,$(wildcard $(THISDIR)/transforms/*.xslt)) $(EXTRATRANSFORMS)))
 
 # β”€ ΒΆ Recipe Variable Definitions β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
 
@@ -206,14 +207,14 @@ $(silent)$(XMLCATALOG) --add uri '@' '@' --noout $(call quote,$(BUILDDIR)/catalo
 $(foreach category,$(categories),$(silent)$(XMLCATALOG) --add uri $(call quote,$(category)) $(call quote,$(category)/index) --noout $(call quote,$(BUILDDIR)/catalogs/indices/$(if $1,full,)index)$(newline))
 endef
 
-# β”€ ΒΆ β›©οΈπŸ“° δΉ¦η€Ύ Targets β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
+# β”€ ΒΆ β›©πŸ“° δΉ¦η€Ύ Targets β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
 
-# Targets to forward to β›©οΈπŸ“° δΉ¦η€Ύ.
+# Targets to forward to β›©πŸ“° δΉ¦η€Ύ.
 all install list uninstall : $(SHUSHE)/GNUmakefile catalogs
        $(silent)$(MAKE) -f $(call quote,$<) $(call quote,$@) $(shusheopts)
 %-shushe : $(SHUSHE)/GNUmakefile FORCE
        $(silent)$(MAKE) -f $(call quote,$<) $(call quote,$*) $(shusheopts)
-build/β›©οΈπŸ“°/% : $(SHUSHE)/GNUmakefile catalogs FORCE
+build/β›©πŸ“°/% : $(SHUSHE)/GNUmakefile catalogs FORCE
        $(SILENT)$(MAKE) -f $(call quote,$<) $(call quote,$@) $(shusheopts)
 public/% : $(SHUSHE)/GNUmakefile catalogs FORCE
        $(SILENT)$(MAKE) -f $(call quote,$<) $(call quote,$@) $(shusheopts)
@@ -243,13 +244,13 @@ listids :
 
 # Output a random unused identifier.
 wrmg :
-       @$(ECHO) $(wrmg)
+       @$(PRINTF) '%s\n' $(wrmg)
 
 # Create a new entry in the provided category and output its path.
 +% : FORCE
        $(silent)$(call ensuredirectory,$(SRCDIR)/$*)
        $(if $(wildcard $(SRCDIR)/$*/@),,$(silent)$(PRINTF) '%b' '%%\nCATEGORY : $*\n%%\n' > '$(SRCDIR)/$*/@')
-       $(foreach identifier,$(wrmg),@$(PRINTF) '%b' '%%\nENTRY : $(identifier)\n%%\n\n' > '$(SRCDIR)/$*/$(identifier)'$(newline)@$(ECHO) '$(SRCDIR)/$*/$(identifier)')
+       $(foreach identifier,$(wrmg),@$(PRINTF) '%b' '\0043!lesml\nENTRY : $(identifier)\n%%\n\n' > '$(SRCDIR)/$*/$(identifier)'$(newline)@$(PRINTF) '%s\n' '$(SRCDIR)/$*/$(identifier)')
 
 # β”€ ΒΆ Special Targets β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
 
@@ -269,14 +270,19 @@ FORCE : ;
 
 # β”€ ΒΆ Build Targets β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
 
-# Initialize the β›©οΈπŸ“° δΉ¦η€Ύ repository if it is empty.
+# Initialize the β›©πŸ“° δΉ¦η€Ύ repository if it is empty.
+ifneq ($(filter $(THISDIR)/%,$(SHUSHE)),)
 $(SHUSHE)/GNUmakefile : $(THISDIR)/%/GNUmakefile :
        @$(PRINTF) '%s\n' $(call quote,Initializing git submodule at `$*Β΄)
        $(silent)cd $(THISDIR) && $(GIT) submodule update --init $(call quote,$*)
+endif
 
-# Touch parsers and transforms if the files in `lib/Β΄ have changed.
-$(PARSERS) $(TRANSFORMS) : $(wildcard lib/*.xslt)
-       $(silent)$(TOUCH) $(call quote,$@)
+# Initialize the πŸ’„πŸ“ LesΒ·MΒ·L repository if it is empty.
+ifneq ($(filter $(THISDIR)/%,$(LESML)),)
+$(LESML)/parser.xslt : $(THISDIR)/%/parser.xslt :
+       @$(PRINTF) '%s\n' $(call quote,Initializing git submodule at `$*Β΄)
+       $(silent)cd $(THISDIR) && $(GIT) submodule update --init $(call quote,$*)
+endif
 
 # Create an empty codex metadata file if none exists.
 $(SRCDIR)/@ :
This page took 0.029367 seconds and 4 git commands to generate.