-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
63 lines (44 loc) · 1.65 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
.PHONY: test build test-all dios-egraphs
.PRECIOUS: %-out/res.rkt
MK_DIR := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
# Default vector width of 4
VEC_WIDTH := 4
# By default, run one jobs
MAKEFLAGS += --jobs=1
RACKET_SRC := $(MK_DIR)/src/*.rkt $(MK_DIR)/src/examples/*.rkt $(MK_DIR)/src/backend/*.rkt
CARGO_FLAGS := --release
EGG_FLAGS := --no-ac
ifeq ($(VEC_WIDTH),2)
EGG_BUILD_FLAGS := --features vec_width_2
else ifeq ($(VEC_WIDTH),8)
EGG_BUILD_FLAGS := --features vec_width_8
else ifneq ($(VEC_WIDTH),4)
$(error Bad vector width, currently 2, 4, or 8 supported)
endif
build: dios dios-example-gen dios-egraphs
test: test-racket test-rust test-cdios
test-racket: build
raco test --drdr $(MK_DIR)/src/*.rkt $(MK_DIR)/src/backend/*.rkt
test-rust:
cargo test --manifest-path $(MK_DIR)/src/dios-egraphs/Cargo.toml
test-cdios:
cd $(MK_DIR)
runt
test-all: test-racket test-rust
dios-egraphs:
cargo build --manifest-path $(MK_DIR)/src/dios-egraphs/Cargo.toml
dios: $(RACKET_SRC)
raco exe -o $(MK_DIR)/dios $(MK_DIR)/src/main.rkt
dios-example-gen: $(RACKET_SRC)
raco exe -o $(MK_DIR)/dios-example-gen $(MK_DIR)/src/example-gen.rkt
clean:
rm -rf $(MK_DIR)/dios $(MK_DIR)/dios-example-gen $(MK_DIR)/__pycache__ $(MK_DIR)/src/compiled $(MK_DIR)/src/*~ build *-out/
# Build spec
%-out: %-params
$(MK_DIR)/dios-example-gen -w $(VEC_WIDTH) -b $* -p $< -o $@
# Run egg rewriter
%-out/res.rkt: %-out
cargo run $(CARGO_FLAGS) --manifest-path $(MK_DIR)/src/dios-egraphs/Cargo.toml $(EGG_BUILD_FLAGS) -- $</spec.rkt $(EGG_FLAGS) > $@
# Backend code gen
%-egg: %-out/res.rkt
$(MK_DIR)/dios $(BACKEND_FLAGS) -w $(VEC_WIDTH) -e -o $*-out/kernel.c $*-out