CC=g++

LIBSRCS=utils.cpp matrix.cpp jacobi.cpp
LIBOBJS=$(LIBSRCS:.cpp=.o)

INCLUDE=../include

CFLAGS=-larmadillo -llapack -std=c++11

# Add a debug flag when compiling (For the DEBUG macro in utils.hpp)
DEBUG ?= 0
ifeq ($(DEBUG), 1)
	DBGFLAG=-DDBG
else
	DBGFLAG=
endif


.PHONY: doxygen clean

all: test_suite main

# Rules for executables
main: main.o $(LIBOBJS)
	$(CC) $^ -o $@ $(CFLAGS) $(DBGFLAG) -I$(INCLUDE)

test_suite: test_suite.o $(LIBOBJS)
	$(CC) $^ -o $@ $(CFLAGS) $(DBGFLAG) -I$(INCLUDE)

# Rule for object files
%.o: %.cpp
	$(CC) -c $^ -o $@ $(DBGFLAG) -I$(INCLUDE)

# Make documentation
doxygen:
	doxygen

clean:
	rm *.o
	rm test_suite
	rm main 
