-
-
Notifications
You must be signed in to change notification settings - Fork 50
/
Makefile
94 lines (74 loc) · 2.73 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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
profile ?= release
ifneq ($(filter $(profile), dev debug), )
KERNEL_TARGET := src/target/x86_64-unknown-none/debug/aero_kernel
else
KERNEL_TARGET := src/target/x86_64-unknown-none/release/aero_kernel
endif
jinx:
mkdir -p target
if [ ! -f "target/jinx" ]; then \
curl -Lo target/jinx https://github.com/mintsuki/jinx/raw/353c468765dd9404bacba8e5626d0830528e4300/jinx; \
chmod +x target/jinx; \
fi
# FIXME: autosync
mkdir -p target/cargo-home
cp build-support/rust/config.toml target/cargo-home/config.toml
.PHONY: distro
distro: jinx
./target/jinx build-all
SOURCE_DIR := src
USERLAND_DIR := userland
USERLAND_TARGET := builds/userland/target/init
.PHONY: clean
clean:
rm -rf $(SOURCE_DIR)/target
.PHONY: deep-clean
deep-clean: clean
rm -rf target sysroot sources pkgs host-pkgs host-builds builds
.PHONY: check
check:
cd $(SOURCE_DIR) && cargo check
$(KERNEL_TARGET): $(shell find $(SOURCE_DIR) -type f -not -path '$(SOURCE_DIR)/target/*')
cd $(SOURCE_DIR) && cargo build --package aero_kernel --profile $(profile)
./build-support/mkiso.sh $(KERNEL_TARGET)
$(USERLAND_TARGET): $(shell find $(USERLAND_DIR) -type f -not -path '$(USERLAND_DIR)/target/*')
./target/jinx rebuild userland
@$(MAKE) distro-image
.PHONY: iso
iso: $(KERNEL_TARGET)
.PHONY: distro-image
distro-image: distro
./build-support/mkimage.sh
QEMU_PATH ?= $(shell dirname $(shell which qemu-system-x86_64))
.PHONY: qemu
qemu: $(KERNEL_TARGET) $(USERLAND_TARGET)
${QEMU_PATH}/qemu-system-x86_64 \
-cdrom target/aero.iso \
-m 8G \
-serial stdio \
--boot d -s \
-enable-kvm \
-cpu host,+vmx \
-drive file=target/disk.img,if=none,id=NVME1,format=raw \
-device nvme,drive=NVME1,serial=nvme \
${QEMU_FLAGS}
# "qemu_perf" options:
# delay (default: 30) - the amount of microseconds between each sample.
delay ?= 30
.PHONY: qemu_perf
qemu_perf: $(KERNEL_TARGET) $(USERLAND_TARGET)
${QEMU_PATH}/qemu-system-x86_64 -cdrom target/aero.iso -m 8G -serial stdio --boot d -s -drive file=target/disk.img,if=none,id=NVME1,format=raw -device nvme,drive=NVME1,serial=nvme -plugin './target/kern-profile.so,out=raw-data,delay=$(delay)' -d plugin -cpu max
.PHONY: qemu_p
qemu_p:
${QEMU_PATH}/qemu-system-x86_64 -cdrom target/aero.iso -m 8G -serial stdio --boot d -s -drive file=target/disk.img,if=none,id=NVME1,format=raw -device nvme,drive=NVME1,serial=nvme -d plugin -cpu max -qmp unix:/tmp/qmp.sock,server,nowait
.PHONY: doc
doc:
cd src && cargo doc --package aero_kernel --release --target-dir=../target/doc/
echo "<meta http-equiv='refresh' content='0; URL=./x86_64-unknown-none/doc/aero_kernel/index.html' />" > target/doc/index.html
ifeq ($(open),yes)
xdg-open target/doc/index.html
endif
fmt:
cd $(SOURCE_DIR) && cargo fmt
check_fmt:
cd $(SOURCE_DIR) && cargo fmt -- --check