-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
48 lines (33 loc) · 1.15 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
PROGS=ppx_gensqlite sample.byte sample.native test
all: $(PROGS)
CC=ocamlfind ocamlc
CC_native=ocamlfind ocamlopt
PKGS = compiler-libs.common,ppx_tools.metaquot,re.pcre
ppx_gensqlite: q.ml ppx_gensqlite.ml
$(CC) -package $(PKGS) -linkpkg -o $@ $^
gensqlite.%: gensqlite_tools.ml
$(CC) -package sqlite3 $(LIB_CFLAGS) -o $@ $^
test: gensqlite.cma q.ml test.ml
$(CC) -package re.pcre,oUnit,sqlite3 -ppx "./ppx_gensqlite" -o $@ -linkpkg $^
BACKENDS=native byte
LIB_CFLAGS=-a
%.native: CC:=$(CC_native)
%.cmxa: CC:=$(CC_native)
%.cmxs: CC:=$(CC_native)
%.cmxs: LIB_CFLAGS=-shared
native_LIB=cmxa
byte_LIB=cma
SAMPLES = $(BACKENDS:%=sample.%)
gensqlite:=gensqlite.$$($$*_LIB)
.SECONDEXPANSION:
$(SAMPLES): sample.% : $(gensqlite) sample.ml
$(CC) -package sqlite3 -ppx "./ppx_gensqlite" -linkpkg -o $@ $^
lib: ppx_gensqlite gensqlite.cmxa gensqlite.cma gensqlite.cmxs
install: lib
ocamlfind install gensqlite META LICENSE gensqlite.* gensqlite_tools.cmi
cp ppx_gensqlite $(shell dirname `which ocamlfind`)
uninstall:
ocamlfind remove gensqlite
rm $(shell dirname `which ocamlfind`)/ppx_gensqlite
clean:
rm -f *.cm[ioxa] *.cmx[as] *.o *.a *.cache $(PROGS)