From: "Richard W.M. Jones" <rjones(a)redhat.com>
Since stamp-generator is a Makefile thing, make it in the Makefile,
not in the generator itself.
Also this ensures stamp-generator is created in the builddir, not in
the source directory (fixing separated builds).
---
generator/Makefile.am | 6 +++---
generator/main.ml | 9 +--------
2 files changed, 4 insertions(+), 11 deletions(-)
diff --git a/generator/Makefile.am b/generator/Makefile.am
index bc92070..9dd3d4c 100644
--- a/generator/Makefile.am
+++ b/generator/Makefile.am
@@ -86,12 +86,11 @@ depend: .depend
else
# No OCaml compiler. Just replace the generator with a script that
-# touches stamp-generator and prints a warning.
+# prints a warning.
$(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
+ echo 'echo Warning: Install OCaml compiler in order to rebuild the generated
files.' > $@-t
chmod +x $@-t
mv $@-t $@
@@ -112,6 +111,7 @@ stamp-generator: generator
mkdir -p $(top_srcdir)/gobject/include
mkdir -p $(top_srcdir)/gobject/include/guestfs-gobject
cd $(top_srcdir) && generator/generator
+ touch $@
CLEANFILES = $(noinst_DATA) $(noinst_PROGRAM) *.cmi *.cmo *~
diff --git a/generator/main.ml b/generator/main.ml
index 3914932..786dfa6 100644
--- a/generator/main.ml
+++ b/generator/main.ml
@@ -207,11 +207,4 @@ Run it from the top source directory using the command
printf "generated %d lines of code\n" (get_lines_generated ());
let files = List.sort compare (get_files_generated ()) in
output_to "generator/files-generated.txt"
- (fun () -> List.iter (pr "%s\n") files);
-
- (* Always generate this file last, and unconditionally. It's used
- * by the Makefile to know when we must re-run the generator.
- *)
- let chan = open_out "generator/stamp-generator" in
- fprintf chan "1\n";
- close_out chan
+ (fun () -> List.iter (pr "%s\n") files)
--
1.8.1.4