From e3c4a07216d4059cf69db95ab7363ee22281887c Mon Sep 17 00:00:00 2001 From: Kai Krakow Date: Sun, 21 Jan 2018 00:04:53 +0100 Subject: [PATCH] Makefile: Unclutter "make test" output This adds a .txt Makefile target to create a text file which receives the test program output. In case the test failed, it will cat the contents and fail the target. Execution of each test itself is forced, so it would run every time make is invoked, thus no failing test would be missed. Signed-off-by: Kai Krakow --- test/Makefile | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/test/Makefile b/test/Makefile index d2b87a8..b92f895 100644 --- a/test/Makefile +++ b/test/Makefile @@ -9,7 +9,8 @@ PROGRAMS = \ all: test -test: $(PROGRAMS) Makefile +test: $(PROGRAMS:%=%.txt) Makefile +FORCE: include ../makeflags @@ -33,7 +34,9 @@ include depends.mk $(PROGRAMS): %: %.o ../makeflags Makefile @echo "Implicit rule %: %.o" $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) - ./$@ + +%.txt: % Makefile FORCE + ./$< >$@ 2>&1 || (RC=$$?; cat $@; exit $$RC) clean: - rm -fv $(PROGRAMS:%=%.o) $(PROGRAMS) + rm -fv $(PROGRAMS:%=%.o) $(PROGRAMS:%=%.txt) $(PROGRAMS)