]> Lady’s Gitweb - Shushe/commitdiff
Fix/improve restarts by just waiting a sec 0.1.1
authorLady <redacted>
Mon, 1 Jan 2024 06:32:28 +0000 (01:32 -0500)
committerLady <redacted>
Tue, 2 Jan 2024 18:26:27 +0000 (13:26 -0500)
The previous method of attempting to retroactively reduce the timestamp
of the make·file when compiling dependencies hasn’t seemed reliable in
practice and probably isn’t portable either. However, a simple
`sleep 1` after touching the make·file but before the first restart
seems to reliably ensure the second restart happens.

GNUmakefile
README.markdown

index fe0cbd520b186730404087ea44891270872e70a4..e0cb8e17ec906c0b99e712ff7bc47db62bc3ade3 100644 (file)
@@ -22,7 +22,9 @@ override define makefileinfo
 ║│ • mkdir (requires support for `-p´)                        │║
 ║│ • mv                                                       │║
 ║│ • printf                                                   │║
+║│ • rm                                                       │║
 ║│ • sed                                                      │║
+║│ • sleep                                                    │║
 ║│ • test                                                     │║
 ║│ • touch                                                    │║
 ║│ • tr (requires support for `-d´)                           │║
@@ -57,7 +59,10 @@ override define makefileinfo
 ║│ See `README.markdown´ for a more involved description of   │║
 ║│ the capabilities and configuration of this program.        │║
 ║╰────────────────────────────────────────────────────────────╯║
-╟┬ ¶ License ─────────────────────────────────────────────────┬╢
+╟┬ ¶ Copyright & License ─────────────────────────────────────┬╢
+║│                                                            │║
+║│ Copyright © 2023–2024 Lady [@ Lady’s 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      │║
@@ -82,6 +87,7 @@ MV := mv
 PRINTF := printf
 RM := rm
 SED := sed
+SLEEP := sleep
 TEST := test
 TOUCH := touch
 TR := tr
@@ -323,16 +329,22 @@ $(call compiled,$(recursivefiles)): $(BUILDDIR)/public/%:
 # Phony rules; always consider these out‐of‐date.
 .PHONY: all default clean gone info install list $(call compiled,$(recursivefiles));
 
+ifeq ($(wildcard $(BUILDDIR)/.update-types),)
 # 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.
+#
+# This recipe sleeps for one second to ensure that files built after
+# the restart have a more current time·stamp.
 $(THISDIR)/GNUmakefile:: $(BUILDDIR)/magic.mgc $(BUILDDIR)/parser.xslt $(THISDIR)/lib/parser2types.xslt
        $(silent)$(TOUCH) $(THISDIR)/GNUmakefile
        $(silent)$(TOUCH) $(call quote,$(BUILDDIR)/.update-types)
        $(silent)$(RM) -f $(call quote,$(BUILDDIR)/dependencies)
        @$(PRINTF) '%b\n' '\0033[1mMagic file or parsers have updated. Restarting…\0033[22m'
+       $(silent)$(SLEEP) 1
+endif
 
 ifneq ($(wildcard $(BUILDDIR)/.update-types)$(wildcard $(BUILDDIR)/dependencies),)
 # Reload this make·file if the dependency graph has changed.
@@ -399,14 +411,9 @@ $(BUILDDIR)/catalog: $(sourcefiles) $(sourceincludes) $(typeupdates)
        $(foreach source,$(sourcefiles) $(sourceincludes),$(silent)$(XMLCATALOG) --add uri $(call quote,$(call localuri,$(source))) $(call quote,$(patsubst $(BUILDDIR)/%,%,$(call parsed,$(source)))#$(if $(filter $(source),$(assetfiles)),asset,xml)) --noout $(call quote,$@)$(newline))
 
 # Build a list of dependencies for each transformed file.
-#
-# This recipe also adjusts backwards the modification time of this
-# make·file by one second, to ensure that it is always more outdated
-# than the built dependencies (triggering a restart).
 $(BUILDDIR)/dependencies: $(BUILDDIR)/catalog $(call parsed,$(plaintextfiles) $(xmlfiles)) $(THISDIR)/lib/catalog2dependencies.xslt
        @$(ECHO) "Identifying dependencies…"
        $(silent)$(XSLTPROC) -o $(call quote,$@) $(call quote,$(THISDIR)/lib/catalog2dependencies.xslt) $(call quote,$<)
-       $(silent)$(TOUCH) -A -000001 -am $(THISDIR)/GNUmakefile
 
 # Generate the main transform.
 $(BUILDDIR)/transform.catalog: $(TRANSFORMS)
index 51aca8d383ac5162e1c8f6265298708f74d80323..2dd0eff9a54e61711e6e07238c32e37198e1eeab 100644 (file)
@@ -99,7 +99,9 @@ In every case, you may supply your own implementation by overriding the
 - `mkdir` (requires support for `-p`)
 - `mv`
 - `printf`
+- `rm`
 - `sed`
+- `sleep`
 - `test`
 - `touch`
 - `tr` (requires support for `-d`)
This page took 0.029134 seconds and 4 git commands to generate.