]> Lady’s Gitweb - Shushe/commitdiff
Fix prerequisite handling when there are none
authorLady <redacted>
Sat, 25 Jan 2025 02:32:09 +0000 (21:32 -0500)
committerLady <redacted>
Sat, 25 Jan 2025 02:32:09 +0000 (21:32 -0500)
In a directory with no sources, there won’t be any metadata, and so
the `$(and …)` in `$(diffprereqs)` would exit early, before creating
the file in `$(BUILDDIR)/lastprereqs`. However, this latter file is
still returned as a prerequisite. This commit touches it if it doesn’t
exist to ensure it is always created.

GNUmakefile

index 3ee32a5edf55de9ce7188951e9fdfd642e6ed075..c1b34fc7821285246f689478ff2c29fff8d6bf7b 100644 (file)
@@ -354,7 +354,7 @@ override notbuilding := $(and $(filter help clean,$(MAKECMDGOALS)),$(call not,$(
 # 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),,$(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)
+override diffprereqs = $(if $(notbuilding),,$(and $(or $(wildcard $(BUILDDIR)/lastprereqs/$1),$(shell $(TOUCH) $(call quote,$(BUILDDIR)/lastprereqs/$1)),1),$(subst $(shell $(CAT) $(call quote,$(BUILDDIR)/lastprereqs/$1) 2>>/dev/null || :),,$2),$(shell $(call ensuredirectory,$(BUILDDIR)/lastprereqs) && $(PRINTF) '%s\n' $(call quote,$2) >|$(call quote,$(BUILDDIR)/lastprereqs/$1)),)$2 $(BUILDDIR)/lastprereqs/$1)
 
 # ─ ¶ Recipe Variable Definitions ─────────────────────────────────────
 
This page took 0.060481 seconds and 4 git commands to generate.