From: Lady <redacted>
Date: Sat, 6 Jul 2024 22:50:57 +0000 (-0400)
Subject: Support -exec in find
X-Git-Tag: 0.9.5
X-Git-Url: https://git.ladys.computer/Shushe/commitdiff_plain/61fbca06b3685821c2705475ba73ce3fd2b76d86?hp=2db421961f071b1614ceab02ff092be404c8d3df

Support -exec in find

`-print` is only implicitly added to `find` rules which do not contain
an `-exec`. The desired behaviour is that `-print` is called
regardless, with the assumption that `-exec` commands are always
silent.
---

diff --git a/GNUmakefile b/GNUmakefile
index 6fd1970..931f32d 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -344,10 +344,10 @@ override perenc = $(shell $(PRINTF) '%s\n' $(foreach unencoded,$1,$(call quote,$
 override pathenc = $(subst %2F,/,$(call perenc,$1))
 
 # (overridable) Collect all of the applicable includes from the includes directory.
-sourceincludes := $(if $(and $(INCLUDEDIR),$(wildcard $(INCLUDEDIR))),$(patsubst ./%,%,$(shell $(FIND) $(foreach dir,$(INCLUDEDIR),$(call quote,$(dir))) '(' $(FINDINCLUDERULES) ')' -a -type f)),)
+sourceincludes := $(if $(and $(INCLUDEDIR),$(wildcard $(INCLUDEDIR))),$(patsubst ./%,%,$(shell $(FIND) $(foreach dir,$(INCLUDEDIR),$(call quote,$(dir))) '(' $(FINDINCLUDERULES) ')' -a -type f -a -print)),)
 
 # (overridable) Collect all of the applicable source files from the source directory, removing any which are also includes.
-sourcefiles := $(if $(and $(SRCDIR),$(wildcard $(SRCDIR))),$(filter-out $(sourceincludes),$(patsubst ./%,%,$(shell $(FIND) $(foreach dir,$(SRCDIR),$(call quote,$(dir))) '(' $(FINDRULES) ')' -a -type f))))
+sourcefiles := $(if $(and $(SRCDIR),$(wildcard $(SRCDIR))),$(filter-out $(sourceincludes),$(patsubst ./%,%,$(shell $(FIND) $(foreach dir,$(SRCDIR),$(call quote,$(dir))) '(' $(FINDRULES) ')' -a -type f -a -print))))
 
 # Figure out the file type of each source file and source include.
 ifneq ($(wildcard $(BUILDDIR)/magic.mgc),)
diff --git a/README.markdown b/README.markdown
index 6b865ae..040d564 100644
--- a/README.markdown
+++ b/README.markdown
@@ -283,6 +283,8 @@ The following additional variables can be used to control the behaviour
     those which end with a cloparen, and those which contain a hash,
     buck, percent, asterisk, colon, semi, eroteme, bracket, backslash,
     or pipe.
+  It is important that these rules not produce any output, as anything
+    printed to `stdout` will be considered a result of the find.
 
 - **`EXTRAFINDRULES`:**
   The value of this variable is appended to `FINDRULES` by default, to