This repository was archived by the owner on Mar 23, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile
More file actions
130 lines (96 loc) · 3.51 KB
/
Makefile
File metadata and controls
130 lines (96 loc) · 3.51 KB
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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
# Settings
# --------
DEPS_DIR := deps
KWASM_SUBMODULE := $(DEPS_DIR)/wasm-semantics
eei_submodule := $(DEPS_DIR)/eei-semantics
k_submodule := $(KWASM_SUBMODULE)/deps/k
ifneq (,$(wildcard $(k_submodule)/k-distribution/target/release/k/bin/*))
K_RELEASE ?= $(abspath $(k_submodule)/k-distribution/target/release/k)
else
K_RELEASE ?= $(dir $(shell which kompile))..
endif
K_BIN := $(K_RELEASE)/bin
K_LIB := $(K_RELEASE)/lib/kframework
export K_RELEASE
PATH:=$(K_BIN):$(abspath $(KWASM_SUBMODULE)):$(PATH)
export PATH
build_dir := .build
DEFN_DIR := $(build_dir)/defn
kompiled_dir_name := ewasm-test
KWASM_MAKE := make --directory $(KWASM_SUBMODULE) BUILD_DIR=../../$(BUILD_DIR) RELEASE=$(RELEASE)
.PHONY: all clean \
deps defn build \
test test-execution test-simple test-prove \
media presentations reports
all: build
clean:
rm -rf $(build_dir)
rm -f $(KWASM_SUBMODULE)/make.timestamp
rm -f $(KWASM_SUBMODULE)/make.timestamp
rm -f $(eei_submodule)/make.timestamp
git submodule update --init --recursive
$(MAKE) clean -C $(KWASM_SUBMODULE)
$(MAKE) clean -C $(eei_submodule)
# Build Dependencies (K Submodule)
# --------------------------------
EEI_FILES:=eei.md
EEI_SOURCE_FILES:=$(patsubst %, $(eei_submodule)/%, $(EEI_FILES))
EWASM_FILES:=ewasm-test.md driver.md ewasm.md kewasm-lemmas.md
EWASM_SOURCE_FILES:=$(EWASM_FILES)
deps:
$(KWASM_MAKE) deps
# Building Definition
# -------------------
MAIN_MODULE=EWASM-TEST
MAIN_SYNTAX_MODULE=EWASM-TEST-SYNTAX
MAIN_DEFN_FILE=ewasm-test
# Build definitions
KOMPILE_OPTS :=
build: build-llvm build-haskell
build-%:
cp $(EEI_SOURCE_FILES) $(EWASM_SOURCE_FILES) $(KWASM_SUBMODULE)
$(KWASM_MAKE) build-$* \
DEFN_DIR=../../$(DEFN_DIR) \
llvm_main_module=$(MAIN_MODULE) \
llvm_syntax_module=$(MAIN_SYNTAX_MODULE) \
llvm_main_file=$(MAIN_DEFN_FILE) \
haskell_main_module=$(MAIN_MODULE) \
haskell_syntax_module=$(MAIN_SYNTAX_MODULE) \
haskell_main_file=$(MAIN_DEFN_FILE) \
EXTRA_SOURCE_FILES="$(EEI_FILES) $(EWASM_FILES)" \
KOMPILE_OPTS="$(KOMPILE_OPTS)"
# Testing
# -------
TEST_CONCRETE_BACKEND:=llvm
TEST_SYMBOLIC_BACKEND:=haskell
TEST:=./kewasm
KPROVE_MODULE:=KEWASM-LEMMAS
KPROVE_OPTS:=
CHECK:=git --no-pager diff --no-index --ignore-all-space
tests/%/make.timestamp:
@echo "== submodule: $@"
git submodule update --init -- tests/$*
touch $@
test: test-execution test-prove
# Generic Test Harnesses
tests/%.debug: tests/%
$(TEST) run --backend llvm $< --debugger
tests/%.run: tests/%
$(TEST) run --backend $(TEST_CONCRETE_BACKEND) $< > tests/$*.$(TEST_CONCRETE_BACKEND)-out
$(CHECK) tests/success-$(TEST_CONCRETE_BACKEND).out tests/$*.$(TEST_CONCRETE_BACKEND)-out
rm -rf tests/$*.$(TEST_CONCRETE_BACKEND)-out
tests/%.parse: tests/%
$(TEST) kast --backend $(TEST_CONCRETE_BACKEND) $< kast > $@-out
$(CHECK) $@-expected $@-out
rm -rf $@-out
tests/%.prove: tests/%
$(TEST) prove --backend $(TEST_SYMBOLIC_BACKEND) $(filter --repl, $(KPROVE_OPTS)) $< --format-failures --def-module $(KPROVE_MODULE) $(filter-out --repl, $(KPROVE_OPTS))
### Execution Tests
test-execution: test-simple
simple_tests:=$(wildcard tests/simple/*.wast)
test-simple: $(simple_tests:=.run)
### Proof Tests
proof_tests:=$(wildcard tests/proofs/*-spec.k)
slow_proof_tests:=tests/proofs/loops-spec.k
quick_proof_tests:=$(filter-out $(slow_proof_tests), $(proof_tests))
test-prove: $(proof_tests:=.prove)