From f6e080573a7c98ac4980d990413b2eb9695767c1 Mon Sep 17 00:00:00 2001 From: Daniil Baturin Date: Mon, 5 Oct 2020 21:19:55 +0700 Subject: [PATCH] ocaml*: add ocamlopt and ocamlfind and extend ocamlc (#4436) --- pages/common/ocaml.md | 1 + pages/common/ocamlc.md | 5 +++++ pages/common/ocamlfind.md | 17 +++++++++++++++++ pages/common/ocamlopt.md | 13 +++++++++++++ 4 files changed, 36 insertions(+) create mode 100644 pages/common/ocamlfind.md create mode 100644 pages/common/ocamlopt.md diff --git a/pages/common/ocaml.md b/pages/common/ocaml.md index e4d3a68979..311aef7d76 100644 --- a/pages/common/ocaml.md +++ b/pages/common/ocaml.md @@ -2,6 +2,7 @@ > The OCaml repl (read-evaluate-print-loop). > Interprets Ocaml commands. +> More information: . - Read OCaml commands from the user and execute them: diff --git a/pages/common/ocamlc.md b/pages/common/ocamlc.md index 07774f6869..295fb488c7 100644 --- a/pages/common/ocamlc.md +++ b/pages/common/ocamlc.md @@ -2,6 +2,7 @@ > The OCaml bytecode compiler. > Produces executables runnable by the OCaml interpreter. +> More information: . - Create a binary from a source file: @@ -10,3 +11,7 @@ - Create a named binary from a source file: `ocamlc -o {{path/to/binary}} {{path/to/source_file.ml}}` + +- Automatically generate a module signature (interface) file: + +`ocamlc -i {{path/to/source_file.ml}}` diff --git a/pages/common/ocamlfind.md b/pages/common/ocamlfind.md new file mode 100644 index 0000000000..cbed8c1944 --- /dev/null +++ b/pages/common/ocamlfind.md @@ -0,0 +1,17 @@ +# ocamlfind + +> The findlib package manager for OCaml. +> Simplifies linking executables with external libraries. +> More information: . + +- Compile a source file to a native binary and link with packages: + +`ocamlfind ocamlopt -package {{package1}},{{package2}} -linkpkg -o {{executable}} {{source_file.ml}}` + +- Compile a source file to a bytecode binary and link with packages: + +`ocamlfind ocamlc -package {{package1}},{{package2}} -linkpkg -o {{executable}} {{source_file.ml}}` + +- Cross-compile for a different platform: + +`ocamlfind -toolchain {{cross-toolchain}} ocamlopt -o {{executable}} {{source_file.ml}}` diff --git a/pages/common/ocamlopt.md b/pages/common/ocamlopt.md new file mode 100644 index 0000000000..138bb74782 --- /dev/null +++ b/pages/common/ocamlopt.md @@ -0,0 +1,13 @@ +# ocamlopt + +> The OCaml native code compiler. +> Produces native executables, e.g. ELF on Linux. +> More information: . + +- Compile a source file: + +`ocamlopt -o {{path/to/binary}} {{path/to/source_file.ml}}` + +- Compile with debugging enabled: + +`ocamlopt -g -o {{path/to/binary}} {{path/to/source_file.ml}}`