2021-11-29 13:59:34 +00:00
|
|
|
KERNEL = julios
|
|
|
|
ISO = julios.iso
|
|
|
|
INSTALL_ROOT = iso
|
|
|
|
ABS_INSTALL = $(abspath $(INSTALL_ROOT))
|
|
|
|
|
|
|
|
LINKER_SCRIPT = src/linker.ld
|
2021-12-02 07:56:10 +00:00
|
|
|
BOOT_OBJS = src/boot/multiboot.o src/boot/boot.o
|
2021-11-29 13:59:34 +00:00
|
|
|
LIB_JULIOS = target/x86_64-julios/debug/libjulios.a
|
|
|
|
|
|
|
|
GRUB_CFG = grub/grub.cfg
|
|
|
|
|
|
|
|
all: $(ISO)
|
|
|
|
|
2021-11-30 06:05:25 +00:00
|
|
|
run: $(ISO)
|
2021-12-07 18:00:34 +00:00
|
|
|
qemu-system-x86_64 -cdrom $< -serial stdio -m 8G
|
2021-11-30 06:05:25 +00:00
|
|
|
|
|
|
|
debug: $(ISO)
|
|
|
|
bochs -q
|
|
|
|
|
2021-11-29 13:59:34 +00:00
|
|
|
$(ISO): install
|
2021-11-29 16:53:56 +00:00
|
|
|
grub-mkrescue -o $@ $(INSTALL_ROOT)
|
2021-11-29 13:59:34 +00:00
|
|
|
|
|
|
|
install: $(KERNEL) $(GRUB_CFG)
|
|
|
|
mkdir -p $(ABS_INSTALL)
|
|
|
|
mkdir -p $(ABS_INSTALL)/boot/grub
|
|
|
|
cp $(KERNEL) $(ABS_INSTALL)/boot
|
|
|
|
cp grub/grub.cfg $(ABS_INSTALL)/boot/grub
|
|
|
|
|
|
|
|
$(KERNEL): $(LIB_JULIOS) $(LINKER_SCRIPT) $(BOOT_OBJS)
|
|
|
|
ld -n -T $(LINKER_SCRIPT) -o $(KERNEL) $(BOOT_OBJS) $(LIB_JULIOS)
|
|
|
|
|
2021-12-01 08:30:53 +00:00
|
|
|
$(LIB_JULIOS):
|
2021-11-29 13:59:34 +00:00
|
|
|
cargo build
|
|
|
|
|
|
|
|
|
|
|
|
%.o: %.asm
|
|
|
|
nasm -f elf64 $^ -o $@
|
|
|
|
|
|
|
|
clean:
|
|
|
|
$(RM) $(BOOT_OBJS)
|
|
|
|
$(RM) $(KERNEL)
|
|
|
|
$(RM) julios.iso
|
|
|
|
$(RM) -r iso
|
2021-12-05 20:25:13 +00:00
|
|
|
$(RM) -r target
|
2021-11-29 13:59:34 +00:00
|
|
|
|
2021-12-01 08:30:53 +00:00
|
|
|
.PHONY: $(INSTALL_ROOT) install clean all run debug $(LIB_JULIOS)
|