-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
50 lines (40 loc) · 1.04 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
.PHONY: all
all: llvm x86
CFLAGS=--release
ifeq ($(SILENT),1)
CFLAGS += --message-format short
endif
ifeq ($(ANALYSIS),0)
CFLAGS += --features "no-analysis"
endif
ifeq ($(CODEGEN),0)
CFLAGS += --features "no-codegen"
endif
ifeq ($(MEM2REG),0)
CFLAGS += --features "llvm/no-mem2reg"
endif
ifeq ($(OPTIMIZE),0)
CFLAGS += --features "llvm/no-optimizations"
endif
ifeq ($(REGALLOC),0)
CFLAGS += --features "x86/no-registers-allocation"
endif
.PHONY: llvm
llvm: BINARY_NAME=latc_llvm
llvm:
clang -S -emit-llvm lib/runtime.c -o lib/runtime.ll
llvm-as -o lib/runtime.bc lib/runtime.ll
cargo build $(CFLAGS) --features "emit-llvm"
cp target/release/$(BINARY_NAME) .
cp target/release/latc .
.PHONY: x86
x86: BINARY_NAME=latc_x86_64
x86:
clang -c -O3 lib/runtime.c -o lib/runtime.o
cargo build $(CFLAGS) --features "emit-x86_64"
cp target/release/$(BINARY_NAME) .
cp target/release/latc .
parser:
cargo build --release --message-format short --manifest-path src/parser/generate/Cargo.toml
clean:
rm -rf target/ latc* lib/*.bc lib/*.ll