-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
92 lines (66 loc) · 2.76 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
85
86
87
88
89
90
91
92
########################################################################################################################
## VARIABLES
########################################################################################################################
# Project Configurations
LINEAR_SMC_VERSION = 2.2.3
LINEAR_SMC_PATH_FILE = 3rd-parties/linear-smc-$(LINEAR_SMC_VERSION).patch
# Output directories
TEST_COVERAGE_BUILDDIR ?= build/dist-coverage
DOCS_BUILDDIR ?= build/dist-docs
# Build options
BUILD_OPTIONS ?=
# Test options
TEST_SHOW_DETAILS_MODE ?= direct # alternatively: always | failure | never
TEST_PROP_NUM_RUNS ?= 1000
TEST_OPTIONS ?= \
--test-show-details=$(TEST_SHOW_DETAILS_MODE) \
--test-options="--maximum-generated-tests=$(TEST_PROP_NUM_RUNS)"
# Cabal flavors
CABAL ?= cabal
CABAL_BUILD = $(CABAL)
CABAL_TEST = $(CABAL)
CABAL_COVERAGE = $(CABAL) --builddir=$(TEST_COVERAGE_BUILDDIR)
CABAL_DOCS = $(CABAL) --builddir=$(DOCS_BUILDDIR)
# Misc
DEV_TARGETS = test-all-modules build-all-modules test-yol-suite
########################################################################################################################
# TARGETS
########################################################################################################################
all: lint build test
gen-patch-linear-smc:
diff -ur -p2 3rd-parties/linear-smc-"$(LINEAR_SMC_VERSION)" 3rd-parties/linear-smc | tee "$(LINEAR_SMC_PATH_FILE)"
# delete the patch if empty
[[ -s "$(LINEAR_SMC_PATH_FILE)" ]] & rm -f "$(LINEAR_SMC_PATH_FILE)"
lint:
hlint --ignore-glob=hs-pkgs/yol-suite/templates/*.hs hs-pkgs/
build: build-all-modules build-docs
build-all-modules:
$(CABAL_BUILD) build all $(BUILD_OPTIONS)
build-docs:
$(CABAL_DOCS) haddock yul-dsl yul-dsl-linear-smc
build-docs-and-display: build-docs
xdg-open $(DOCS_BUILDDIR)/build/*/*/yul-dsl-*/doc/html/yul-dsl/index.html
xdg-open $(DOCS_BUILDDIR)/build/*/*/yul-dsl-linear-smc-*/doc/html/yul-dsl-linear-smc/index.html
clean:
rm -rf build cache out dist-*
test: test-all-modules test-yol-suite test-demo
test-all-modules: test-eth-abi test-yul-dsl test-yul-dsl-linear-smc
test-eth-abi:
$(CABAL_TEST) test eth-abi $(TEST_OPTIONS)
test-yul-dsl:
$(CABAL_TEST) test yul-dsl $(TEST_OPTIONS)
test-yul-dsl-linear-smc:
$(CABAL_TEST) test yul-dsl-linear-smc $(TEST_OPTIONS)
test-yol-suite:
yolc -m yul hs-pkgs/yol-suite/testsuite
cd hs-pkgs/yol-suite/testsuite && forge test -vvv
test-demo: test-demo-show test-demo-yul
test-demo-show:
yolc -m show examples/demo:ERC20
yolc -m show examples/demo:Basic
test-demo-yul:
yolc -m yul examples/demo
cd examples/demo && forge test -vvv
dev:
nodemon -w hs-pkgs -w yol-demo -w examples -e "hs sol cabal" -x "make $(DEV_TARGETS) || exit 1"
.PHONY: all gen-* build-* lint clean test test-* dev