-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
48 lines (35 loc) · 993 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
include config.mk
ifeq ($(BUILD_TYPE),release)
RUST_COMPILER_FLAGS += --release
endif
export RUST_TARGET_PATH=$(PWD)/targets
TARGET_FILES := $(TARGET_DIR)/conf/mkinitramfs $(TARGET_DIR)/boot/initramfs
BUILD_DIRS := $(TARGET_DIR)
INITRAMFS_FILES :=
FMT_DIRS := std
.PHONY: all
all: target_files
include std/module.mk
include $(patsubst %,%/module.mk,$(MODULES))
.PHONY: target_files
target_files: $(TARGET_FILES)
.PHONY: clean
clean:
rm -rf $(BUILD_DIRS)
.PHONY: run
run: $(ISO)
qemu-system-x86_64 -cdrom $(ISO) $(QEMU_FLAGS) -enable-kvm
.PHONY: run_debug
run_debug: $(ISO)
qemu-system-x86_64 -cdrom $(ISO) $(QEMU_FLAGS) -d int -S
.PHONY: gdb
gdb:
gdb $(KERNEL_BINARY) -ex "target remote :1234"
.PHONY: fmt
fmt:
$(foreach fmt_dir,$(FMT_DIRS),cd $(fmt_dir) && cargo +nightly fmt && cd - >/dev/null &&) true
$(ISO): all
grub-mkrescue -o $(ISO) $(TARGET_DIR) 2>/dev/null
$(TARGET_DIR)/conf/mkinitramfs:
@mkdir -p $(shell dirname $@)
echo $(INITRAMFS_FILES) | tr " " "\n" > $@