OSNAME:=$(shell uname -s | sed 's/_.*//')

COMPILER =
# to get a list of available compilers run
# python swig-python-setup.py build_ext --help-compiler
# no changes necessary on Linux and MacOS
# change compiler to mingw32 on MinGW
ifeq ($(OSNAME),MINGW32)
	COMPILER = --compiler=mingw32
endif

all: adaptagrams

adaptagrams_wrap.cxx: clean adaptagrams.i
	swig -DNDEBUG -c++ -python adaptagrams.i

adaptagrams: adaptagrams_wrap.cxx
	python swig-python-setup.py build_ext --inplace $(COMPILER)

realclean: clean

clean: mostlyclean
	rm -f _adaptagrams.so _adaptagrams.dylib _adaptagrams.dll
	rm -f adaptagrams.py

mostlyclean:
	rm -f swig-worked
	rm -f adaptagrams_wrap.o adaptagrams_wrap.cxx
	rm -rf java/*

.PHONY: all clean mostlyclean realclean

