
# Babel generates this babel.make file to define
# macros for all the files that are generated
include babel.make
include ../settings.make

IMPLOBJS=${IMPLSRCS:.cc=.lo}
SKELOBJS=${SKELSRCS:.cc=.lo}
IOROBJS=${IORSRCS:.c=.lo}
STUBOBJS=${STUBSRCS:.cc=.lo}
ALLOBJS=${IMPLOBJS} ${SKELOBJS} ${IOROBJS} ${STUBOBJS}
ALLSIDL=../life.sidl pythonlife.sidl

all: libpythonconway.la python-stamp

# make doesn't handle tasks that generate lots of files
# this handy idiom creates touches a bogus file if babel
# executes without errors
babel-stamp: ../life.sidl pythonlife.sidl
	${BABEL} --server=python $(ALLSIDL)  && \
	touch babel-stamp
	${MAKE}

python-stamp: babel-stamp 
	${PYTHON} setup.py 						\
	  --include-dirs=${BABEL_INCLDIR} 				\
	  --include-dirs=${BABEL_PYEXTENSION_INCLDIR}			\
	  --include-dirs=.						\
	  --library-dirs=${BABEL_LIBDIR}				\
	  --library-dirs=${BABEL_PYEXTENSION_LIBDIR}			\
	  build_ext --inplace --force && \
	touch python-stamp

libpythonconway.la: babel-stamp $(ALLOBJS)
	${BABEL_LIBTOOL} --mode=link $(CC) -module -no-undefined -o libpythonconway.la -rpath `pwd`/.libs -release 2.0 $(ALLOBJS) -L$(PYTHON_SHARED_LIBRARY_DIR) -lpython$(PYTHON_VERSION) -L$(BABEL_LIBDIR) -lsidl

clean:
	${RM} babel-stamp python-stamp ${ALLOBJS} libpythonconway.so *~
	${RM} `find . \( -name '*.so' -o -name '*.o' -o -name '*.lo' \) -print`

new: clean
	${RM} ${IORHDRS} ${IORSRCS} ${PYMOD_HDRS}
	${RM} -r build conway f90 cxx c
