From: Lady Date: Sat, 25 Jan 2025 02:32:09 +0000 (-0500) Subject: Fix prerequisite handling when there are none X-Git-Tag: 1.0.0~1 X-Git-Url: https://git.ladys.computer/Shushe/commitdiff_plain/15648b660cd14e2834629ad52b65ceb313362c9b?hp=7e39a36064ba7afc8c061ca5c2da125756014553 Fix prerequisite handling when there are none 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. --- diff --git a/GNUmakefile b/GNUmakefile index 3ee32a5..c1b34fc 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -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 ─────────────────────────────────────