Skip to content

Commit cc40e2f

Browse files
committed
Requires latest ocp-build
1 parent d8bb4c5 commit cc40e2f

File tree

14 files changed

+30
-98
lines changed

14 files changed

+30
-98
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,5 @@ try-js_of_ocaml/lessons.mli
2727
try-js_of_ocaml/try-js_of_ocaml.js
2828
try-js_of_ocaml/try-ocaml.js
2929
Makefile.config
30+
ocp-build.root*
31+
_obuild

Makefile

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,7 @@
22

33
all: Makefile.config
44
$(MAKE) -C cmicomp
5-
ocp-build -scan -meta - try-make-lessons
6-
# $(MAKE) -C ocp-jslib
7-
# $(MAKE) -C ocaml-num
8-
# $(MAKE) -C toplevel
9-
# $(MAKE) -C tutorial
5+
ocp-build -scan try-make-lessons
106
$(MAKE) -C try-ocaml
117
$(MAKE) -C try-js_of_ocaml
128

@@ -15,21 +11,8 @@ Makefile.config:
1511

1612
clean:
1713
$(MAKE) -C cmicomp clean
18-
# $(MAKE) -C ocp-jslib clean
19-
# $(MAKE) -C toplevel clean
20-
# $(MAKE) -C ocaml-num clean
21-
# $(MAKE) -C toplevel clean
22-
# $(MAKE) -C tutorial clean
2314
$(MAKE) -C try-ocaml clean
2415
$(MAKE) -C try-js_of_ocaml clean
25-
rm -rf _obuild
26-
27-
depend:
28-
$(MAKE) -C ocp-jslib depend
29-
$(MAKE) -C toplevel depend
30-
$(MAKE) -C tutorial depend
31-
$(MAKE) -C try-ocaml depend
32-
$(MAKE) -C try-js_of_ocaml depend
3316

3417
update-lessons:
3518
touch ocaml-lessons/goodies.ml

Makefile.tryocaml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ all: lessons.ml byte
99

1010
clean:
1111
rm -f *~ $(SOURCES) $(TRYOCAML_NAME).tmp $(TRYOCAML_NAME).js
12+
ocp-build -clean
1213

1314
lessons.mli: $(TUTORIAL_DIR)/lessons.mli
1415
cp -f $(TUTORIAL_DIR)/lessons.mli lessons.mli
@@ -71,11 +72,12 @@ STDLIB_MODULES=\
7172
stringLabels \
7273
weak
7374

74-
TOPLEVEL_MODULES=$(STDLIB_MODULES) n regexp tutorial outcometree topdirs toploop toplevel clflags n big_int num topnum
75+
TOPLEVEL_MODULES=$(STDLIB_MODULES) n regexp tutorial outcometree topdirs toploop toplevel clflags n big_int num topnum lwt
7576

7677
TOPLEVEL_CMIS=$(TOPLEVEL_INCDIR)/toplevel.cmi
7778

7879
INCLUDES= \
80+
-I $(LWT_DIR) \
7981
-I $(CMICOMP_DIR) \
8082
-I $(JS_COMPILER_LIB) \
8183
-I $(JS_DIR) \
@@ -90,7 +92,7 @@ INCLUDES= \
9092
ALWAYS:
9193

9294
../_obuild/$(TRYOCAML_NAME)/$(TRYOCAML_NAME).byte: ALWAYS $(SOURCES)
93-
ocp-build -meta - $(TRYOCAML_NAME)
95+
ocp-build $(TRYOCAML_NAME)
9496

9597
$(TRYOCAML_NAME).js: \
9698
../_obuild/$(TRYOCAML_NAME)/$(TRYOCAML_NAME).byte \
@@ -102,7 +104,7 @@ $(TRYOCAML_NAME).js: \
102104
$(COMP) $(INCLUDES) \
103105
-toplevel -linkall -noinline -noruntime \
104106
$(JSFILES) $(TRYOCAML_NAME).tmp $(OPTIONS)
105-
@rm -f $(TRYOCAML_NAME).tmp
107+
# @rm -f $(TRYOCAML_NAME).tmp
106108

107109
byte: $(TRYOCAML_NAME).js
108110

configure

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@ echo Generating Makefile.config
44
echo OCAMLC=ocamlc > Makefile.config.temp
55
echo OCAMLDEP=ocamldep.opt >> Makefile.config.temp
66
echo OCAMLVNUM=`ocamlc -version` >> Makefile.config.temp
7-
echo JS_DIR=`ocamlfind -query js_of_ocaml` >> Makefile.config.temp
7+
echo JS_DIR=`ocp-build -configure -query js_of_ocaml` >> Makefile.config.temp
8+
echo LWT_DIR=`ocp-build -configure -query lwt` >> Makefile.config.temp
89
echo JS_COMP=`which js_of_ocaml` >> Makefile.config.temp
9-
echo JS_COMPILER_LIB=`ocamlfind -query js_of_ocaml_compiler` >> Makefile.config.temp
10+
echo JS_COMPILER_LIB=`ocp-build -configure -query js_of_ocaml_compiler` >> Makefile.config.temp
1011
echo 'TOPLEVEL_DIR=$(ROOT)/toplevel' >> Makefile.config.temp
1112
echo 'TOPLEVEL_INCDIR=$(ROOT)/_obuild/try-toplevel' >> Makefile.config.temp
1213
echo 'OCAMLNUM_INCDIR=$(ROOT)/_obuild/ocaml-num' >> Makefile.config.temp
@@ -19,3 +20,5 @@ echo 'SCP=scp' >> Makefile.config.temp
1920

