[Libguestfs] [PATCH] Generate *.cmx targets only if a native OCaml compiler exists

Hilko Bengen bengen at hilluzination.de
Sun Sep 14 19:25:18 UTC 2014


---
 builder/Makefile.am   | 2 ++
 customize/Makefile.am | 2 ++
 mllib/Makefile.am     | 2 ++
 ocaml/Makefile.am     | 4 ++++
 resize/Makefile.am    | 2 ++
 sparsify/Makefile.am  | 2 ++
 sysprep/Makefile.am   | 2 ++
 v2v/Makefile.am       | 2 ++
 8 files changed, 18 insertions(+)

diff --git a/builder/Makefile.am b/builder/Makefile.am
index 0ca5db6..eb6295a 100644
--- a/builder/Makefile.am
+++ b/builder/Makefile.am
@@ -185,8 +185,10 @@ endif
 	$(OCAMLFIND) ocamlc $(OCAMLCFLAGS) -c $< -o $@
 .ml.cmo:
 	$(OCAMLFIND) ocamlc $(OCAMLCFLAGS) -c $< -o $@
+if HAVE_OCAMLOPT
 .ml.cmx:
 	$(OCAMLFIND) ocamlopt $(OCAMLOPTFLAGS) -c $< -o $@
+endif
 
 # Manual pages and HTML files for the website.
 
diff --git a/customize/Makefile.am b/customize/Makefile.am
index 90234a0..746375d 100644
--- a/customize/Makefile.am
+++ b/customize/Makefile.am
@@ -139,8 +139,10 @@ endif
 	$(OCAMLFIND) ocamlc $(OCAMLCFLAGS) -c $< -o $@
 .ml.cmo:
 	$(OCAMLFIND) ocamlc $(OCAMLCFLAGS) -c $< -o $@
+if HAVE_OCAMLOPT
 .ml.cmx:
 	$(OCAMLFIND) ocamlopt $(OCAMLOPTFLAGS) -c $< -o $@
+endif
 
 # automake will decide we don't need C support in this file.  Really
 # we do, so we have to provide it ourselves.
diff --git a/mllib/Makefile.am b/mllib/Makefile.am
index af0fe85..210fc64 100644
--- a/mllib/Makefile.am
+++ b/mllib/Makefile.am
@@ -118,8 +118,10 @@ endif
 	$(OCAMLFIND) ocamlc $(OCAMLCFLAGS) -c $< -o $@
 .ml.cmo:
 	$(OCAMLFIND) ocamlc $(OCAMLCFLAGS) -c $< -o $@
+if HAVE_OCAMLOPT
 .ml.cmx:
 	$(OCAMLFIND) ocamlopt $(OCAMLOPTFLAGS) -c $< -o $@
+endif
 
 # This OCaml module has to be generated by make (configure will put
 # unexpanded prefix macro in).
diff --git a/ocaml/Makefile.am b/ocaml/Makefile.am
index 8b9dcfa..94f11ef 100644
--- a/ocaml/Makefile.am
+++ b/ocaml/Makefile.am
@@ -147,8 +147,10 @@ endif
 	$(top_builddir)/libtool -dlopen $(top_builddir)/src/.libs/libguestfs.la --mode=execute \
 	$(OCAMLFIND) ocamlc $(OCAMLCFLAGS) -I . -package unix -linkpkg mlguestfs.cma $< -o $@
 
+if HAVE_OCAMLOPT
 %.opt: %.cmx mlguestfs.cmxa
 	$(OCAMLFIND) ocamlopt $(OCAMLOPTFLAGS) -cclib -L$(top_builddir)/src/.libs -I . -package unix -linkpkg mlguestfs.cmxa $< -o $@
+endif
 
 check-valgrind:
 	$(MAKE) VG="$(top_builddir)/run @VG@" check
