From 92ed5fd64b0d9786fe3a3b59efd716d2855ad619 Mon Sep 17 00:00:00 2001 From: mrdudz Date: Wed, 26 Nov 2014 19:32:54 +0100 Subject: [PATCH] scan sources just once --- test/err/Makefile | 19 ++++++++++--------- test/misc/Makefile | 21 +++++++++++---------- test/ref/Makefile | 25 +++++++++++++------------ test/val/Makefile | 19 ++++++++++--------- 4 files changed, 44 insertions(+), 40 deletions(-) diff --git a/test/err/Makefile b/test/err/Makefile index f0fcf3486..40ccfcb59 100644 --- a/test/err/Makefile +++ b/test/err/Makefile @@ -19,14 +19,15 @@ WORKDIR := ./../../testwrk .PHONY: all clean -TESTS := $(patsubst %.c,$(WORKDIR)/%.prg,$(wildcard *.c)) -TESTS += $(patsubst %.c,$(WORKDIR)/%.o.prg,$(wildcard *.c)) -TESTS += $(patsubst %.c,$(WORKDIR)/%.os.prg,$(wildcard *.c)) -TESTS += $(patsubst %.c,$(WORKDIR)/%.osi.prg,$(wildcard *.c)) -TESTS += $(patsubst %.c,$(WORKDIR)/%.osir.prg,$(wildcard *.c)) -TESTS += $(patsubst %.c,$(WORKDIR)/%.oi.prg,$(wildcard *.c)) -TESTS += $(patsubst %.c,$(WORKDIR)/%.oir.prg,$(wildcard *.c)) -TESTS += $(patsubst %.c,$(WORKDIR)/%.or.prg,$(wildcard *.c)) +SOURCES := $(wildcard *.c) +TESTS := $(SOURCES:%.c=$(WORKDIR)/%.prg) +TESTS += $(SOURCES:%.c=$(WORKDIR)/%.o.prg) +TESTS += $(SOURCES:%.c=$(WORKDIR)/%.os.prg) +TESTS += $(SOURCES:%.c=$(WORKDIR)/%.osi.prg) +TESTS += $(SOURCES:%.c=$(WORKDIR)/%.osir.prg) +TESTS += $(SOURCES:%.c=$(WORKDIR)/%.oi.prg) +TESTS += $(SOURCES:%.c=$(WORKDIR)/%.oir.prg) +TESTS += $(SOURCES:%.c=$(WORKDIR)/%.or.prg) all: $(TESTS) @@ -48,4 +49,4 @@ $(WORKDIR)/%.or.prg: %.c ! $(CL65) -Or $(CC65FLAGS) $< -o $@ clean: @$(RM) $(TESTS) - @$(RM) $(patsubst %.c,$(WORKDIR)/%.o,$(wildcard *.c)) + @$(RM) $(SOURCES:%.c=$(WORKDIR)/%.o) diff --git a/test/misc/Makefile b/test/misc/Makefile index 0fa550d3f..b18d9165e 100644 --- a/test/misc/Makefile +++ b/test/misc/Makefile @@ -23,14 +23,15 @@ DIFF := $(WORKDIR)/bdiff .PHONY: all clean -TESTS := $(patsubst %.c,$(WORKDIR)/%.prg,$(wildcard *.c)) -TESTS += $(patsubst %.c,$(WORKDIR)/%.o.prg,$(wildcard *.c)) -TESTS += $(patsubst %.c,$(WORKDIR)/%.os.prg,$(wildcard *.c)) -TESTS += $(patsubst %.c,$(WORKDIR)/%.osi.prg,$(wildcard *.c)) -TESTS += $(patsubst %.c,$(WORKDIR)/%.osir.prg,$(wildcard *.c)) -TESTS += $(patsubst %.c,$(WORKDIR)/%.oi.prg,$(wildcard *.c)) -TESTS += $(patsubst %.c,$(WORKDIR)/%.oir.prg,$(wildcard *.c)) -TESTS += $(patsubst %.c,$(WORKDIR)/%.or.prg,$(wildcard *.c)) +SOURCES := $(wildcard *.c) +TESTS := $(SOURCES:%.c=$(WORKDIR)/%.prg) +TESTS += $(SOURCES:%.c=$(WORKDIR)/%.o.prg) +TESTS += $(SOURCES:%.c=$(WORKDIR)/%.os.prg) +TESTS += $(SOURCES:%.c=$(WORKDIR)/%.osi.prg) +TESTS += $(SOURCES:%.c=$(WORKDIR)/%.osir.prg) +TESTS += $(SOURCES:%.c=$(WORKDIR)/%.oi.prg) +TESTS += $(SOURCES:%.c=$(WORKDIR)/%.oir.prg) +TESTS += $(SOURCES:%.c=$(WORKDIR)/%.or.prg) # FIXME: actually use/build differently optimized programs here @@ -60,7 +61,7 @@ $(WORKDIR)/sitest%prg: sitest.c clean: @$(RM) $(TESTS) - @$(RM) $(patsubst %.c,$(WORKDIR)/%.o,$(wildcard *.c)) - @$(RM) $(patsubst %.c,$(WORKDIR)/%.out,$(wildcard *.c)) + @$(RM) $(SOURCES:%.c=$(WORKDIR)/%.o) + @$(RM) $(SOURCES:%.c=$(WORKDIR)/%.out) diff --git a/test/ref/Makefile b/test/ref/Makefile index 2a465b500..b752adc1d 100644 --- a/test/ref/Makefile +++ b/test/ref/Makefile @@ -28,14 +28,15 @@ CFLAGS := -O2 -Wall -W -Wextra -fwrapv -fno-strict-overflow REFS := $(patsubst %.c,$(WORKDIR)/%.ref,$(wildcard *.c)) -TESTS := $(patsubst %.c,$(WORKDIR)/%.prg,$(wildcard *.c)) -TESTS += $(patsubst %.c,$(WORKDIR)/%.o.prg,$(wildcard *.c)) -TESTS += $(patsubst %.c,$(WORKDIR)/%.os.prg,$(wildcard *.c)) -TESTS += $(patsubst %.c,$(WORKDIR)/%.osi.prg,$(wildcard *.c)) -TESTS += $(patsubst %.c,$(WORKDIR)/%.osir.prg,$(wildcard *.c)) -TESTS += $(patsubst %.c,$(WORKDIR)/%.oi.prg,$(wildcard *.c)) -TESTS += $(patsubst %.c,$(WORKDIR)/%.oir.prg,$(wildcard *.c)) -TESTS += $(patsubst %.c,$(WORKDIR)/%.or.prg,$(wildcard *.c)) +SOURCES := $(wildcard *.c) +TESTS := $(SOURCES:%.c=$(WORKDIR)/%.prg) +TESTS += $(SOURCES:%.c=$(WORKDIR)/%.o.prg) +TESTS += $(SOURCES:%.c=$(WORKDIR)/%.os.prg) +TESTS += $(SOURCES:%.c=$(WORKDIR)/%.osi.prg) +TESTS += $(SOURCES:%.c=$(WORKDIR)/%.osir.prg) +TESTS += $(SOURCES:%.c=$(WORKDIR)/%.oi.prg) +TESTS += $(SOURCES:%.c=$(WORKDIR)/%.oir.prg) +TESTS += $(SOURCES:%.c=$(WORKDIR)/%.or.prg) all: $(REFS) $(TESTS) @@ -85,7 +86,7 @@ $(WORKDIR)/%.or.prg: %.c $(WORKDIR)/%.ref clean: @$(RM) $(TESTS) - @$(RM) $(patsubst %.c,$(WORKDIR)/%.o,$(wildcard *.c)) - @$(RM) $(patsubst %.c,$(WORKDIR)/%.out,$(wildcard *.c)) - @$(RM) $(patsubst %.c,$(WORKDIR)/%.ref,$(wildcard *.c)) - @$(RM) $(patsubst %.c,$(WORKDIR)/%.host,$(wildcard *.c)) + @$(RM) $(SOURCES:%.c=$(WORKDIR)/%.o) + @$(RM) $(SOURCES:%.c=$(WORKDIR)/%.out) + @$(RM) $(SOURCES:%.c=$(WORKDIR)/%.ref) + @$(RM) $(SOURCES:%.c=$(WORKDIR)/%.host) diff --git a/test/val/Makefile b/test/val/Makefile index 2dc4796e6..2e0aca278 100644 --- a/test/val/Makefile +++ b/test/val/Makefile @@ -21,14 +21,15 @@ WORKDIR := ./../../testwrk .PHONY: all clean -TESTS := $(patsubst %.c,$(WORKDIR)/%.prg,$(wildcard *.c)) -TESTS += $(patsubst %.c,$(WORKDIR)/%.o.prg,$(wildcard *.c)) -TESTS += $(patsubst %.c,$(WORKDIR)/%.os.prg,$(wildcard *.c)) -TESTS += $(patsubst %.c,$(WORKDIR)/%.osi.prg,$(wildcard *.c)) -TESTS += $(patsubst %.c,$(WORKDIR)/%.osir.prg,$(wildcard *.c)) -TESTS += $(patsubst %.c,$(WORKDIR)/%.oi.prg,$(wildcard *.c)) -TESTS += $(patsubst %.c,$(WORKDIR)/%.oir.prg,$(wildcard *.c)) -TESTS += $(patsubst %.c,$(WORKDIR)/%.or.prg,$(wildcard *.c)) +SOURCES := $(wildcard *.c) +TESTS := $(SOURCES:%.c=$(WORKDIR)/%.prg) +TESTS += $(SOURCES:%.c=$(WORKDIR)/%.o.prg) +TESTS += $(SOURCES:%.c=$(WORKDIR)/%.os.prg) +TESTS += $(SOURCES:%.c=$(WORKDIR)/%.osi.prg) +TESTS += $(SOURCES:%.c=$(WORKDIR)/%.osir.prg) +TESTS += $(SOURCES:%.c=$(WORKDIR)/%.oi.prg) +TESTS += $(SOURCES:%.c=$(WORKDIR)/%.oir.prg) +TESTS += $(SOURCES:%.c=$(WORKDIR)/%.or.prg) all: $(TESTS) @@ -66,4 +67,4 @@ $(WORKDIR)/%.or.prg: %.c clean: @$(RM) $(TESTS) - @$(RM) $(patsubst %.c,$(WORKDIR)/%.o,$(wildcard *.c)) + @$(RM) $(SOURCES:%.c=$(WORKDIR)/%.o) -- 2.39.5