#
# Make benchmark programs with BNCpack
#

include ../bncmake.inc

all: basebench linearbench linearbench_dec matmulbench matmulbench2 matvecmulbench matmulbench_mpf

.c.o: ../bnc.h
	$(CC) -c $(INCLUDES) $<

basebench: basebench.o $(LIBBNC)
	$(CC) -obasebench $(INCLUDES) basebench.o $(LIBS)

linearbench: linearbench.o $(LIBBNC)
	$(CC) -olinearbench $(INCLUDES) linearbench.o $(LIBS)

linearbench_dec: linearbench.c $(LIBBNC)
	$(CC) -c -olinearbench_dec.o -DUSE_DECIMAL $(INCLUDES) linearbench.c
	$(CC) -olinearbench_dec $(INCLUDES) linearbench_dec.o $(LIBS)

matvecmulbench: matvecmulbench.o $(LIBBNC)
	$(CC) -omatvecmulbench $(INCLUDES) matvecmulbench.o $(LIBS)

matmulbench: matmulbench.o $(LIBBNC)
	$(CC) -omatmulbench $(INCLUDES) matmulbench.o $(LIBS)

matmulbench_mpf: matmulbench_mpf.o $(LIBBNC)
	$(CC) -o matmulbench_mpf $(INCLUDES) matmulbench_mpf.o $(LIBS)

matmulbench_gmp: matmulbench_mpf.c
	$(CC) -DUSE_GMP -I/usr/local/include -c matmulbench_mpf.c -o matmulbench_mpf_gmp.o
	$(CC) -o matmulbench_gmp matmulbench_mpf_gmp.o -L/usr/local/lib -L../src -lbnc_gmp -lgmp -lm

matmulbench_mpfr: matmulbench_mpf.c
	$(CC) -DUSE_GMP -DUSE_MPFR -I/usr/local/include -c matmulbench_mpf.c -o matmulbench_mpf_mpfr.o
	$(CC) -o matmulbench_mpfr matmulbench_mpf_mpfr.o -L/usr/local/lib -L../src -lbnc_mpfr -lmpfr -lgmp -lm

matmulbench2: matmulbench2.o $(LIBBNC)
	$(CC) -omatmulbench2 $(INCLUDES) matmulbench2.o $(LIBS)

clean:
	-rm *.o
