BOOST_UBLAS_INCLUDE=
BOOST_UBLAS_CXXFLAGS=-I$(BOOST_UBLAS_INCLUDE) -D NDEBUG -DBOOST_UBLAS_NDEBUG

BLAS_INCLUDE=
BLAS_LINK=
BLAS_CXXFLAGS=-isystem $(BLAS_INCLUDE)
BLAS_LDFLAGS=-L$(BLAS_LINK) -lmkl_intel_lp64 -lmkl_core -lmkl_sequential -lpthread -fopenmp

BLAZE_INCLUDE=
BLAZE_CXXFLAGS=-I$(BLAZE_INCLUDE)
BLAZE_LINK=
BLAZE_LDFLAGS=-L$(BLAZE_LINK) -lblaze

BLITZ_INCLUDE=
BLITZ_CXXFLAGS=-I$(BLITZ_INCLUDE)
BLITZ_LINK=
BLITZ_LDFLAGS=-L$(BLITZ_LINK) -lblitz

CXXFLAGS=-O3 -mtune=core-avx2 -inline-forceinline  -Wall -std=c++11 $(BOOST_UBLAS_CXXFLAGS) $(BLAZE_CXXFLAGS) $(BLAS_CXXFLAGS) $(BLITZ_CXXFLAGS)
CXX=icc
SRCDIR=src
SRCS=$(wildcard $(SRCDIR)/*.cpp)
OBJS= $(SRCS:$(SRCDIR)/%.cpp=$(TARGET_DIR)/%.o)
LDFLAGS=$(BOOST_UBLAS_LDFLAGS) $(BLAZE_LDFLAGS) $(BLAS_LDFLAGS) $(BLITZ_LDFLAGS)
TARGET_DIR=bin
TARGET=$(TARGET_DIR)/benchmark

$(TARGET): $(TARGET_DIR) $(OBJS)
	$(CXX) $(CXXFLAGS) -o $(TARGET) $(OBJS) $(LDFLAGS)

all:    $(TARGET)

debug:	CXXFLAGS += -g
debug:	$(TARGET)

$(OBJS): $(TARGET_DIR)/%.o : $(SRCDIR)/%.cpp
	$(CXX) $(CXXFLAGS) -c $<  -o $@
.c.o:
	$(CXX) $(CXXFLAGS) -c $<  -o $@

$(TARGET_DIR):
	mkdir -p $(TARGET_DIR)

clean:
	rm -f $(OBJS) $(TARGET)