forked from cyrus-lang/Cyrus
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
executable file
·49 lines (36 loc) · 1.06 KB
/
Makefile
File metadata and controls
executable file
·49 lines (36 loc) · 1.06 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
.DEFAULT_GOAL := run
JOBS ?= 24
PROFILE ?= debug
INPUT ?= ./tmp/main.cyrus
STDLIB ?= ./stdlib
LLVM_OUT ?= ./tmp/llvmir
ARGS ?=
TARGET_DIR = ./target/$(PROFILE)
COMPILER = $(TARGET_DIR)/cyrus
ifeq ($(PROFILE),release)
CARGO_PROFILE_FLAG = --release
else
CARGO_PROFILE_FLAG =
endif
CARGO_RUN = cargo run -j$(JOBS) $(CARGO_PROFILE_FLAG)
CARGO_BUILD = cargo build -j$(JOBS) $(CARGO_PROFILE_FLAG)
CARGO_TEST = cargo test -j$(JOBS) $(CARGO_PROFILE_FLAG)
COMMON_FLAGS = --disable-warnings $(ARGS)
.PHONY: run build test testsuite \
cir sema resolver parser emit-llvm
cir sema resolver parser:
$(CARGO_RUN) -p cyrusc_$@ -- $(INPUT) $(COMMON_FLAGS) --stdlib=$(STDLIB)
emit-llvm:
$(CARGO_RUN) -- emit-llvm $(INPUT) -o $(LLVM_OUT) --stdlib=$(STDLIB) $(ARGS)
run:
$(CARGO_RUN) -- run $(INPUT) --stdlib=$(STDLIB) $(COMMON_FLAGS)
build:
$(CARGO_BUILD) $(ARGS)
test: build testsuite
$(CARGO_TEST) --all $(ARGS)
testsuite:
python3 ./tests/test_suite.py \
-d tests \
--output ./tmp/tests \
--compiler $(COMPILER) \
--flags "--stdlib=$(STDLIB) --quiet"