-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
55 lines (39 loc) · 1.3 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
COMPONENTS = kernel nal
COMPONENTSCLEAN = $(addsuffix .clean,$(COMPONENTS))
ISO_ROOT = iso
KERNEL_ELF = kernel/build/nal.elf
OUT = nal.iso
LIMINE_BINS=$(ISO_ROOT)/limine-bios.sys $(ISO_ROOT)/limine-bios-cd.bin $(ISO_ROOT)/limine-uefi-cd.bin $(ISO_ROOT)/EFI/BOOT/BOOTX64.EFI $(ISO_ROOT)/EFI/BOOT/BOOTIA32.EFI
LIMINE_CFG=limine.cfg
QEMUFLAGS = -serial stdio
NAL_DIR = $(CURDIR)
export NAL_DIR
ifndef LIMINE_DIR
LIMINE_DIR = /usr/share/limine
endif
ifdef DEBUG
QEMUFLAGS += -d cpu_reset
endif
.PHONY: all run clean iso-clean $(COMPONENTS) $(COMPONENTSCLEAN)
all: $(OUT)
$(OUT): $(COMPONENTS) $(ISO_ROOT)/$(LIMINE_CFG) $(LIMINE_BINS)
@cp $(KERNEL_ELF) iso/
xorriso -as mkisofs -b limine-bios-cd.bin -no-emul-boot -boot-load-size 4 -boot-info-table --efi-boot limine-uefi-cd.bin -efi-boot-part --efi-boot-image --protective-msdos-label $(ISO_ROOT) -o $(OUT)
$(COMPONENTS):
$(MAKE) -C $@
$(ISO_ROOT)/$(LIMINE_CFG): $(LIMINE_CFG)
@mkdir -p $(ISO_ROOT)
cp $< $@
$(ISO_ROOT)/%: $(LIMINE_DIR)/%
@mkdir -p $(ISO_ROOT)
cp $< $@
$(ISO_ROOT)/EFI/BOOT/%: $(LIMINE_DIR)/%
@mkdir -p $(ISO_ROOT)/EFI/BOOT
cp $< $@
run: $(OUT)
qemu-system-x86_64 $(QEMUFLAGS) -drive format=raw,media=cdrom,file=$(OUT)
clean: $(COMPONENTSCLEAN) iso-clean
iso-clean:
rm -rf $(ISO_ROOT) $(OUT)
$(COMPONENTSCLEAN): %.clean:
$(MAKE) -C $* clean