From e0b2f96f0d01cdc4e888a0668293bcfb2e808879 Mon Sep 17 00:00:00 2001
From: Fred Wright <fw@fwright.net>
Date: Sat, 2 Nov 2024 22:18:38 -0700
Subject: [PATCH] Makefile: Fix test_clean.

The recently added test_clean target was initially misisng a couple
of items, and became much more deficient with the addition of
the new test targets.  This fixes all that, as well as removing
some redundant entries from the main clean target.

TESTED:
All build products from test_all are now removed by test_clean.
---
 Makefile | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index 37be43b..9b4abf2 100644
--- a/Makefile
+++ b/Makefile
@@ -151,6 +151,7 @@ TESTOBJS_C      := $(patsubst %.c,%.o,$(TESTSRCS_C))
 TESTPRGS_C      := $(patsubst %.c,%,$(TESTSRCS_C))
 TESTSPRGS_C     := $(patsubst %.c,%_static,$(TESTSRCS_C))
 TESTSYSPRGS_C   := $(patsubst %.c,%_syslib,$(TESTSRCS_C))
+ALLTESTPRGS     := $(TESTPRGS_C) $(TESTSPRGS_C) $(TESTSYSPRGS_C)
 TESTRUNS        := $(patsubst \
                      $(TESTNAMEPREFIX)%,$(TESTRUNPREFIX)%,$(TESTPRGS_C))
 TESTSRUNS       := $(patsubst \
@@ -502,12 +503,13 @@ $(MANRUNPREFIX)clean:
 	$(RM) $(MANTESTDIR)/*.o $(MANTESTPRGS)
 
 test_clean: xtest_clean $(MANRUNPREFIX)clean
-	$(RM) $(TESTDIR)/*.o $(TESTPRGS) $(XTESTDIR)/*.o $(XTESTPRGS) $(XLIBPATH)
+	$(RM) $(TESTDIR)/*.o $(ALLTESTPRGS) $(XLIBPATH)
+	$(RM) test/test_cmath_* test/test_faccessat_setuid
 	@$(RMDIR) $(XLIBDIR)
 
 clean: $(MANRUNPREFIX)clean test_clean
 	$(RM) $(foreach D,$(SRCDIR),$D/*.o $D/*.o.* $D/*.d)
-	$(RM) $(BUILDDLIBPATH) $(BUILDSLIBPATH) $(BUILDSYSLIBPATH) $(TESTPRGS) test/test_cmath_* test/test_faccessat_setuid
+	$(RM) $(BUILDDLIBPATH) $(BUILDSLIBPATH) $(BUILDSYSLIBPATH)
 	@$(RMDIR) $(BUILDLIBDIR)
 
 .PHONY: all dlib syslib slib clean check test test_cmath xtest
-- 
GitLab