-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
89 lines (66 loc) · 2.89 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
.PHONY: build clean test test-clean test-tokens test-staking test-lending test-swap test-erc20 test-erc1155 test-liquid test-lido test-lendingpool test-aave test-regression
SEMANTICS_DIR = src
TEST_DIR = test
EXAMPLES_DIR = $(TEST_DIR)/examples
TRANSACTIONS_DIR = $(TEST_DIR)/transactions
SEMANTICS_FILE_NAME = solidity
SEMANTICS_FILE = $(SEMANTICS_FILE_NAME).md
MAIN_MODULE = SOLIDITY
OUTPUT_DIR = out
UNISWAP_PARAMS = $(EXAMPLES_DIR)/swaps/UniswapV2Swap.sol 2>&1 1>$(OUTPUT_DIR)/uniswap.ast
UNISWAPRN_PARAMS = $(EXAMPLES_DIR)/swaps/UniswapV2SwapRenamed.sol 2>&1 1>$(OUTPUT_DIR)/uniswaprn.ast
SOMETOKEN_PARAMS = $(EXAMPLES_DIR)/tokens/SomeToken.sol 2>&1 1>$(OUTPUT_DIR)/sometoken.ast
SOMEMULTITOKEN_PARAMS = $(EXAMPLES_DIR)/tokens/SomeMultiToken.sol 2>&1 1>$(OUTPUT_DIR)/somemultitoken.ast
LIQUIDSTAKING_PARAMS = $(EXAMPLES_DIR)/staking/LiquidStaking.sol 2>&1 1>$(OUTPUT_DIR)/liquidstaking.ast
LIDO_PARAMS = $(EXAMPLES_DIR)/staking/LidoStaking.sol 2>&1 1>$(OUTPUT_DIR)/lidostaking.ast
LENDINGPOOL_PARAMS = $(EXAMPLES_DIR)/lending/LendingPool.sol 2>&1 1>$(OUTPUT_DIR)/lendingpool.ast
AAVE_PARAMS = $(EXAMPLES_DIR)/lending/AaveLendingPool.sol 2>&1 1>$(OUTPUT_DIR)/aave.ast
REGRESSION_TESTS = $(patsubst %.sol, %.out, $(wildcard $(TEST_DIR)/regression/*.sol))
TRANSACTIONS = $(shell find $(TRANSACTIONS_DIR) -name "*.txn")
EXAMPLE_TESTS = $(patsubst %.txn, %.out, $(TRANSACTIONS))
build: $(SEMANTICS_DIR)/$(SEMANTICS_FILE)
kompile $(SEMANTICS_DIR)/$(SEMANTICS_FILE) --main-module $(MAIN_MODULE) --gen-glr-bison-parser -O2 --heuristic pbaL
clean: test-clean
rm -Rf $(SEMANTICS_FILE_NAME)-kompiled
test-clean:
rm -Rf $(OUTPUT_DIR)
rm -Rf $(TEST_DIR)/regression/*.out
rm -Rf $(EXAMPLE_TESTS)
test: test-swaps test-tokens test-staking test-lending test-regression test-examples
test-swaps: test-swap test-swaprn
test-tokens: test-erc20 test-erc1155
test-staking: test-liquid test-lido
test-lending: test-lendingpool test-aave
test-swap:
mkdir -p $(OUTPUT_DIR)
kparse $(UNISWAP_PARAMS)
test-swaprn:
mkdir -p $(OUTPUT_DIR)
kparse $(UNISWAPRN_PARAMS)
test-erc20:
mkdir -p $(OUTPUT_DIR)
kparse $(SOMETOKEN_PARAMS)
test-erc1155:
mkdir -p $(OUTPUT_DIR)
kparse $(SOMEMULTITOKEN_PARAMS)
test-liquid:
mkdir -p $(OUTPUT_DIR)
kparse $(LIQUIDSTAKING_PARAMS)
test-lido:
mkdir -p $(OUTPUT_DIR)
kparse $(LIDO_PARAMS)
test-lendingpool:
mkdir -p $(OUTPUT_DIR)
kparse $(LENDINGPOOL_PARAMS)
test-aave:
mkdir -p $(OUTPUT_DIR)
kparse $(AAVE_PARAMS)
test-regression: ${REGRESSION_TESTS}
$(REGRESSION_TESTS): %.out: %.sol %.txn %.ref $(SEMANTICS_FILE_NAME)-kompiled/timestamp
ulimit -s 65536 && bin/krun-sol $*.sol $*.txn > $*.out 2>&1
diff -U3 -w $*.ref $*.out
test-examples: ${EXAMPLE_TESTS}
.SECONDEXPANSION:
$(EXAMPLE_TESTS): %.out: $$(subst $(TRANSACTIONS_DIR), $(EXAMPLES_DIR), $$(@D)).sol %.txn %.ref %.smr $(SEMANTICS_FILE_NAME)-kompiled/timestamp
ulimit -s 65536 && bin/krun-sol $< $*.txn $*.smr > $*.out 2>&1
diff -U3 -w $*.ref $*.out