CPP=g++
CC=gcc
CFLAGS=-fPIC -Ofast
CPPFLAGS=-fPIC --std=c++11 -Ofast
LDFLAGS=--shared
LIBS=-lrestclient-cpp
SONAME=_occi.so
SOURCES=occilib.cpp

SWIG=swig
SWIG_INTERFACES=occilib.i
WRAPPER_SOURCES=occilib_wrap.cxx
WRAPPER_INCLUDES=`pkg-config python --cflags`

default: test

compile:
	$(CPP) $(CPPFLAGS) -c $(SOURCES)

test: compile
	$(CPP) $(CPPFLAGS) -o test test.cpp *.o $(LIBS)

python:
	$(SWIG) -python -c++ $(SWIG_INTERFACES)
	$(CPP) $(CPPFLAGS) -c $(WRAPPER_SOURCES) $(WRAPPER_INCLUDES)
	$(CPP) $(LDFLAGS) -o $(SONAME) occilib_wrap.o $(LIBS)

clean:
	rm -f *.o
	rm -f $(WRAPPER_SOURCES)

mrproper: clean
	rm -f occi.py occi.pyc
	rm -f _occi.so
