From 7039d0e7f661e04ddec79eb8faabc50da5096451 Mon Sep 17 00:00:00 2001 From: Hilko Bengen Date: Sun, 14 Sep 2014 21:21:25 +0200 Subject: [PATCH] Generate *.cmx targets only if a native OCaml compiler exists --- 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 0ca5db6c8..eb6295ae2 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 90234a091..746375d84 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 af0fe853e..210fc6462 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 8b9dcfa24..94f11efc6 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 91abeee2c..d1bc46fb8 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 bb3bda067..fc2777d1d 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 7b88ef561..d6dae86c4 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 553b93c79..03d744212 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.