║│ • cksum │║
║│ • cp │║
║│ • date │║
-║│ • echo │║
║│ • file │║
║│ • find │║
║│ • grep │║
CKSUM := cksum
CP := cp
DATE := date
-ECHO := echo
FILE := file
FIND := find
GIT := git
# It must be updated if any of the files in the magic directory change.
$(BUILDDIR)/magic.mgc : $(call diffprereqs,magic,$(sort $(call magicfile,$(MAGIC))))
$(foreach outdated,$(filter-out $^,$(wildcard $(BUILDDIR)/magic/*)),$(silent)$(RM) $(call quote,$(outdated))$(newline))
- @$(ECHO) "Compiling new magic…"
+ @$(PRINTF) '%s\n' 'Compiling new magic…'
$(silent)$(call ensuredirectory,$(dir $@))
$(silent)cd $(call quote,$(BUILDDIR)) && $(FILE) -C -m $(call quote,$(realpath $(BUILDDIR)/magic))
$(silent)$(TOUCH) $(call quote,$(BUILDDIR)/.update-types)
# Generate the main parser.
$(BUILDDIR)/parser.catalog : $(call diffprereqs,parsers,$(sort $(PARSERS)))
- @$(ECHO) "Generating catalog of parsers…"
+ @$(PRINTF) '%s\n' 'Generating catalog of parsers…'
$(silent)$(XMLCATALOG) --create --noout $(call quote,$@)
$(foreach parser,$(PARSERS),$(silent){ $(call id,$(parser)); printf '%s\n' $(call quote,$(call fileuri,$(parser))) '--noout' $(call quote,$@); } | $(xargsmultiquote) | $(XARGS) -E '' $(XMLCATALOG) --add uri$(newline))
$(BUILDDIR)/parser.xslt : $(BUILDDIR)/parser.catalog $(THISDIR)/lib/catalog2parser.xslt
- @$(ECHO) "Generating main parser…"
+ @$(PRINTF) '%s\n' 'Generating main parser…'
$(silent)$(XSLTPROC) --nonet --novalid -o $(call quote,$@) $(call quote,$(THISDIR)/lib/catalog2parser.xslt) $(call quote,$<)
$(silent)$(TOUCH) $(call quote,$(BUILDDIR)/.update-types)
#
# This does not depend on actually transforming the files.
$(BUILDDIR)/catalog : $(call diffprereqs,sources,$(sort $(sourcefiles) $(sourceincludes))) $(typeupdates)
- @$(ECHO) "Generating catalog of parsed files…"
+ @$(PRINTF) '%s\n' 'Generating catalog of parsed files…'
$(silent)$(XMLCATALOG) --create --noout $(call quote,$@)
$(foreach source,$(sourcefiles) $(sourceincludes),$(silent)$(XMLCATALOG) --add uri $(call quote,$(call localuri,$(source))) $(call quote,$(call fileuri,$(call parsed,$(source)))#$(if $(filter $(source),$(assetfiles)),asset,xml)) --noout $(call quote,$@)$(newline))
# Build a list of dependencies for each parsed file.
$(BUILDDIR)/dependencies : $(BUILDDIR)/catalog $(call parsed,$(plaintextfiles) $(xmlfiles)) $(THISDIR)/lib/catalog2dependencies.xslt
- @$(ECHO) "Identifying dependencies…"
+ @$(PRINTF) '%s\n' 'Identifying dependencies…'
$(silent)$(TOUCH) $(call quote,$@)
$(silent)$(XSLTPROC) --nonet --novalid -o $(call quote,$@) $(call quote,$(THISDIR)/lib/catalog2dependencies.xslt) $(call quote,$<)
# This depends on parsing non·asset source files, but not assets or includes.
# It does not require knowing the dependencies.
$(BUILDDIR)/destinations : $(BUILDDIR)/catalog $(call parsed,$(filter-out $(assetfiles),$(sourcefiles))) $(THISDIR)/lib/catalog2destinations.xslt
- @$(ECHO) "Identifying output destinations…"
+ @$(PRINTF) '%s\n' 'Identifying output destinations…'
$(silent)$(TOUCH) $(call quote,$@)
$(silent)$(XSLTPROC) --nonet --novalid -o $(call quote,$@) $(call quote,$(THISDIR)/lib/catalog2destinations.xslt) $(call quote,$<)
# Generate the main transform.
$(BUILDDIR)/transform.catalog : $(call diffprereqs,transforms,$(sort $(TRANSFORMS)))
- @$(ECHO) "Generating catalog of transforms…"
+ @$(PRINTF) '%s\n' 'Generating catalog of transforms…'
$(silent)$(XMLCATALOG) --create --noout $(call quote,$@)
$(foreach transform,$(TRANSFORMS),$(silent){ $(call id,$(transform)); printf '%s\n' $(call quote,$(call fileuri,$(transform))) '--noout' $(call quote,$@); } | $(xargsmultiquote) | $(XARGS) -E '' $(XMLCATALOG) --add uri$(newline))
$(BUILDDIR)/transform.xslt : $(BUILDDIR)/transform.catalog $(THISDIR)/lib/catalog2transform.xslt
- @$(ECHO) "Generating main transform…"
+ @$(PRINTF) '%s\n' 'Generating main transform…'
$(silent)$(XSLTPROC) --nonet --novalid -o $(call quote,$@) $(call quote,$(THISDIR)/lib/catalog2transform.xslt) $(call quote,$<)
# Compile the result files using the dependencies as necessary.