From cce03d4c8350aa9caf7ae13ca2d3bd172a25cbf5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20Dimino?= Date: Mon, 29 Oct 2012 11:11:46 +0100 Subject: [PATCH] Add an example showing how to build a custom utop with ocamlbuild --- README.md | 3 +++ examples/custom-utop/Makefile | 7 +++++++ examples/custom-utop/myutop.mltop | 1 + examples/custom-utop/myutop_main.ml | 3 +++ 4 files changed, 14 insertions(+) create mode 100644 examples/custom-utop/Makefile create mode 100644 examples/custom-utop/myutop.mltop create mode 100644 examples/custom-utop/myutop_main.ml diff --git a/README.md b/README.md index 772af49..3e50def 100644 --- a/README.md +++ b/README.md @@ -142,3 +142,6 @@ For example: Note that if you are not using ocamlfind, you will need to do that yourself. You have to call `Topfind.don't_load` with the list of all packages linked with the toplevel. + +A full example using ocamlbuild is provided in the +[examples/custom-utop]() directory. diff --git a/examples/custom-utop/Makefile b/examples/custom-utop/Makefile new file mode 100644 index 0000000..3755d97 --- /dev/null +++ b/examples/custom-utop/Makefile @@ -0,0 +1,7 @@ +OC := ocamlbuild -classic-display -no-links -use-ocamlfind + +build: + $(OC) -pkg threads,utop -cflag -thread -lflag -thread myutop.top + +clean: + $(OC) -clean diff --git a/examples/custom-utop/myutop.mltop b/examples/custom-utop/myutop.mltop new file mode 100644 index 0000000..8f42e2d --- /dev/null +++ b/examples/custom-utop/myutop.mltop @@ -0,0 +1 @@ +Myutop_main diff --git a/examples/custom-utop/myutop_main.ml b/examples/custom-utop/myutop_main.ml new file mode 100644 index 0000000..949cebf --- /dev/null +++ b/examples/custom-utop/myutop_main.ml @@ -0,0 +1,3 @@ + +(* Start utop. It never returns. *) +let () = UTop_main.main ()