include ../include/MakeIncl.chasm

INCLUDE_PATHS = -I./include -I$(CHASM_INCLUDE)
MOD_PATHS = -I../src/farray
CFLAGS = -ggdb -std=c99
FFLAGS = -g
CC = $(CHASM_CC)
FC = $(CHASM_F90)

all: ./test/matmul

testdesc: ./test/testdesc.o ./test/interop_GNU.o ./test/farrays.o
	$(FC) -g -o testdesc testdesc.o interop_GNU.o farrays.o

./test/matmul: ./test/matmul.o ./test/matmul_f90.o ./test/interop_GNU.o
	$(FC) -o ./test/matmul ./test/matmul.o ./test/matmul_f90.o ./test/interop_GNU.o

./test/testdesc.o: test/testdesc.c
	$(CC) -c -o ./test/testdesc.o $(INCLUDE_PATHS) $(CFLAGS) ./test/testdesc.c

./test/interop_GNU.o: ./src/interop_GNU.c
	$(CC) -c -o ./test/interop_GNU.o $(INCLUDE_PATHS) $(CFLAGS) ./src/interop_GNU.c

farrays.o: farrays.f90
	$(FC) -c $(FFLAGS) $(MOD_PATHS) farrays.f90

./test/matmul.o: ./test/matmul.c
	$(CC) -c -o ./test/matmul.o $(INCLUDE_PATHS) $(CFLAGS) ./test/matmul.c

./test/matmul_f90.o: ./test/matmul_f90.f90
	$(FC) -c -o ./test/matmul_f90.o $(FFLAGS) ./test/matmul_f90.f90

runtests: ./test/matmul
	./test/matmul

clean:
	rm -f ./test/*.o ./test/matmul ./test/testdesc
