-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
70 lines (55 loc) · 1.63 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
include build_scripts/config.mk
.PHONY: all floppy_image kernel bootloader clean always tools_fat
all: floppy_image tools_fat
include build_scripts/toolchain.mk
#
# Floppy image
#
floppy_image: $(BUILD_DIR)/picopite.img
$(BUILD_DIR)/picopite.img: bootloader kernel
@dd if=/dev/zero of=$@ bs=512 count=2880 >/dev/null
@mkfs.fat -F 12 -n "PIOS" $@ >/dev/null
@dd if=$(BUILD_DIR)/stage1.bin of=$@ conv=notrunc >/dev/null
@mcopy -i $@ $(BUILD_DIR)/stage2.bin "::stage2.bin"
@mcopy -i $@ $(BUILD_DIR)/kernel.bin "::kernel.bin"
@mcopy -i $@ test.txt "::test.txt"
@mmd -i $@ "::mydir"
@mcopy -i $@ test.txt "::mydir/test.txt"
@echo "--> Created: " $@
#
# Bootloader
#
bootloader: stage1 stage2
stage1: $(BUILD_DIR)/stage1.bin
$(BUILD_DIR)/stage1.bin: always
@$(MAKE) -C src/bootloader/stage1 BUILD_DIR=$(abspath $(BUILD_DIR))
stage2: $(BUILD_DIR)/stage2.bin
$(BUILD_DIR)/stage2.bin: always
@$(MAKE) -C src/bootloader/stage2 BUILD_DIR=$(abspath $(BUILD_DIR))
#
# Kernel
#
kernel: $(BUILD_DIR)/kernel.bin
$(BUILD_DIR)/kernel.bin: always
@$(MAKE) -C src/kernel BUILD_DIR=$(abspath $(BUILD_DIR))
#
# Tools
#
tools_fat: $(BUILD_DIR)/tools/fat
$(BUILD_DIR)/tools/fat: always tools/fat/fat.c
@mkdir -p $(BUILD_DIR)/tools
@$(MAKE) -C tools/fat BUILD_DIR=$(abspath $(BUILD_DIR))
#
# Always
#
always:
@mkdir -p $(BUILD_DIR)
#
# Clean
#
clean:
@$(MAKE) -C src/bootloader/stage1 BUILD_DIR=$(abspath $(BUILD_DIR)) clean
@$(MAKE) -C src/bootloader/stage2 BUILD_DIR=$(abspath $(BUILD_DIR)) clean
@$(MAKE) -C src/kernel BUILD_DIR=$(abspath $(BUILD_DIR)) clean
@rm -rf src/kernel/arch/i686/isrs_gen.c src/kernel/arch/i686/isrs_gen.inc
@rm -rf $(BUILD_DIR)/*