aboutsummaryrefslogtreecommitdiff
path: root/Makefile
blob: 403cf41bddedd18195da61ed821081aa78f87137 (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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
PREFIX=/usr/local
BINDIR=$(PREFIX)/bin
OCAMLBUILD ?= ocamlbuild
PACKAGES=dynlink,curses,camlzip,xmlm,text,str,menhirLib,zarith,base,string_dict
PATHS=src,src/odf,src/tree,src/expressions
TARGET=licht
OCB=ocamlbuild -pkgs $(PACKAGES) $(STUB_OPTIONS) $(MENHIR) -Is $(PATHS) 

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 clean

all: $(TARGET)

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

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

byte: stub
	$(OCB) main.byte

$(TARGET): stub
	$(OCB) -tags optimize\(3\) main.native
	cp -L main.native $(TARGET)

doc:
	$(OCB) licht.docdir/index.html

install: $(TARGET)
	mkdir -p $(BINDIR)
	install $(TARGET) $(BINDIR)	

uninstall:
	rm -rf $(BINDIR)/$(TARGET)

%.cmxs: stub
	$(OCB) -use-ocamlfind -tags optimize\(3\) -Is $(PATHS) $@

test: test.byte
	./test.byte

test.byte: stub
	$(OCB) -pkg oUnit -cflag -g -lflag -g -Is tests,tests/odf,tests/tree $@

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

clean:
	rm -f licht
	rm -f *.native
	rm -f *.byte
	$(MAKE) -C stub LIB=$(LIB) clean


	$(OCB) -clean