all: gv_test.png

################################################
# This demo uses some files shipped with the distro.
# You could replace these with your own.
INCLUDEDIR=`pkg-config libgvc --variable=includedir`
gv.i: 
	cp $(INCLUDEDIR)/gv.i .
gv.cpp: 
	cp $(INCLUDEDIR)/gv.cpp .

EXTRACLEAN = gv.i gv.cpp
################################################

PYTHON_PREFIX = `python -c "import sys; print sys.prefix"`
PYTHON_VERSION = `python -c 'import sys; print sys.version[:3]'`

CXXFLAGS = `pkg-config libgvc --cflags` \
	   -I$(PYTHON_PREFIX)/include/python$(PYTHON_VERSION) \
	   -Wall -g -O2 -fPIC

LDFLAGS = -Wl,--rpath -Wl,`pkg-config libgvc --variable=libdir` \
	  `pkg-config libgvc --libs` -shared

gv_test.png: gv_test.py _gv.so
	./gv_test.py

_gv.so: gv.o gv_python.o
	g++ $(LDFLAGS) gv.o gv_python.o -o _gv.so
	
gv_python.cpp gv.py: gv.i
	swig -c++ -python -o gv_python.cpp gv.i

clean:
	rm -f gv.py gv_python.cpp _gv.so *.o gv_test.png $(EXTRACLEAN)
