env = Environment()
env.Decider('MD5')
import sys
py_version = sys.version[:3]

cybld = Builder(action='cython -v -a -o $TARGET $SOURCE')
env.Append(BUILDERS={'Cython':cybld}) 
env.Append(CCFLAGS='-pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv \
-Wall -Wstrict-prototypes -Wstrict-prototypes -O2 -fPIC \
-I/usr/local/lib/python{}/dist-packages/numpy/core/include -I/usr/include \
-I/usr/include/python{}/ -I/usr/include/gsl/'.format(py_version, py_version))

env.Cython('cgillespie.c','cgillespie.pyx')
env.SharedLibrary('cgillespie',['cgillespie.c'], LIBPREFIX='',
                LIBS=['gsl','gslcblas'],
                LIBPATH=['/usr/local/lib/python{}/dist-packages/numpy/core/include'.format(py_version),
                        '/usr/include','/usr/include/python{}/'.format(py_version),'/usr/include/gsl/'])
