fuse/guestmount.1
fuse/stamp-guestmount.pod
generator/.pod2text.data*
+generator/files-generated.txt
generator/generator
generator/stamp-generator
guestfish.1
SOURCES_ML = $(filter %.ml,$(SOURCES))
OBJECTS = $(SOURCES_ML:.ml=.cmo)
-EXTRA_DIST = $(SOURCES)
+EXTRA_DIST = $(SOURCES) files-generated.txt
OCAMLCFLAGS = -warn-error CDEFLMPSUVYZX
OCAMLCLIBS = unix.cma str.cma
output_to "php/extension/php_guestfs_php.h" generate_php_h;
output_to "php/extension/guestfs_php.c" generate_php_c;
+ (* Generate the list of files generated -- last. *)
+ 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;
-
- printf "generated %d lines of code\n" (get_lines_generated ())
+ close_out chan
open Generator_utils
-(* 'pr' prints to the current output file. *)
+(* Output channel, 'pr' prints to this. *)
let chan = ref Pervasives.stdout
+
+(* Number of lines generated. *)
let lines = ref 0
+
+(* Name of each file generated. *)
+let files = ref []
+
+(* Print-to-current-output function, used everywhere. It has
+ * printf-like semantics.
+ *)
let pr fs =
ksprintf
(fun str ->
) fs
let output_to filename k =
+ files := filename :: !files;
+
let filename_new = filename ^ ".new" in
chan := open_out filename_new;
k ();
let get_lines_generated () =
!lines
+
+let get_files_generated () =
+ List.rev !files
val get_lines_generated : unit -> int
(** Return number of lines of code generated. *)
+
+val get_files_generated : unit -> string list
+(** Return names of the files that were generated. *)