# Standard compile options for the C++ executable
FLAGS = -fPIC -O3 -march=native -Wall -Werror -flto=auto

# The Python interface through SWIG
PYTHON_VERSION = $(shell python3 -c 'import sys; print(f"{sys.version_info.major}.{sys.version_info.minor}");')
PYTHONI = -I/usr/include/python$(PYTHON_VERSION)/
PYTHONL = -Xlinker -export-dynamic

# Default super-target
all:
	cd ../rpt/ && g++ $(FLAGS) -std=c++2a -c *.cpp ; cd ../swig/
	swig -c++ -python -keyword -o rpt_wrap.cxx rpt.i
	g++ $(FLAGS) $(PYTHONI) -c rpt_wrap.cxx -o rpt_wrap.o
	g++ $(FLAGS) $(PYTHONL) -shared ../rpt/*.o rpt_wrap.o -o _rpt.so
