OCAMLMAKEFILE = /usr/share/ocamlmakefile/OCamlMakefile
PY_PREFIX = $(shell python2 getprefix.py)
PY_VERSION = $(shell python2 getversion.py)
CLIBS = python$(PY_VERSION) pthread dl util m c

SOURCES = pycaml.ml pycaml_ml.c
RESULT = pycaml
THREADS = yes
NO_CUSTOM = NO_CUSTOM
CFLAGS = -fPIC

LIBDIRS = $(PY_PREFIX)/lib/python$(PY_VERSION)/config
INCDIRS = $(PY_PREFIX)/include/python$(PY_VERSION)
OCAMLLDFLAGS = -linkall

allopt: native-code-library byte-code-library pycamltop

all: byte-code-library pycamltop

pycamltop: pycaml.cma pycamltop.cmo
	ocamlmktop -o $@ pycaml.cma pycamltop.cmo

pycamltop.ml:
	echo 'Topdirs.dir_directory "+pycaml"' > $@

clean::
	rm -Rf pycamltop.ml pycamltop *.cm* *.o *.a ._d

-include $(OCAMLMAKEFILE)
