out-of-tree build: fix HAVE_OCAML=false case
[libguestfs.git] / generator / Makefile.am
index 112fc69..44c0594 100644 (file)
@@ -1,5 +1,5 @@
 # libguestfs
-# Copyright (C) 2010 Red Hat Inc.
+# Copyright (C) 2010-2011 Red Hat Inc.
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -46,6 +46,7 @@ SOURCES = \
        generator_haskell.ml \
        generator_csharp.ml \
        generator_php.ml \
+       generator_erlang.ml \
        generator_bindtests.ml \
        generator_errnostring.ml \
        generator_main.ml
@@ -62,14 +63,14 @@ noinst_PROGRAM = generator
 
 if HAVE_OCAML
 
-generator: $(OBJECTS)
-       $(OCAMLC) -o generator $(OCAMLCFLAGS) $(OCAMLCLIBS) $(OBJECTS)
+$(srcdir)/generator: $(OBJECTS)
+       $(OCAMLC) -I $(srcdir) -o $@ $(OCAMLCFLAGS) $(OCAMLCLIBS) $(OBJECTS)
 
 .ml.cmo:
-       $(OCAMLC) $(OCAMLCFLAGS) -c $< -o $@
+       $(OCAMLC) -I $(srcdir) $(OCAMLCFLAGS) -c $< -o $@
 
 .mli.cmi:
-       $(OCAMLC) $(OCAMLCFLAGS) -c $< -o $@
+       $(OCAMLC) -I $(srcdir) $(OCAMLCFLAGS) -c $< -o $@
 
 depend: .depend
 
@@ -85,7 +86,7 @@ else
 # No OCaml compiler.  Just replace the generator with a script that
 # touches stamp-generator and prints a warning.
 
-generator: $(SOURCES)
+$(srcdir)/generator: $(SOURCES)
        rm -f $@ $@-t
        echo 'echo Warning: Install OCaml compiler in order to rebuild the generated files.' >> $@-t
        echo 'touch generator/stamp-generator' >> $@-t