]> Lady’s Gitweb - Shushe/commitdiff
Use diffprereqs files as dependencies, not FORCE
authorLady <redacted>
Sun, 15 Sep 2024 19:08:51 +0000 (15:08 -0400)
committerLady <redacted>
Sun, 15 Sep 2024 20:01:25 +0000 (16:01 -0400)
“`diffprereqs`” files are updated whenever the prereqs change, as part
of dependency expansion (and so, obviously, before dependency
comparison). So depending on them is effectively the same as depending
on FORCE iff the dependency changed. However, this approach continues
working across Make restarts.

Previously, if a transform was removed, but Make restarted due to a
parser change, the removal would be ignored because the prereqs would
be updated on the first run but the transform catalog would not. This
commit resolves this issue.

GNUmakefile

index 94f5efa26f5f4a33cbc62a59d406da3ce08e3ed8..c654ddbfcc160d9423a1858440c7bcb6cbb72b6c 100644 (file)
@@ -348,16 +348,16 @@ ifeq ($(MODE),urn:fdc:ladys.computer:20231231:Shu1She4:mode:default)
 # Non·empty if `help´ or `clean´, and no targets other than `help´ or `clean´, were specified as goals on the commandline.
 override notbuilding := $(and $(filter help clean,$(MAKECMDGOALS)),$(call not,$(filter-out help clean,$(MAKECMDGOALS))))
 
-# (callable) Test to see if the prerequisites provided by the second argument matches the value in the file corresponding to the first argument in `$(BUILDDIR)/lastprereqs´.
-# If not, save the new value and then add FORCE.
-# Return them regardless.
+# (callable) Tests to see if the prerequisites provided by the second argument matches the value in the file corresponding to the first argument in `$(BUILDDIR)/lastprereqs´.
+# If not, saves the new value.
+# Returns the values plus the file in `$(BUILDDIR)/lastprereqs´, which will always be newer than the target if there was a change.
 #
 # Calling this variable is useful when a given target should be updated whenever its list of prerequisites changes in addition to whenever there is a change to one of its prerequisites.
 #
 # If `$(notbuilding)´ is non·empty, this variable produces no result to avoid unnecessary work.
 #
 # ☡ This variable creates at least one subshell every time it is computed.
-override diffprereqs = $(if $(notbuilding),,$(if $(subst $(shell $(CAT) $(call quote,$(BUILDDIR)/lastprereqs/$1) 2>>/dev/null || :),,$2),$2 FORCE$(and $(shell $(call ensuredirectory,$(BUILDDIR)/lastprereqs) && $(PRINTF) '%s\n' $(call quote,$2) >|$(BUILDDIR)/lastprereqs/$1),),$2))
+override diffprereqs = $(if $(notbuilding),,$(and $(subst $(shell $(CAT) $(call quote,$(BUILDDIR)/lastprereqs/$1) 2>>/dev/null || :),,$2),$(shell $(call ensuredirectory,$(BUILDDIR)/lastprereqs) && $(PRINTF) '%s\n' $(call quote,$2) >|$(BUILDDIR)/lastprereqs/$1),)$2 $(BUILDDIR)/lastprereqs/$1)
 
 # (callable) Escape special characters for use in X·M·L.
 override xmlesc = $(subst >,&gt;,$(subst <,&lt;,$(subst &,&amp;,$1)))
This page took 0.02894 seconds and 4 git commands to generate.