CXXFLAGS := -std=c++20 -O2 -Wall -Wextra sources := $(wildcard *.cc) progs := $(patsubst %.cc,%,$(sources)) .PHONY: all all: $(progs) .PHONY: clean clean: rm -f $(progs) $(progs:=_test.txt) .PHONY: test test: $(addprefix test-,$(progs)) .PHONY: test-% test-%: %_test.txt @test -f $*_output.txt && (diff -u $*_output.txt $<; rm -f $<) || true @test -f $*_output.txt || cat $< $(progs:=_test.txt): %_test.txt: % ./$< $*_input.txt > $@