summaryrefslogtreecommitdiffstats
path: root/Makefile
blob: ead8c205f1c2d2a0a23c6eb6e9e4a7b83640b1e4 (plain) (blame)
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
95
96
97
# Thin wrapper over scripts/ — all real logic lives in scripts/*.sh, with
# shared config and helpers in scripts/lib.sh.  `make help` lists targets.
#
# NOTE: $(VAR) in this file is MAKE syntax, not shell substitution.

SYSTEM_IMG ?= /tmp/system.img

.PHONY: all build run run-headless debug system system-fresh inspect \
	test test-disk test-fault test-gfx test-mouse test-msg test-usb fmt clean help

# ---- build ----------------------------------------------------------------

all: build

build:
	./scripts/build.sh

# ---- boot -----------------------------------------------------------------

# Build + stage the image + boot QEMU (window + serial on stdio).
run:
	./scripts/run.sh

# Serial console only, no window.
run-headless:
	./scripts/run.sh --headless

# GDB stub on :1234, CPU paused (attach: gdb -x scripts/debug-kernel.py).
debug:
	./scripts/run.sh --debug

# ---- system image ---------------------------------------------------------

# Stage the image if it is stale (runtime files survive).
system:
	./scripts/mksystem.sh

# Re-create the image from scratch (wipes runtime data).
system-fresh:
	./scripts/mksystem.sh --force

# List the image contents (needs mtools: sudo apt install mtools).
inspect:
	@mdir -i "$(SYSTEM_IMG)" ::

# ---- tests ----------------------------------------------------------------

test: test-disk test-gfx test-mouse test-msg test-fault test-usb

test-disk:
	./scripts/tests/test-disk.sh

test-fault:
	./scripts/tests/test-fault.sh

test-gfx:
	./scripts/tests/test-gfx.sh

test-mouse:
	./scripts/tests/test-mouse.sh

test-msg:
	./scripts/tests/test-msg.sh

test-usb:
	./scripts/tests/test-usb.sh

# ---- utilities ------------------------------------------------------------

fmt:
	cargo fmt

clean:
	cargo clean

help:
	@echo "raisernics — make targets"
	@echo ""
	@echo "  make                build kernel + /bin binaries (release)"
	@echo "  make run            build + stage image + boot QEMU (window)"
	@echo "  make run-headless   same, serial console only"
	@echo "  make debug          same, GDB stub on :1234 (CPU paused)"
	@echo "  make system         stage the system image if stale"
	@echo "  make system-fresh   re-create the system image (wipes data)"
	@echo "  make inspect        list image contents (mtools)"
	@echo "  make test           run every automated test"
	@echo "  make test-disk      disk round trip (build -> boot -> fsck)"
	@echo "  make test-gfx       graphics self-test"
	@echo "  make test-mouse     PS/2 mouse + cursor tracking"
	@echo "  make test-msg       scheduler message queues"
	@echo "  make test-fault     fault dump (screen + serial)"
	@echo "  make test-usb       USB HID enumeration (EHCI + xHCI)"
	@echo "  make fmt            format Rust source"
	@echo "  make clean          remove build artifacts"
	@echo ""
	@echo "Two-command flow: ./scripts/build.sh && ./scripts/run.sh"
	@echo "Scripts: build.sh  run.sh  mksystem.sh  lib.sh  tests/"