$(MLFILES) rpmdepsize_about.ml.in \
rpmdepsize.spec rpmdepsize.spec.in
-CLEANFILES = rpmdepsize
+CLEANFILES = rpmdepsize *.annot *.cmi *.cmo *.cmx *.o *~
bin_SCRIPTS = rpmdepsize
-rpmdepsize: $(MLFILES)
- $(OCAMLFIND) $(OCAMLBEST) \
- -dtypes \
- -package lablgtk2,sexplib,unix,extlib,sexplib.syntax \
- -syntax camlp4o \
- -linkpkg \
- gtkInit.cmx \
- $^ -o $@
+OCAMLFLAGS = \
+ -dtypes \
+ -package lablgtk2,sexplib,unix,extlib,sexplib.syntax \
+ -syntax camlp4o
+OCAMLCLIBS = -linkpkg gtkInit.cmo
+OCAMLOPTLIBS = -linkpkg gtkInit.cmx
+
+if OCAML_BYTE_COMPILER
+rpmdepsize: $(MLFILES:.ml=.cmo)
+ $(OCAMLFIND) ocamlc $(OCAMLFLAGS) $(OCAMLCLIBS) $^ -o $@
+else
+rpmdepsize: $(MLFILES:.ml=.cmx)
+ $(OCAMLFIND) ocamlopt $(OCAMLFLAGS) $(OCAMLOPTLIBS) $^ -o $@
+endif
+
+.mli.cmi:
+ $(OCAMLFIND) ocamlc $(OCAMLFLAGS) -c $<
+.ml.cmo:
+ $(OCAMLFIND) ocamlc $(OCAMLFLAGS) -c $<
+.ml.cmx:
+ $(OCAMLFIND) ocamlopt $(OCAMLFLAGS) -c $<
if test "$OCAMLC" = "no"; then
AC_MSG_ERROR([You must install the OCaml compiler])
fi
+
+AM_CONDITIONAL(OCAML_BYTE_COMPILER,[test "x$OCAMLOPT" = "xbyte"])
+
AC_PROG_FINDLIB
if test "$OCAMLFIND" = "no"; then
AC_MSG_ERROR([You must install OCaml findlib (the ocamlfind command)])