ocaml*: add ocamlopt and ocamlfind and extend ocamlc (#4436)

beep
Daniil Baturin 2020-10-05 21:19:55 +07:00 committed by GitHub
parent ab043776f0
commit f6e080573a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 36 additions and 0 deletions

View File

@ -2,6 +2,7 @@
> The OCaml repl (read-evaluate-print-loop).
> Interprets Ocaml commands.
> More information: <https://ocaml.org>.
- Read OCaml commands from the user and execute them:

View File

@ -2,6 +2,7 @@
> The OCaml bytecode compiler.
> Produces executables runnable by the OCaml interpreter.
> More information: <https://ocaml.org>.
- 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}}`

17
pages/common/ocamlfind.md Normal file
View File

@ -0,0 +1,17 @@
# ocamlfind
> The findlib package manager for OCaml.
> Simplifies linking executables with external libraries.
> More information: <http://projects.camlcity.org/projects/findlib.html>.
- 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}}`

13
pages/common/ocamlopt.md Normal file
View File

@ -0,0 +1,13 @@
# ocamlopt
> The OCaml native code compiler.
> Produces native executables, e.g. ELF on Linux.
> More information: <https://ocaml.org>.
- 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}}`