2021
mv Makefile.config.temp Makefile.config
2122
echo Makefile.config generated
23+
24+
echo -n "" >> ocp-build.root

ocaml-num/ocaml-num.ocp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@ begin library "ocaml-num"
55
]
66
end
77

8+
(*
89
begin program "testdiv"
910
files = [ "tests/testdiv.ml" ]
1011
requires = [ "ocaml-num" ]
1112
end
13+
*)
1214

1315
(*
1416
numtop: OCamlNum.cmo

ocp-jslib/Makefile

Lines changed: 0 additions & 18 deletions
This file was deleted.

ocp-jslib/graphics.ml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11

2+
let graphics_title_id = "graphics-title"
3+
let graphics_id = "graphics"
4+
25
exception Graphic_failure of string
36

47
(* NOT IMPLEMENTED:
@@ -31,6 +34,7 @@ type state = {
3134
}
3235

3336
let state = ref None
37+
let graphics_title = ref "Graphics Window"
3438

3539
let get_state () =
3640
match !state with
@@ -90,6 +94,8 @@ let _ =
9094
Callback.register_exception "Graphics.Graphic_failure" (Graphic_failure "")
9195

9296
let set_window_title title =
97+
graphics_title := title;
98+
Utils.set_div_by_id graphics_title_id !graphics_title;
9399
(* TODO *) ()
94100

95101
let resize_window width height =
@@ -419,12 +425,13 @@ let close_graph () =
419425
let canvas = c.canvas in
420426
canvas##width <- 0;
421427
canvas##height <- 0;
422-
Utils.set_div_by_id "graphics" ""
428+
Utils.set_div_by_id graphics_id "";
429+
Utils.set_div_by_id graphics_title_id ""
423430

424431
let open_graph string =
425432
close_graph ();
426433
let canvas = Dom_html.createCanvas doc in
427-
let body = Utils.get_element_by_id "graphics" in
434+
let body = Utils.get_element_by_id graphics_id in
428435
let context = canvas##getContext (Dom_html._2d_) in
429436
Dom.appendChild body canvas;
430437
let x = 0 in
@@ -443,4 +450,5 @@ let open_graph string =
443450
raw_set_color blue;
444451
set_text_size text_size;
445452
raw_set_line_width line_width;
453+
Utils.set_div_by_id graphics_title_id !graphics_title;
446454
()

ocp-jslib/ocp-jslib.ocp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@ begin
66
By default, ocp-build renames X.asm in X, and keeps X.byte. We should
77
add options "byte_name" and "asm_name".
88
*)
9+
(*
910
begin program "camlp4o"
1011
requires = [ "camlp4lib" "camlp4-pa-op" "Camlp4Bin" ]
1112
end
12-
13+
*)
1314
dirname = [ "/home/lefessan/.opam/4.00.1/lib/js_of_ocaml" ]
1415

1516
begin objects "js_of_ocaml.camlp4-syntax.objects"

toplevel/Makefile

Lines changed: 0 additions & 26 deletions
This file was deleted.

try-js_of_ocaml/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ <h1 id="main-title">Try js_of_ocaml</h1>
8686
<div id="toplevel"></div>
8787
</div>
8888
<div id="buttons"></div>
89+
<div id="graphics-title"></div>
8990
<div id="graphics"></div>
9091
<table class="zebra-striped">
9192
<thead><tr><th id="text-commands">Commands</th><th id="text-effects">Effects</th></tr></thead>

try-js_of_ocaml/try-js_of_ocaml.ocp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
begin library "try-js_of_ocaml-lessons"
33
files = [ "lessons.ml" ]
44
is_before = [ "try-tutorial" ]
5-
65
end
76

87
begin program "try-js_of_ocaml"

try-ocaml/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ <h1 id="main-title">Try OCaml</h1>
8686
<div id="toplevel"></div>
8787
</div>
8888
<div id="buttons"></div>
89+
<div id="graphics-title"></div>
8990
<div id="graphics"></div>
9091
<table class="zebra-striped">
9192
<thead><tr><th id="text-commands">Commands</th><th id="text-effects">Effects</th></tr></thead>

try-ocaml/try-ocaml.ocp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,11 @@
22
begin library "try-ocaml-lessons"
33
files = [ "lessons.ml" ]
44
is_before = [ "try-tutorial" ]
5-
65
end
76

87
begin program "try-ocaml"
98
has_asm = false
10-
bytelink = "-linkall"
9+
bytelink += "-linkall"
1110
files = [ "main.ml" ]
1211
requires = [ "ocp-jslib" "lwt" "try-ocaml-lessons" "try-tutorial" "try-toplevel" ]
1312
end

tutorial/Makefile

Lines changed: 0 additions & 25 deletions
This file was deleted.

0 commit comments

Comments
 (0)