#!/usr/bin/make -f

CPPFLAGS = $(shell pkg-config fflas-ffpack --cflags) \
	-I/usr/include/fflas-ffpack/utils
LDLIBS = $(shell pkg-config fflas-ffpack --libs)
CC = g++
VPATH=tests

TESTS = test-lu             \
	test-det            \
	test-echelon        \
	test-rankprofiles   \
	test-compressQ      \
	test-permutations   \
	test-fadd           \
	test-finit          \
	test-fscal          \
	test-fgemm          \
	test-pluq-check     \
	test-fgemm-check    \
	test-ftrsm-check    \
	test-invert-check   \
	test-charpoly-check \
	test-fger           \
	test-multifile1     \
	test-maxdelayeddim  \
	regression-check
#	test-ftrsm - skipping for now
#	(see https://github.com/linbox-team/fflas-ffpack/issues/29)

all: $(TESTS)
	@PASS=0; \
	FAIL=0; \
	for TEST in $(TESTS); \
	do \
		./$$TEST; \
		if [ $$? = 0 ]; \
		then \
			echo "PASS: $$TEST"; \
			PASS=$$(($$PASS+1)); \
		else \
			echo "FAIL: $$TEST"; \
			FAIL=$$(($$FAIL+1)); \
		fi; \
	done; \
	echo "========"; \
	echo "Summary:"; \
	echo "========"; \
	echo "PASS: $$PASS"; \
	echo "FAIL: $$FAIL"; \
	rm -f $(TESTS) *.o; \
	exit $$FAIL

# we rename test-multifile -> testmultifile1 to take advantage of implicit rules
test-multifile1: test-multifile2.o

clean:
	rm -f $(TESTS) *.o
