forked from OCamlPro/tryocaml
/
Makefile.tryocaml
110 lines (94 loc) · 2.66 KB
/
Makefile.tryocaml
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
all: byte $(TRYOCAML_NAME).js
include $(ROOT)/Makefile.jsconfig
SOURCES= lessons.ml lessons.mli
TARGETS=$(TRYOCAML_NAME).byte $(TRYOCAML_NAME).js
include $(ROOT)/Makefile.config
all: lessons.ml byte
lessons.mli: $(TUTORIAL_DIR)/lessons.mli
cp -f $(TUTORIAL_DIR)/lessons.mli lessons.mli
lessons.ml: lessons.cmi $(LESSON_SET)/goodies.ml
$(TUTORIAL_DIR)/make_lessons $(LESSON_SET) > lessons.ml
CMOS= $(SOURCES:.ml=.cmo)
############### TRYOCAML_NAME=toplevel
# remove this variable to use the default ocaml toplevel
include $(ROOT)/toplevellib-$(OCAMLVNUM)/Makefile.config
COMP=$(JS_DIR)/compiler/js_of_ocaml
JSFILES=$(JS_DIR)/runtime/runtime.js $(JS_DIR)/runtime/weak.js $(TOPLEVEL_DIR)/toplevel_runtime.js
#OCAMLC=ocamlfind ocamlc -annot -pp "camlp4o $(JS_DIR)/lib/syntax/pa_js.cmo"
EXPUNGE=$(shell ocamlc -where)/expunge
# Removed gc and sys
STDLIB_MODULES=\
arg \
array \
arrayLabels \
buffer \
callback \
camlinternalLazy \
camlinternalMod \
camlinternalOO \
char \
complex \
digest \
filename \
format \
genlex \
hashtbl \
int32 \
int64 \
lazy \
lexing \
list \
listLabels \
map \
marshal \
moreLabels \
nativeint \
obj \
oo \
parsing \
pervasives \
printexc \
printf \
queue \
random \
scanf \
set \
sort \
stack \
stdLabels \
stream \
string \
stringLabels \
weak
TOPLEVEL_MODULES=$(STDLIB_MODULES) n regexp tutorial outcometree topdirs toploop toplevel clflags n big_int num topnum
TOPLEVEL_CMIS=$(TOPLEVEL_DIR)/toplevel.cmi
TOPLEVEL_CMAS= \
$(CMICOMP_DIR)/js_of_ocaml.cma $(JS_DIR)/compiler/compiler.cma \
$(TOPLEVELLIB_CMAS) \
$(OCAMLNUM_DIR)/ocaml-num.cma \
lessons.cmo \
$(TUTORIAL_DIR)/tutorial.cma \
$(OCPJSLIB_DIR)/ocp-jslib.cma
TOPLEVEL_CMOS=$(TOPLEVEL_DIR)/toplevel.cmo \
$(TOPLEVEL_DIR)/topmain.cmo main.cmo
INCLUDES= \
-I $(CMICOMP_DIR) \
-I $(JS_DIR)/compiler \
-I $(JS_DIR)/lib \
-I $(TUTORIAL_DIR)/ \
$(INCLUDE_TOPLEVELLIB) \
-I $(OCAMLNUM_DIR) \
-I $(TOPLEVEL_DIR) \
-I $(OCPJSLIB_DIR) \
$(TRYOCAML_EXTRA_INCLUDES) \
-I .
$(TRYOCAML_NAME).js: $(TRYOCAML_NAME).byte $(JSFILES)
$(COMP) $(INCLUDES) -toplevel -noinline -noruntime $(JSFILES) $(TRYOCAML_NAME).byte $(OPTIONS)
$(TRYOCAML_NAME).byte: $(TOPLEVEL_CMIS) $(TOPLEVEL_CMOS) $(TOPLEVEL_CMAS) \
$(TRYOCAML_EXTRA_CMAS) $(TRYOCAML_EXTRA_CMIS)
$(OCAMLFIND) $(OCAMLC) $(INCLUDES) -linkall $(OCAMLFIND_OPTIONS) -package str -linkpkg \
-o $@.tmp $(TOPLEVEL_CMAS) \
$(TRYOCAML_EXTRA_CMAS) $(TRYOCAML_EXTRA_CMOS) $(TOPLEVEL_CMOS)
$(EXPUNGE) $@.tmp $@ $(TOPLEVEL_MODULES) $(TRYOCAML_EXTRA_MODULES)
rm -f $@.tmp
byte: lessons.cmo $(TRYOCAML_NAME).byte