-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
49 lines (37 loc) · 1.21 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
LIB := -package threads,netstring,calendar,extlib,postgresql,ocsigen
CAMLC := ocamlfind ocamlc -thread -g $(LIB)
CAMLOPT := ocamlfind ocamlopt -thread $(LIB)
CAMLDOC := ocamlfind ocamldoc $(LIB)
CAMLDEP := ocamlfind ocamldep
CAMLBUILDOPTS := -ocamlc '$(CAMLC)' -ocamlopt '$(CAMLOPT)'
CAMLBUILD := ocamlbuild $(CAMLBUILDOPTS)
CMA := nurpawiki.cma
CMXA := nurpawiki.cmxa
CMXS := nurpawiki.cmxs
TARGETS := $(CMA)
ifneq ($(shell which ocamlopt),)
TARGETS += $(CMXA)
ifneq ($(wildcard $(shell ocamlc -where)/dynlink.cmxa),)
TARGETS += $(CMXS)
endif
endif
all: $(TARGETS) META
$(CMA): version.ml
$(CAMLBUILD) -classic-display -ocamlc '$(CAMLC)' $@
$(CMXA): version.ml
$(CAMLBUILD) -classic-display -ocamlopt '$(CAMLOPT)' $@
%.cmxs: %.cmxa
$(CAMLOPT) -shared -linkall -o _build/$@ _build/$<
.PHONY: $(CMA) doc install
NWIKI_VER=$(shell cat VERSION)
version.ml:version.ml.in VERSION
echo $(NWIKI_VER)
sed -e "s|%_NURPAWIKI_VERSION_%|$(NWIKI_VER)|g" version.ml.in > version.ml
META:META.in VERSION
sed -e "s|%_NURPAWIKI_VERSION_%|$(NWIKI_VER)|g" META.in > META
doc:
# $(CAMLDOC) -d doc -html db.mli
clean:
-rm -Rf _build META version.ml
install:
ocamlfind install nurpawiki META $(foreach T,$(TARGETS),_build/$(T))