make: Adopted simpler filter-out pattern for finding source files

So:

    $(filter-out %.t.c %.b.c %.a.c,$(wildcard bd/*.c))

Instead of:

    $(filter-out $(wildcard bd/*.t.* bd/*.b.*),$(wildcard bd/*.c))

The main benefit is we no longer need to explicitly specify all
subdirectories, though the single wildcard is a bit less flexible if
test.py/bench.py ever end up with other non-C artifacts.

Unfortunately only a single wildcard is supported in filter-out.
This commit is contained in:
Christopher Haster
2025-05-15 18:19:08 -05:00
parent 7c8c7e662a
commit d5432ca0df
+3 -3
View File
@@ -9,7 +9,7 @@ endif
# find source files
SRC ?= $(filter-out $(wildcard *.t.* *.b.*),$(wildcard *.c))
SRC ?= $(filter-out %.t.c %.b.c %.a.c,$(wildcard *.c))
OBJ := $(SRC:%.c=$(BUILDDIR)/%.o)
DEP := $(SRC:%.c=$(BUILDDIR)/%.d)
ASM := $(SRC:%.c=$(BUILDDIR)/%.s)
@@ -19,7 +19,7 @@ GCDA := $(SRC:%.c=$(BUILDDIR)/%.t.a.gcda)
TESTS ?= $(wildcard tests/*.toml)
TEST_SRC ?= \
$(SRC) \
$(filter-out $(wildcard bd/*.t.* bd/*.b.*),$(wildcard bd/*.c)) \
$(filter-out %.t.c %.b.c %.a.c,$(wildcard bd/*.c)) \
runners/test_runner.c
TEST_RUNNER ?= $(BUILDDIR)/runners/test_runner
TEST_C := \
@@ -38,7 +38,7 @@ TEST_CSV := $(TEST_RUNNER:%=%.csv)
BENCHES ?= $(wildcard benches/*.toml)
BENCH_SRC ?= \
$(SRC) \
$(filter-out $(wildcard bd/*.t.* bd/*.b.*),$(wildcard bd/*.c)) \
$(filter-out %.t.c %.b.c %.a.c,$(wildcard bd/*.c)) \
runners/bench_runner.c
BENCH_RUNNER ?= $(BUILDDIR)/runners/bench_runner
BENCH_C := \