.PHONY:

CXX_COMPILER  := g++-11
COMPILE_FLAGS := -std=c++14 -O3
PYTHON        := python3.10

LIBS := -lfunc -larmadillo
UNAME_S := $(shell uname -s)

ifeq ($(UNAME_S), Linux)
LINKING_FLAGS := $(LIBS) -fopenmp -lquadmath # assuming g++ is from the gcc
endif

ifeq ($(UNAME_S), Darwin)
LINKING_FLAGS := $(LIBS) -Xpreprocessor -fopenmp -lgomp
#LINKING_FLAGS := $(LIBS)
#LINKING_FLAGS := $(LIBS) -lquadmath -fopenmp # assuming g++ is from the gcc
endif

all: python_plot_reads

python_plot_reads: read_from_file
	time ./$< > times.dat
	$(PYTHON) plot.py times.dat

read_from_file: read_from_file.cpp
	$(CXX_COMPILER) $(COMPILE_FLAGS) $< -o $@ $(LINKING_FLAGS)

clean:
	rm -f read_from_file linear_interp_table*
