From: Lady Date: Sun, 4 Feb 2024 01:04:49 +0000 (-0500) Subject: Add parser.xslt as a prerequisite for parsing X-Git-Tag: 0.5.3~1 X-Git-Url: https://git.ladys.computer/Shushe/commitdiff_plain/d4281613317ae20f8d443ec17b2f0ed5fd62581b Add parser.xslt as a prerequisite for parsing Although this file will generally be generated as a part of the make·file restart loop, it is possible to wind up with an early error during dependency generation if files cannot be parsed prior to resolving make·file dependencies. Depend on it in this case as well, with the understanding that this will update the types yet again. If `parser.xslt` _is_ generated as a part of dependency generation (and, presumably, `.update-types` does not exist) then the dependency update message should be suppressed, since the other make·file build script will also be present and active. --- diff --git a/GNUmakefile b/GNUmakefile index d760073..a784f21 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -422,19 +422,25 @@ $(call compiled,$(recursivefiles)) : # Phony rules; always consider these out·of·date. .PHONY : all default clean gone info install list uninstall $(call compiled,$(recursivefiles)) ; -ifneq ($(wildcard $(BUILDDIR)/.update-types)$(wildcard $(BUILDDIR)/dependencies)$(wildcard $(BUILDDIR)/destinations),) +ifneq ($(typeupdates)$(wildcard $(BUILDDIR)/dependencies)$(wildcard $(BUILDDIR)/destinations),) # Reload this make·file if the dependency graph or output destinations have changed. # # The dependency graph and output destinations are used to set the values of variables in this make·file, so it’s important to ensure that they are actually up·to·date prior to executing any later rules. # # This recipe only exists after types have been updated or when the dependency graph or destinations file already exists. +# +# ※ There is a chance that generating the dependencies will also update the parsers. $(THISDIR)/GNUmakefile :: $(BUILDDIR)/dependencies $(BUILDDIR)/destinations $(silent)$(TOUCH) $(THISDIR)/GNUmakefile - $(silent)$(RM) -f $(BUILDDIR)/.update-types +ifeq ($(typeupdates),) + @if $(TEST) ! -f $(call quote,$(BUILDDIR)/.update-types); then $(PRINTF) '%b\n' '\0033[1mDependency graph and output destinations updated. Restarting…\0033[22m'; fi +else + $(silent)$(RM) $(BUILDDIR)/.update-types @$(PRINTF) '%b\n' '\0033[1mDependency graph and output destinations updated. Restarting…\0033[22m' endif +endif -ifeq ($(wildcard $(BUILDDIR)/.update-types),) +ifeq ($(typeupdates),) # Reload this make·file if any of the magic files or parsers have changed. # # These are used to classify source files, so if they have changed then the make·file must be reloaded. @@ -450,9 +456,8 @@ endif # ─ ¶ Build Targets ─────────────────────────────────────────────────── -# Create symbolic links from the build directory’s store of magic files -# to their corresponding sources. -$(call magicfile,$(MAGIC)) : $(BUILDDIR)/magic/%: $$(call magicsource,$$@) +# Create symbolic links from the build directory’s store of magic files to their corresponding sources. +$(call magicfile,$(MAGIC)) : $(BUILDDIR)/magic/% : $$(call magicsource,$$@) $(silent)$(call ensuredirectory,$(dir $@)) $(silent)$(LN) -sf $(call quote,$(realpath $<)) $(call quote,$@) @@ -465,21 +470,23 @@ $(BUILDDIR)/magic.mgc : $(call magicfile,$(MAGIC)) @$(ECHO) "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 : $(PARSERS) @$(ECHO) "Generating catalog of parsers…" $(silent)$(XMLCATALOG) --create --noout $(call quote,$@) $(foreach parser,$(PARSERS),$(silent)( $(call id,$(parser)) ) | $(XARGS) -I %% $(XMLCATALOG) --add uri %% $(call quote,$(call fileuri,$(parser))) --noout $(call quote,$@)$(newline)) -$(BUILDDIR)/parser.xslt: $(BUILDDIR)/parser.catalog $(THISDIR)/lib/catalog2parser.xslt +$(BUILDDIR)/parser.xslt : $(BUILDDIR)/parser.catalog $(THISDIR)/lib/catalog2parser.xslt @$(ECHO) "Generating main parser…" $(silent)$(XSLTPROC) -o $(call quote,$@) $(call quote,$(THISDIR)/lib/catalog2parser.xslt) $(call quote,$<) + $(silent)$(TOUCH) $(call quote,$(BUILDDIR)/.update-types) # Parse the files. # # Even plain X·M·L files are parsed, because they may contain X·H·T·M·L `