1
0
Mirror von https://github.com/tkuschel/bees.git synchronisiert 2026-06-19 06:57:54 +02:00

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 <kai@kaishome.de>
Dieser Commit ist enthalten in:
Kai Krakow
2018-01-21 00:04:53 +01:00
committet von Zygo Blaxell
Ursprung d8241a7720
Commit e3c4a07216
+6 -3
Datei anzeigen
@@ -9,7 +9,8 @@ PROGRAMS = \
all: test all: test
test: $(PROGRAMS) Makefile test: $(PROGRAMS:%=%.txt) Makefile
FORCE:
include ../makeflags include ../makeflags
@@ -33,7 +34,9 @@ include depends.mk
$(PROGRAMS): %: %.o ../makeflags Makefile $(PROGRAMS): %: %.o ../makeflags Makefile
@echo "Implicit rule %: %.o" @echo "Implicit rule %: %.o"
$(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $< $(LIBS)
./$@
%.txt: % Makefile FORCE
./$< >$@ 2>&1 || (RC=$$?; cat $@; exit $$RC)
clean: clean:
rm -fv $(PROGRAMS:%=%.o) $(PROGRAMS) rm -fv $(PROGRAMS:%=%.o) $(PROGRAMS:%=%.txt) $(PROGRAMS)