@@ -160,10 +162,12 @@ guestfs.cmo: guestfs.ml
 	$(OCAMLFIND) ocamlc $(OCAMLCFLAGS) -package unix -c $< -o $@
 %.cmo: %.ml mlguestfs.cma
 	$(OCAMLFIND) ocamlc $(OCAMLCFLAGS) -package unix -c $< -o $@
+if HAVE_OCAMLOPT
 guestfs.cmx: guestfs.ml
 	$(OCAMLFIND) ocamlopt $(OCAMLOPTFLAGS) -package unix -c $< -o $@
 %.cmx: %.ml mlguestfs.cmxa
 	$(OCAMLFIND) ocamlopt $(OCAMLOPTFLAGS) -package unix -c $< -o $@
+endif
 
 depend: .depend
 
diff --git a/resize/Makefile.am b/resize/Makefile.am
index 91abeee..d1bc46f 100644
--- a/resize/Makefile.am
+++ b/resize/Makefile.am
@@ -94,8 +94,10 @@ endif
 	$(OCAMLFIND) ocamlc $(OCAMLCFLAGS) -c $< -o $@
 .ml.cmo:
 	$(OCAMLFIND) ocamlc $(OCAMLCFLAGS) -c $< -o $@
+if HAVE_OCAMLOPT
 .ml.cmx:
 	$(OCAMLFIND) ocamlopt $(OCAMLOPTFLAGS) -c $< -o $@
+endif
 
 # automake will decide we don't need C support in this file.  Really
 # we do, so we have to provide it ourselves.
diff --git a/sparsify/Makefile.am b/sparsify/Makefile.am
index bb3bda0..fc2777d 100644
--- a/sparsify/Makefile.am
+++ b/sparsify/Makefile.am
@@ -95,8 +95,10 @@ virt_sparsify_LINK = \
 	$(OCAMLFIND) ocamlc $(OCAMLFLAGS) $(OCAMLPACKAGES) -c $< -o $@
 .ml.cmo:
 	$(OCAMLFIND) ocamlc $(OCAMLFLAGS) $(OCAMLPACKAGES) -c $< -o $@
+if HAVE_OCAMLOPT
 .ml.cmx:
 	$(OCAMLFIND) ocamlopt $(OCAMLFLAGS) $(OCAMLPACKAGES) -c $< -o $@
+endif
 
 # Manual pages and HTML files for the website.
 
diff --git a/sysprep/Makefile.am b/sysprep/Makefile.am
index 7b88ef5..d6dae86 100644
--- a/sysprep/Makefile.am
+++ b/sysprep/Makefile.am
@@ -155,8 +155,10 @@ endif
 	$(OCAMLFIND) ocamlc $(OCAMLCFLAGS) -c $< -o $@
 .ml.cmo:
 	$(OCAMLFIND) ocamlc $(OCAMLCFLAGS) -c $< -o $@
+if HAVE_OCAMLOPT
 .ml.cmx:
 	$(OCAMLFIND) ocamlopt $(OCAMLOPTFLAGS) -c $< -o $@
+endif
 
 # automake will decide we don't need C support in this file.  Really
 # we do, so we have to provide it ourselves.
diff --git a/v2v/Makefile.am b/v2v/Makefile.am
index 553b93c..03d7442 100644
--- a/v2v/Makefile.am
+++ b/v2v/Makefile.am
@@ -164,8 +164,10 @@ virt_v2v_LINK = \
 	$(OCAMLFIND) ocamlc $(OCAMLFLAGS) $(OCAMLPACKAGES) -c $< -o $@
 .ml.cmo:
 	$(OCAMLFIND) ocamlc $(OCAMLFLAGS) $(OCAMLPACKAGES) -c $< -o $@
+if HAVE_OCAMLOPT
 .ml.cmx:
 	$(OCAMLFIND) ocamlopt $(OCAMLFLAGS) $(OCAMLPACKAGES) -c $< -o $@
+endif
 
 # Data directory.
 
-- 
2.1.0




More information about the Libguestfs mailing list