From 5f94836f4d1adca31c502706831b9ac600c3f41f Mon Sep 17 00:00:00 2001 From: Sébastien Dailly Date: Mon, 12 Feb 2018 15:22:56 +0100 Subject: Update licence, add opam script --- Makefile | 43 ++++++++++++++++++++++++++++--------------- 1 file changed, 28 insertions(+), 15 deletions(-) (limited to 'Makefile') 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 -- cgit v1.2.3