forked from ocsigen/js_of_ocaml
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
103 lines (86 loc) · 2.17 KB
/
Makefile
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
NAME=toplevel
OBJS=toplevel.cmo
all: $(NAME).js
include ../Makefile.conf
-include ../Makefile.local
ifeq ($(OCAML4),"YES")
OCAMLLIB=ocamlcommon.cma ocamlbytecomp.cma ocamltoplevel.cma
else
OCAMLLIB=toplevellib.cma
endif
COMPILER_LIBS=$(shell ocamlc -where)/compiler-libs
OCPINDENT=$(shell ocamlfind query ocp-indent -format "-package %p.lib" 2> /dev/null)
ifneq ($(OCPINDENT),)
OPTCOMP_OPT=-ppopt -let -ppopt ocpindent=true
endif
COMP=../compiler/$(COMPILER)
JSFILES=../runtime/runtime.js ../runtime/weak.js ../runtime/toplevel.js
OCAMLC=ocamlfind ocamlc -package lwt,optcomp -syntax camlp4o $(OCPINDENT) $(OPTCOMP_OPT) -ppopt "../lib/syntax/pa_js.cmo" \
-I $(COMPILER_LIBS) -I ../compiler \
-I ../lib
STDLIB= ../lib/$(LIBNAME).cma ../compiler/compiler.cma $(OCAMLLIB)
EXPUNGE=$(shell ocamlc -where)/expunge
# Removed gc and sys
STDLIB_MODULES=\
array \
arrayLabels \
buffer \
camlinternalLazy \
camlinternalMod \
camlinternalOO \
char \
complex \
digest \
filename \
format \
genlex \
hashtbl \
int32 \
int64 \
lazy \
lexing \
list \
listLabels \
map \
marshal \
moreLabels \
nativeint \
oo \
parsing \
pervasives \
printexc \
printf \
queue \
random \
scanf \
set \
sort \
stack \
stdLabels \
stream \
string \
stringLabels \
lwt \
bigarray
PERVASIVES=$(STDLIB_MODULES) outcometree topdirs toploop
#toplevel.byte: $(OBJS:cmx=cmo) toplevel.cmo
# ocamlfind ocamlc -linkall -g -package str -linkpkg toplevellib.cma -o [email protected] $^
$(NAME).js: $(NAME).byte $(COMP) $(JSFILES)
$(COMP) -toplevel -noruntime $(JSFILES) $(NAME).byte \
-I $(COMPILER_LIBS) \
-I $(shell ocamlfind query lwt) \
-I ./ -I ../lib/ \
$(OPTIONS)
$(NAME).byte: $(OBJS) ../compiler/compiler.cma
$(OCAMLC) -linkall -package findlib,lwt,bigarray $(OCPINDENT) -linkpkg -o [email protected] $(STDLIB) $(OBJS)
$(EXPUNGE) [email protected] $@ $(PERVASIVES)
rm -f [email protected]
%.cmo: %.ml ../compiler/compiler.cma
$(OCAMLC) -c $<
../compiler/compiler.cma:
$(MAKE) -C ../compiler compiler.cma
clean::
rm -f *.cm[io] $(NAME).byte $(NAME).js
depend:
ocamlfind ocamldep -syntax camlp4o -package optcomp -ppopt "../lib/syntax/pa_js.cmo" -I ../compiler *.ml *.mli > .depend
include .depend