forked from dapphub/klab
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
84 lines (60 loc) · 1.9 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
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
PATH:=$(PATH):$(CURDIR)/bin
KLAB_EVMS_PATH:=$(CURDIR)/evm-semantics
export PATH
export KLAB_EVMS_PATH
LIBEXEC_DIR=$(CURDIR)/libexec
HASKELL_DIR=$(CURDIR)/haskell
GAS_SOLVER=$(HASKELL_DIR)/result/bin/k-gas-analyser
# shell output colouring:
red:=$(shell tput setaf 1)
green:=$(shell tput setaf 2)
yellow:=$(shell tput setaf 3)
bold:=$(shell tput bold)
reset:=$(shell tput sgr0)
default: deps
clean:
rm -fdR out/* evm-semantics
git submodule sync --recursive
git submodule update --init -- evm-semantics
deps: deps-kevm deps-npm
deps-kevm:
git submodule update --init -- evm-semantics
cd evm-semantics \
&& make k-deps tangle-deps -B \
&& make build-java -B
deps-npm:
npm install
deps-haskell:
cd haskell/ && make
ln -sf $(GAS_SOLVER) $(LIBEXEC_DIR)/klab-gas-analyser
media: media/introduction.pdf
media/%.pdf: media/%.md
pandoc --from markdown --to beamer --output $@ $<
KLAB = $(CURDIR)/bin/klab
examples=$(wildcard examples/*)
# this is now redundant
build-test:
clean-test: $(examples:=.clean)
%.clean:
$(MAKE) -C $* clean
# workaround for patsubst in pattern matching target below
PERCENT := %
.SECONDEXPANSION:
test-with-gas: $(examples:=.example-with-gas)
$(info $(bold)CHECKED$(reset) all example specs, with full gas analysis.)
%.example-with-gas:
$(info Moving to example: $*)
@ cd $* && klab prove-all && echo "$(green)$(bold)CHECKED$(reset) example: $* (with full gas analysis))"
test: test-with-gas
test-without-gas: $$(patsubst $$(PERCENT),$$(PERCENT).proof,$$(wildcard $(CURDIR)/examples/*/out/specs/*.k))
$(info $(bold)CHECKED$(reset) all test specs (without gas analysis).)
%.k.proof: %.k
cd $(dir $*)../../ && $(KLAB) prove --dump $<
SHELL = bash
DIRS = {bin,libexec}
PREFIX ?= /usr/local
DIRS:; mkdir -p $(PREFIX)/$(DIRS)
files = $(shell ls -d $(DIRS)/*)
link: uninstall DIRS; for x in $(files); do \
ln -s `pwd`/$$x $(PREFIX)/$$x; done
uninstall:; rm -rf $(addprefix $(PREFIX)/,$(files))