PROGRAM	= main

SOURCES = $(wildcard *.cpp)
OBJECTS = ${SOURCES:.cpp=.o}

CXX     = g++
LINKER  = g++

WARNINGS = -Wall -pedantic -Wextra -Weffc++ -Woverloaded-virtual -Wfloat-equal -Wshadow \
           -Wredundant-decls -fmax-errors=1

CXXFLAGS   = -g -flto -O3 -ffast-math -march=native ${WARNINGS}
LINKFLAGS  = -g -flto -O3 -lopenblas -llapacke


all: ${PROGRAM}

# %.o: %.cpp
# 	${CXX} ${CXXFLAGS} -c $< -o $@

${PROGRAM}:	${OBJECTS}
	$(LINKER) ${OBJECTS} ${LINKFLAGS} -o ${PROGRAM}

clean:
	rm -f ${OBJECTS} ${PROGRAM}


run: ${PROGRAM}
# run: clean ${PROGRAM}
	./${PROGRAM}