mirror of
				https://github.com/Zygo/bees.git
				synced 2025-11-04 12:10:34 +01:00 
			
		
		
		
	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>
		
			
				
	
	
		
			43 lines
		
	
	
		
			800 B
		
	
	
	
		
			Makefile
		
	
	
	
	
	
			
		
		
	
	
			43 lines
		
	
	
		
			800 B
		
	
	
	
		
			Makefile
		
	
	
	
	
	
PROGRAMS = \
 | 
						|
	chatter \
 | 
						|
	crc64 \
 | 
						|
	fd \
 | 
						|
	limits \
 | 
						|
	path \
 | 
						|
	process \
 | 
						|
	task \
 | 
						|
 | 
						|
all: test
 | 
						|
 | 
						|
test: $(PROGRAMS:%=%.txt) Makefile
 | 
						|
FORCE:
 | 
						|
 | 
						|
include ../makeflags
 | 
						|
 | 
						|
LIBS = -lcrucible -lpthread
 | 
						|
LDFLAGS = -L../lib -Wl,-rpath=$(shell realpath ../lib)
 | 
						|
 | 
						|
.depends/%.dep: %.cc tests.h Makefile
 | 
						|
	@mkdir -p .depends
 | 
						|
	$(CXX) $(CXXFLAGS) -M -MF $@ -MT $(<:.cc=.o) $<
 | 
						|
 | 
						|
depends.mk: $(PROGRAMS:%=.depends/%.dep)
 | 
						|
	cat $^ > $@.new
 | 
						|
	mv -f $@.new $@
 | 
						|
 | 
						|
include depends.mk
 | 
						|
 | 
						|
%.o: %.cc %.h ../makeflags Makefile
 | 
						|
	@echo "Implicit rule %.o: %.cc"
 | 
						|
	$(CXX) $(CXXFLAGS) -o $@ -c $<
 | 
						|
 | 
						|
$(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:%=%.txt) $(PROGRAMS)
 |