-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
53 lines (38 loc) · 1.24 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
# Targets
.PHONY: all mkdirs bootloader bootbase bootsetup kernel emu debug stub
# Stop printing the directories
# MAKEFLAGS += --no-print-directory
SRC_BOOTLOADER := ./bootloader
SRC_KERNEL := ./kernel
BUILD := ./build
all: bootloader kernel
dd if=/dev/zero of=$(BUILD)/main_floppy.img bs=512 count=2880
dd if=$(BUILD)/bootbase.bin of=$(BUILD)/main_floppy.img conv=notrunc
dd if=$(BUILD)/bootsetup.bin of=$(BUILD)/main_floppy.img obs=512 seek=1 conv=notrunc
# Boot loader compile section -------------------
bootloader: bootbase bootsetup
bootbase: $(BUILD)/bootbase.bin
bootsetup: $(BUILD)/bootsetup.bin
$(BUILD)/bootbase.bin: mkdirs
$(MAKE) -C $(SRC_BOOTLOADER)/base
$(BUILD)/bootsetup.bin: mkdirs
$(MAKE) -C $(SRC_BOOTLOADER)/setup
# Kernel compile section ------------------------
kernel: $(BUILD)/kernel.bin
$(BUILD)/kernel.bin: mkdirs
$(MAKE) -C $(SRC_KERNEL) BUILD=$(abspath $(BUILD))
# Compile other programs in ./stub folder -------
stub:
$(MAKE) -C ./stub
# directory gen section
mkdirs:
mkdir -p $(BUILD)
# Clean the $(BUILD) but keep the folder
clean:
rm -r $(BUILD)/*
# Qemu emulation command
emu:
qemu-system-i386 $(BUILD)/main_floppy.img
# Bochs debug command
debug:
bochsdbg