
FILE=gen3d
LIB =libgen3d

INCLUDES=-I/tools/local/lib/python2.7/site-packages/numpy/core/include -I/tools/local/include/python2.7 
CCOPTS=-pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC 
LIBS=-L. -L/tools/local/lib -lgen3d -lpython2.7 

build:
	gfortran -c $(FILE).for -o $(FILE).o
	-@rm $(LIB).a
	ar clq $(LIB).a $(FILE).o
	cython gengrid_stub.pyx
	gcc $(INCLUDES) $(CCOPTS) -c gengrid_stub.c -o gengrid_stub.o
	gcc $(INCLUDES) $(CCOPTS) -c gengrid.c -o gengrid.o
	gcc -pthread -shared gengrid_stub.o gengrid.o $(LIBS) -o gengrid_stub.so

clean:
	-@rm *.o *.so *.pyc *~ *core* *.a gengrid_stub.c 2>/dev/null

test: build
	python display.py