forked from likey99/hvisor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
50 lines (39 loc) · 935 Bytes
/
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
ARCH ?= aarch64
LOG ?=trace
STATS ?= off
PORT ?= 23333
# default release mode
MODE ?= debug
export MODE
export LOG
export ARCH
export STATS
OBJCOPY ?= rust-objcopy --binary-architecture=$(ARCH)
build_path := target/$(ARCH)/$(MODE)
target_elf := $(build_path)/rvmarm
target_bin := $(build_path)/rvmarm.bin
features :=
ifeq ($(STATS), on)
features += --features stats
endif
build_args := --features "$(features)" --target $(ARCH).json -Z build-std=core,alloc -Z build-std-features=compiler-builtins-mem
ifeq ($(MODE), release)
build_args += --release
endif
# .PHONY: qemu-aarch64
# qemu-aarch64:
# cargo clean
# cargo build $(build_args)
.PHONY: all
all: $(target_bin)
.PHONY: elf
elf:
cargo build $(build_args)
.PHONY: scp
scp:
scp -P $(PORT) -r $(target_bin) root@localhost:~/
.PHONY: disa
disa:
rust-objdump --disassemble $(target_elf) > rvm.S
$(target_bin): elf
$(OBJCOPY) $(target_elf) --strip-all -O binary $@