Description: Various fixes to upstream makefile
Author: Stefano Zacchiroli <zack@debian.org>
Reviewed-By: Ralf Treinen <treinen@debian.org>

--- ceve-1.4.orig/Makefile
+++ ceve-1.4/Makefile
@@ -20,7 +20,7 @@ egraph_writer.mli dose_writer.mli depend
 cnf_writer.mli graphviz_writer.mli oz_writer.mli
 OBJS = $(OCAML_SOURCES:.ml=.cmo)
 XBJS = $(OCAML_SOURCES:.ml=.cmx)
-CMIS = $(OCAML_MLIS:.mli=.cmi)
+CMIS = $(OCAML_MLIS:.mli=.cmi) ceve.cmi
 
 PACKAGES = -package dose2.lifetime,dose2.ocamlpkgsrc,dose2.ocamlrpm,dose2.ocamldeb,dose2.dosebase,str,$(CAMLZIP_NAME)
 #ifdef USE_OCAMLDUCE
@@ -28,8 +28,11 @@ PACKAGES = -package dose2.lifetime,dose2
 #DUCEDIR=$(shell ocamlfind query ocamlduce)
 #endif
 
+all: ceve
+opt: ceve.opt
+
 ceve: $(OBJS)
-	$(OCAMLFIND) ocamlc -I $(DUCEDIR) -thread -custom -o $@ -linkpkg $(PACKAGES) $(C_LIBRARIES) $(CCOPTFLAGS) $(OBJS)
+	$(OCAMLFIND) ocamlc -thread -o $@ -linkpkg $(PACKAGES) $(C_LIBRARIES) $(CCOPTFLAGS) $(OBJS)
 
 ceve.opt: $(XBJS)
 # bug in ocamlducefind
@@ -60,7 +63,7 @@ endif
 	$(OCAMLFIND) ocamlopt $(PACKAGES) -c $<
 
 %.cmi: %.mli
-	$(OCAMLFIND) ocamlopt $(PACKAGES) -c $<
+	$(OCAMLFIND) ocamlc $(PACKAGES) -c $<
 
 doc: $(CMIS)
 	@rm -rf doc
@@ -72,8 +75,12 @@ clean:
 	@rm -rf ceve ceve.opt doc $(OBJS) $(XBJS) $(CMIS) $(OCAML_SOURCES:.ml=.o)
 
 install: ceve
-	{ test ! -f ceve.opt || install ceve.opt $(BINDIR); }; \
-	install ceve $(BINDIR)
+	mkdir -p $(BINDIR)
+	if [ -f ceve.opt ] ; then \
+	  cp ceve.opt $(BINDIR)/ceve ; \
+	else \
+	  cp ceve $(BINDIR)/ceve ; \
+	fi
 
 depend:
 	$(OCAMLFIND) ocamldep $(OCAML_SOURCES) $(OCAML_MLIS) > .depend
