aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rwxr-xr-xMakefile43
1 files changed, 28 insertions, 15 deletions
diff --git a/Makefile b/Makefile
index e2b7e3f..347d7d5 100755
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,9 @@
-OCAMLBUILD ?= ocamlbuild
+PREFIX=/usr/local
+BINDIR=$(PREFIX)/bin
PACKAGES=dynlink,curses,camlzip,xmlm,text,str,menhirLib,zarith,base
PATHS=src,src/odf,src/tree,src/expressions
+TARGET=licht
+OCB=ocamlbuild -pkgs $(PACKAGES) $(STUB_OPTIONS) $(MENHIR) -Is $(PATHS)
MENHIR=-use-menhir
@@ -10,41 +13,51 @@ LIB_STUB = $(LIB)_stub
STUB_OPTIONS=-lflags -ccopt,-L.,-cclib,-l$(LIB_STUB)
BYTE_STUB_OPTIONS=$(STUB_OPTIONS)#,-dllib,-l$(LIB_STUB)
-.PHONY: stub
+.PHONY: stub clean
-all: native
+all: $(TARGET)
stub:
$(MAKE) -C stub LIB=$(LIB)
deps:
- opam install ocamlbuild curses camlzip xmlm ounit text menhir zarith base
+ opam install ocamlfind ocamlbuild curses camlzip xmlm ounit text menhir zarith base
byte: stub
- $(OCAMLBUILD) -pkgs $(PACKAGES) $(STUB_OPTIONS) $(MENHIR) -Is $(PATHS) main.byte
+ $(OCB) main.byte
-native: stub
- $(OCAMLBUILD) -tags optimize\(3\) -pkgs $(PACKAGES) $(STUB_OPTIONS) $(MENHIR) -Is $(PATHS) main.native
+$(TARGET): stub
+ $(OCB) -tags optimize\(3\) main.native
+ cp -L main.native $(TARGET)
doc:
- $(OCAMLBUILD) -pkgs $(PACKAGES) -menhir -Is $(PATHS) licht.docdir/index.html
+ $(OCB) 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 $@
+install: $(TARGET)
+ mkdir -p $(BINDIR)
+ install $(TARGET) $(BINDIR)
+
+uninstall:
+ rm -rf $(BINDIR)/$(TARGET)
%.cmxs: stub
- $(OCAMLBUILD) -use-ocamlfind -tags optimize\(3\) -pkgs $(PACKAGES) $(MENHIR) -Is $(PATHS) $@
+ $(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/main.native
- rm -f _build/main.byte
- rm -f _build/tests.byte
+ rm -f _build/*.native
+ rm -f _build/*.byte
make
clean:
+ rm -f licht
+ rm -f *.native
+ rm -f *.byte
make -C stub clean
- $(OCAMLBUILD) -clean
+ $(OCB) -clean