.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_mem

python_plot_mem: plot_mem
	time ./$< chebynames.txt 3000 300000 0 > cheby.dat
	python3.11 plot.py cheby_nopad.dat cheby_padded.dat

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

clean:
	rm -f plot_mem 
