-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
56 lines (40 loc) · 1.74 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
50
51
52
53
54
55
NAME = cass
PA_FILES = cass_ast cass_lexer cass_parser cass_printer cass_quotations
LIB_FILES = css
INCLS = \
$(shell ocamlfind query dyntype.syntax -predicates syntax,preprocessor -r -format "-I %d %a") \
$(shell ocamlfind query xmlm -predicates byte -r -format "-I %d %a") \
$(shell ocamlfind query str -predicates byte -r -format "-I %d %a") \
##########################################################
NAME_FILES = _build/pa_lib/pa_$(NAME).cmxa \
_build/pa_lib/pa_$(NAME).cma \
_build/lib/$(NAME).cma \
_build/lib/$(NAME).cmxa
_PA_FILES = $(addprefix _build/pa_lib/,$(PA_FILES))
__PA_FILES = $(addsuffix .cmi,$(_PA_FILES)) \
$(addsuffix .cmo,$(_PA_FILES)) \
$(addsuffix .cmx,$(_PA_FILES))
_LIB_FILES = $(addprefix _build/lib/,$(LIB_FILES))
__LIB_FILES = $(addsuffix .cmi,$(_LIB_FILES)) \
$(addsuffix .cmo,$(_LIB_FILES)) \
$(addsuffix .cmx,$(_LIB_FILES))
FILES = $(NAME_FILES) $(__PA_FILES) $(__LIB_FILES)
all:
ocamlbuild pa_$(NAME).cma pa_$(NAME).cmxa
ocamlbuild -pp "camlp4o $(INCLS) pa_lib/pa_$(NAME).cma" $(NAME).cmxa $(NAME).cma
install:
ocamlfind install $(NAME) META $(FILES)
uninstall:
ocamlfind remove $(NAME)
clean:
ocamlbuild -clean
rm -rf test_exp.ml test.cmo test.cmx test.cmi test.o test_exp *~
.PHONY: test
test: all
ocamlbuild -pp "camlp4o $(INCLS) pa_lib/pa_$(NAME).cma" test.byte --
.PHONY: test_exp
test_exp: lib_test/test.ml
camlp4orf $(INCLS) _build/pa_lib/pa_$(NAME).cma lib_test/test.ml -printer o > _build/test_exp.ml
ocamlc -g -I +camlp4 dynlink.cma camlp4lib.cma $(INCLS) -annot -I _build/lib $(NAME).cma _build/test_exp.ml -o _build/test_exp
debug: all
camlp4orf $(INCLS) _build/pa_lib/pa_$(NAME).cma test.ml