aboutsummaryrefslogtreecommitdiff
path: root/Makefile
blob: e2b7e3f46ce39152b15ca107b6dcf0b6a774ae5b (plain)
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
OCAMLBUILD ?= ocamlbuild
PACKAGES=dynlink,curses,camlzip,xmlm,text,str,menhirLib,zarith,base
PATHS=src,src/odf,src/tree,src/expressions

MENHIR=-use-menhir

LIB  = licht
LIB_STUB = $(LIB)_stub

STUB_OPTIONS=-lflags -ccopt,-L.,-cclib,-l$(LIB_STUB)
BYTE_STUB_OPTIONS=$(STUB_OPTIONS)#,-dllib,-l$(LIB_STUB)

.PHONY: stub

all: native

stub:
	$(MAKE) -C stub LIB=$(LIB)

deps:
	opam install ocamlbuild curses camlzip xmlm ounit text menhir zarith base

byte: stub
	$(OCAMLBUILD) -pkgs $(PACKAGES) $(STUB_OPTIONS) $(MENHIR) -Is $(PATHS) main.byte

native: stub
	$(OCAMLBUILD) -tags optimize\(3\) -pkgs $(PACKAGES) $(STUB_OPTIONS) $(MENHIR) -Is $(PATHS) main.native

doc:
	$(OCAMLBUILD) -pkgs $(PACKAGES) -menhir -Is $(PATHS) licht.docdir/index.html

test.byte: stub
	$(OCAMLBUILD) -pkgs $(PACKAGES),oUnit -cflag -g -lflag -g $(STUB_OPTIONS) $(MENHIR) -Is $(PATHS),tests,tests/odf,tests/tree $@

%.cmxs: stub
	$(OCAMLBUILD) -use-ocamlfind -tags optimize\(3\) -pkgs $(PACKAGES) $(MENHIR) -Is $(PATHS) $@

test: test.byte
	./test.byte

relink: stub
	rm -f _build/main.native
	rm -f _build/main.byte
	rm -f _build/tests.byte
	make

clean:
	make -C stub clean
	$(OCAMLBUILD) -clean