-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
66 lines (53 loc) · 1.99 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
project=tournabox
pkgs=-pkgs js_of_ocaml.log,js_of_ocaml,js_of_ocaml.syntax -syntax camlp4o
ocamlbuild_flags=-cflag -annot -use-ocamlfind
JSO_FLAGS := +weak.js
ifeq ($(debug),)
FLAGS := $(ocamlbuild_flags) $(pkgs)
else
# e.g. `make debug=1 dev'
FLAGS := $(ocamlbuild_flags) -lflag -g -cflag -g $(pkgs)
JSO_FLAGS += --enable excwrap --debuginfo --pretty --noinline
endif
TESTING_FLAGS := -pkgs ojasmine
templates=tests/.stog/templates
testOutDir=$(TOURNABOX_TESTDIR)/tests
doc:
ocamlbuild $(FLAGS) $(project).docdir/index.html
js:
ocamlbuild $(FLAGS) $(project).byte
js_of_ocaml $(JSO_FLAGS) $(project).byte
lessc $(project).less $(project).css
dev: checkTestDir install
cp `ocamlfind query $(project)`/$(project).css $(TOURNABOX_TESTDIR)
cp `ocamlfind query $(project)`/$(project).js $(TOURNABOX_TESTDIR)
cp ./tst.html $(TOURNABOX_TESTDIR)
indent:
ocp-indent --inplace *.mli *.ml questions/*.ml*
install: uninstall js doc
ocamlfind install $(project) META $(project).js $(project).css $(project).less
mkdir -p `ocamlfind query $(project)`/../../doc/$(project)
cp -r _build/$(project).docdir `ocamlfind query $(project)`/../../doc/$(project)
uninstall:
if ocamlfind query $(project) ; then \
rm -rf `ocamlfind query $(project)`/../../doc/$(project) ; \
ocamlfind remove $(project) ; \
fi
testSuite: checkTestDir
ocamlbuild $(FLAGS) $(TESTING_FLAGS) test_tournabox.byte
js_of_ocaml $(JSO_FLAGS) test_tournabox.byte
stog tests -d $(testOutDir) --tmpl $(templates)
cp test_tournabox.js $(testOutDir)
checkTestDir:
ifeq ($(TOURNABOX_TESTDIR),)
echo "please set the env variable TOURNABOX_TESTDIR to the directory into which your test page should be copied"
exit 1
else
rm -rf $(TOURNABOX_TESTDIR)/*
endif
# make question CASE=scrolling
question: dev checkTestDir
ocamlbuild $(DEBUG_FLAGS) test_$(CASE).byte
js_of_ocaml $(JSO_DEBUG_FLAGS) test_$(CASE).byte
cp test_$(CASE).js questions/test_$(CASE).html $(TOURNABOX_TESTDIR)
.PHONY: testSuite js dev install uninstall checkTestDir question indent