-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
executable file
·73 lines (64 loc) · 2.32 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
64
65
66
67
68
69
70
71
72
73
MODE ?= release
OVMF := OVMF.fd
ESP := esp
BUILD_ARGS := -Z build-std=core,alloc,compiler_builtins -Zbuild-std-features=compiler-builtins-mem
QEMU_ARGS ?=
ifeq (${MODE}, release)
BUILD_ARGS += --release
endif
.PHONY: build run header asm doc .FORCE \
target/x86_64-unknown-uefi/$(MODE)/boot.efi \
target/x86_64-unknown-none/$(MODE)/kernel \
target/x86_64-unknown-xos/$(MODE)/sampleio \
target/x86_64-unknown-xos/$(MODE)/plota \
target/x86_64-unknown-xos/$(MODE)/plotb \
target/x86_64-unknown-xos/$(MODE)/plotc \
target/x86_64-unknown-xos/$(MODE)/diskread \
build: $(ESP)
$(ESP): $(ESP)/EFI/BOOT/BOOTX64.EFI $(ESP)/KERNEL.ELF $(ESP)/EFI/BOOT/rboot.conf \
$(ESP)/sampleio $(ESP)/plota $(ESP)/plotb $(ESP)/plotc $(ESP)/diskread \
$(ESP)/EFI/BOOT/BOOTX64.EFI: target/x86_64-unknown-uefi/$(MODE)/boot.efi
@mkdir -p $(@D)
cp $< $@
$(ESP)/EFI/BOOT/rboot.conf: rboot.conf
@mkdir -p $(@D)
cp $< $@
$(ESP)/KERNEL.ELF: target/x86_64-unknown-none/$(MODE)/kernel
@mkdir -p $(@D)
cp $< $@
$(ESP)/sampleio: target/x86_64-unknown-xos/$(MODE)/sampleio
@mkdir -p $(@D)
cp $< $@
$(ESP)/plota: target/x86_64-unknown-xos/$(MODE)/plota
@mkdir -p $(@D)
cp $< $@
$(ESP)/plotb: target/x86_64-unknown-xos/$(MODE)/plotb
@mkdir -p $(@D)
cp $< $@
$(ESP)/plotc: target/x86_64-unknown-xos/$(MODE)/plotc
@mkdir -p $(@D)
cp $< $@
$(ESP)/diskread: target/x86_64-unknown-xos/$(MODE)/diskread
@mkdir -p $(@D)
cp $< $@
target/x86_64-unknown-uefi/$(MODE)/boot.efi: boot
cargo build -p $< --target x86_64-unknown-uefi $(BUILD_ARGS)
target/x86_64-unknown-none/$(MODE)/kernel: kernel
cargo build -p $< --target x86_64-unknown-none.json $(BUILD_ARGS)
target/x86_64-unknown-xos/$(MODE)/sampleio: sampleio
cargo build -p $< --target x86_64-unknown-xos.json $(BUILD_ARGS)
target/x86_64-unknown-xos/$(MODE)/plota: plota
cargo build -p $< --target x86_64-unknown-xos.json $(BUILD_ARGS)
target/x86_64-unknown-xos/$(MODE)/plotb: plotb
cargo build -p $< --target x86_64-unknown-xos.json $(BUILD_ARGS)
target/x86_64-unknown-xos/$(MODE)/plotc: plotc
cargo build -p $< --target x86_64-unknown-xos.json $(BUILD_ARGS)
target/x86_64-unknown-xos/$(MODE)/diskread: diskread
cargo build -p $< --target x86_64-unknown-xos.json $(BUILD_ARGS)
qemu: build
qemu-system-x86_64 -bios ${OVMF} \
-drive format=raw,file=fat:rw:$(ESP) \
-net none \
$(QEMU_ARGS)
test:
cargo test -p fatpart