-
Notifications
You must be signed in to change notification settings - Fork 2
/
GNUmakefile
111 lines (81 loc) · 3.68 KB
/
GNUmakefile
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# Current version number of Sukerujo (must be the same as the Dedukti kernel lib).
VERSION = master
# Compile with "make Q=" to display the commands that are run.
Q = @
all: parser commands META
#### Compilation of the parser library #######################################
PARSER_MLI := $(wildcard parser/*.mli)
PARSER_ML := $(PARSER_MLI:.mli=.ml)
PARSER_GEN := parser/menhir_parser.mly parser/lexer.mll
.PHONY: parser
parser: _build/parser/parser.cma _build/parser/parser.cmxa
DK_PACKAGE = -package dedukti.api -package dedukti.kernel
_build/parser/parser.cma: $(PARSER_MLI) $(PARSER_ML) $(PARSER_GEN)
@echo "[BYT] $@"
$(Q)ocamlbuild -quiet -use-ocamlfind $(DK_PACKAGE) parser/parser.cma
_build/parser/parser.cmxa: $(PARSER_MLI) $(PARSER_ML) $(PARSER_GEN)
@echo "[OPT] $@"
$(Q)ocamlbuild -quiet -use-ocamlfind $(DK_PACKAGE) parser/parser.cmxa
#### Compilation of the Sukerujo suite ########################################
.PHONY: commands
commands: skcheck.native skdep.native sktop.native
skcheck.native: parser commands/skcheck.ml
@echo "[OPT] $@"
$(Q)ocamlbuild -quiet -use-ocamlfind $(DK_PACKAGE) commands/skcheck.native
skdep.native: parser commands/skdep.ml
@echo "[OPT] $@"
$(Q)ocamlbuild -quiet -use-ocamlfind $(DK_PACKAGE) commands/skdep.native
sktop.native: parser commands/sktop.ml
@echo "[OPT] $@"
$(Q)ocamlbuild -quiet -use-ocamlfind $(DK_PACKAGE) commands/sktop.native
#### Generation of the META file #############################################
META: GNUmakefile
@echo "[GEN] $@"
@echo 'name = "sukerujo"' > META
@echo 'version = "$(VERSION)"' >> META
@echo 'description = "Sukerujo library - syntactic sugar for Dedukti"' >> META
@echo 'requires = "unix"' >> META
@echo 'archive(byte) = "parser.cma"' >> META
@echo 'archive(native) = "parser.cmxa"' >> META
@echo >> META
@echo 'package "parser" (' >> META
@echo ' version = "$(VERSION)"' >> META
@echo ' description = "Sukerujo parser"' >> META
@echo ' requires = "unix, dedukti.kernel"' >> META
@echo ' archive(byte) = "parser.cma"' >> META
@echo ' archive(native) = "parser.cmxa"' >> META
@echo ')' >> META
#### Installation targets ####################################################
BINDIR = $(dir $(shell which ocaml))
.PHONY: uninstall
uninstall:
@ocamlfind remove sukerujo
@rm -f $(BINDIR)/skcheck
@rm -f $(BINDIR)/skdep
@rm -f $(BINDIR)/sktop
.PHONY: install
install: uninstall all
@ocamlfind install sukerujo META \
_build/parser/parser.mli _build/parser/parser.cmi \
$(wildcard _build/parser/*.cmx) $(wildcard _build/parser/*.o) \
_build/parser/parser.cma \
_build/parser/parser.cmxa \
_build/parser/parser.a
install -m 755 -d $(BINDIR)
install -m 755 -p skcheck.native $(BINDIR)/skcheck
install -m 755 -p skdep.native $(BINDIR)/skdep
install -m 755 -p sktop.native $(BINDIR)/sktop
#### Test targets ############################################################
.PHONY: tests
tests: all tests/tests.sh
@./tests/tests.sh
.PHONY: full_tests
full_tests: all tests/external_tests.sh
@./tests/external_tests.sh
#### Cleaning targets ########################################################
clean:
$(Q)ocamlbuild -quiet -clean
$(Q)rm -f builtins.dko
distclean: clean
$(Q)find -name "*~" -exec rm {} \;
$(Q)rm -f META