I'm trying to build an ocaml project which requires a camlp4 extension (pa_deriving in this case). Here's my Makefile:
include ./Makefile.config
OCAMLC := ${OCAMLFIND} ocamlc
OCAMLOPT := ${OCAMLFIND} ocamlopt
OCAMLDEP := ${OCAMLFIND} ocamldep
PP := -package camlp4 -ppopt /home/p/godi-3.12.1.0/lib/ocaml/site-lib/deriving-ocsigen/pa_deriving.cma -syntax camlp4o
LIBS := -I /home/p/godi-3.12.1.0/lib/ocaml/site-lib/deriving-ocsigen -package unix -package oUnit
OCAMLFLAGS = -w Aef
SOURCES = logic.ml \
fsm.ml \
test_logic.ml
test_logic: ${SOURCES:.ml=.cmo}
${OCAMLC} -o $@ ${LIBS} -linkpkg deriving.cma $^
# Common rules
%.cmi: %.mli
${OCAMLC} ${OCAMLFLAGS} ${PP} ${LIBS} -c $<
%.cmo: %.ml
${OCAMLC} ${OCAMLFLAGS} ${PP} ${LIBS} -c $<
%.cmx: %.ml
${OCAMLOPT} ${OCAMLFLAGS} ${PP} ${LIBS} -c $<
# Clean up
clean:
-rm -f *.cm[ioax] *.cmxa *.cmxs *${OBJEXT} *${LIBEXT} *.annot
-rm -f tests${EXEEXT}
distclean: clean
-rm -f *~ \#* .\#*
# Dependencies
depend:
${OCAMLDEP} ${PP} *.ml *.mli > .depend
-include .depend
This Makefile works; it gets the job done, but the problem is that I've got hardcoded paths above, like: /home/p/godi-3.12.1.0/lib/ocaml/site-lib/deriving-ocsigen/pa_deriving.cma which refers to my godi installation of OCaml. I want to get rid of those so that I can distribute the code & Makefile so anyone can build with it.
Should I be using omake or ocamlbuild for this? I'd like to use omake and I've played with an OMakefile for this, but couldn't get anything working - any suggestions would be appreciated.
Update: I tried to use ocamlbuild with the following _tags file:
<*.ml>: package(unix), package(oUnit), package(deriving-ocsigen.syntax), syntax(camlp4o)
using the following ocamlbuild command: ocamlbuild -use-ocamlfind test_logic.native -classic-display
And I get:
/home/phil/godi-3.12.1.0/bin/ocamlfind ocamldep -package deriving-ocsigen.syntax -package oUnit -package unix -syntax camlp4o -modules fsm.ml > fsm.ml.depends
/home/phil/godi-3.12.1.0/bin/ocamlfind ocamldep -package deriving-ocsigen.syntax -package oUnit -package unix -syntax camlp4o -modules logic.ml > logic.ml.depends
/home/phil/godi-3.12.1.0/bin/ocamlfind ocamlc -c -package deriving-ocsigen.syntax -package oUnit -package unix -syntax camlp4o -o logic.cmo logic.ml
/home/phil/godi-3.12.1.0/bin/ocamlfind ocamlc -c -package deriving-ocsigen.syntax -package oUnit -package unix -syntax camlp4o -o fsm.cmo fsm.ml
/home/phil/godi-3.12.1.0/bin/ocamlfind ocamlopt -c -package deriving-ocsigen.syntax -package oUnit -package unix -syntax camlp4o -o logic.cmx logic.ml
/home/phil/godi-3.12.1.0/bin/ocamlfind ocamlopt -c -package deriving-ocsigen.syntax -package oUnit -package unix -syntax camlp4o -o fsm.cmx fsm.ml
/home/phil/godi-3.12.1.0/bin/ocamlfind ocamlopt -linkpkg -linkpkg logic.cmx fsm.cmx test_logic.cmx -o test_logic.native
+ /home/phil/godi-3.12.1.0/bin/ocamlfind ocamlopt -linkpkg -linkpkg logic.cmx fsm.cmx test_logic.cmx -o test_logic.native
File "_none_", line 1, characters 0-1:
Error: No implementations provided for the following modules:
Deriving_Show referenced from test_logic.cmx
Deriving_Enum referenced from test_logic.cmx
OUnit referenced from test_logic.cmx
What would I need to add to the _tags file to correct this?