1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
|
(* hey emacs, this is OCaml code: -*- tuareg -*- *)
(* nbd client library in userspace: generator
* Copyright Red Hat
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*)
open Unix
open Printf
open State_machine
open State_machine_generator
open Utils
let () =
if not (Sys.file_exists "lib/handle.c") then
failwith "Wrong directory! Don't run this script by hand."
(* Write the output files. *)
let () =
output_to "lib/states.h" State_machine_generator.generate_lib_states_h;
output_to "lib/states.c" State_machine_generator.generate_lib_states_c;
output_to "lib/states-run.c"
State_machine_generator.generate_lib_states_run_c;
output_to "lib/libnbd.syms" C.generate_lib_libnbd_syms;
output_to "include/libnbd.h" C.generate_include_libnbd_h;
output_to "lib/unlocked.h" C.generate_lib_unlocked_h;
output_to "lib/api.c" C.generate_lib_api_c;
output_to "docs/Makefile.inc" Docs.generate_docs_Makefile_inc;
output_to "docs/api-links.pod" Docs.generate_docs_api_links_pod;
output_to "docs/api-flag-links.pod" Docs.generate_docs_api_flag_links_pod;
List.iter (
fun (name, call) ->
output_to (sprintf "docs/nbd_%s.pod" name)
(Docs.generate_docs_nbd_pod name call)
) API.handle_calls;
output_to "python/methods.h" Python.generate_python_methods_h;
output_to "python/libnbdmod.c" Python.generate_python_libnbdmod_c;
output_to "python/methods.c" Python.generate_python_methods_c;
output_to "python/nbd.py" Python.generate_python_nbd_py;
output_to "ocaml/NBD.mli" OCaml.generate_ocaml_nbd_mli;
output_to "ocaml/NBD.ml" OCaml.generate_ocaml_nbd_ml;
output_to "ocaml/nbd-c.c" OCaml.generate_ocaml_nbd_c;
output_to ~formatter:(Some Gofmt) "golang/bindings.go"
GoLang.generate_golang_bindings_go;
output_to ~formatter:(Some Gofmt) "golang/closures.go"
GoLang.generate_golang_closures_go;
output_to ~formatter:(Some Gofmt) "golang/wrappers.go"
GoLang.generate_golang_wrappers_go;
output_to "golang/wrappers.h" GoLang.generate_golang_wrappers_h;
output_to ~formatter:(Some Rustfmt) "rust/libnbd-sys/src/generated.rs"
RustSys.generate_rust_sys_bindings;
output_to ~formatter:(Some Rustfmt) "rust/src/bindings.rs"
Rust.generate_rust_bindings;
output_to ~formatter:(Some Rustfmt) "rust/src/async_bindings.rs"
Rust.generate_rust_async_bindings;
|