public
Last active

Makefile for buildling xapian ocaml bindings

  • Download Gist
Makefile
Makefile
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
SWIG=../../swig/preinst-swig
INCLUDE=-I. -I./../generic $(shell xapian-config --cxxflags)
LINK=$(shell xapian-config --libs)
 
all: static
 
static: libs
ocamlc -pp "camlp4o ./swigp4.cmo" -c smoketest.ml
ocamlfind ocamlc -g -ccopt -g -cclib \
-g -custom -o smoketest \
-package unix -linkpkg \
swig.cmo xapian.cmo smoketest.cmo \
xapian_wrap.o \
-cc 'g++ -Wno-write-strings $(INCLUDE) $(LINK)'
 
swig:
$(SWIG) -ocaml -co swigp4.ml
$(SWIG) -ocaml -co swig.mli
$(SWIG) -ocaml -co swig.ml
ocamlfind ocamlc -package camlp4 \
-pp "camlp4o pa_extend.cmo q_MLast.cmo" \
-c swigp4.ml
ocamlc -c swig.mli swig.ml
 
 
libs: swig
$(SWIG) -Wall $(INCLUDE) -c++ -ocaml \
-outdir . -o xapian_wrap.c ../xapian.i
ocamlc -cc 'g++ -Wno-write-strings' -g -c -ccopt \
-g -ccopt '-xc++' -ccopt '$(INCLUDE)' \
xapian_wrap.c
ocamlc -c xapian.mli xapian.ml
 
 
toplevel: libs
ocamlfind ocamlmktop -custom swig.cmo \
-package dynlink -package camlp4 \
dynlink.cma camlp4o.cma swigp4.cmo \
xapian_wrap.o xapian.cmo -o xapian_top \
-cc 'g++ -Wno-write-strings $(INCLUDE) $(LINK)'
 
 
clean:
rm -rf *.dSYM smoketest
rm -f swigp4.ml swig.mli swig.ml
rm -f *.cmo *.cmi
rm -f xapian_wrap.*
rm -f xapian.*
rm -f xapian_top

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.