swissChili | 0b35bf2 | 2021-02-18 12:49:40 -0800 | [diff] [blame^] | 1 | SOURCES = boot.o main.o descriptor_tables.o mem.o vga.o gdt_flush.o idt.o interrupts.o log.o |
swissChili | d813792 | 2021-02-17 15:34:07 -0800 | [diff] [blame] | 2 | CFLAGS = -nostdlib -nostdinc -fno-builtin -fno-stack-protector -ffreestanding -m32 -O2 -g |
| 3 | LDFLAGS = -Tlink.ld -melf_i386 |
| 4 | ASMFLAGS = -felf |
| 5 | |
| 6 | kernel.elf: $(SOURCES) |
| 7 | ld $(LDFLAGS) -o $@ $^ |
| 8 | |
| 9 | clean: |
swissChili | 0b35bf2 | 2021-02-18 12:49:40 -0800 | [diff] [blame^] | 10 | rm -f *.o *.bin *.elf ../bin/*.iso |
swissChili | d813792 | 2021-02-17 15:34:07 -0800 | [diff] [blame] | 11 | |
swissChili | 0b35bf2 | 2021-02-18 12:49:40 -0800 | [diff] [blame^] | 12 | debug: kernel.elf |
| 13 | qemu-system-i386 -s -S -kernel kernel.elf & |
| 14 | @echo run "target remote localhost:1234" to connect to qemu |
| 15 | gdb |
| 16 | @pkill qemu-system-i38 |
| 17 | |
| 18 | qemu: kernel.elf |
| 19 | qemu-system-i386 -monitor stdio -kernel kernel.elf |
| 20 | |
| 21 | qemu-iso: install |
swissChili | d813792 | 2021-02-17 15:34:07 -0800 | [diff] [blame] | 22 | qemu-system-i386 -monitor stdio ../bin/bluejay.iso |
| 23 | |
| 24 | .s.o: |
| 25 | nasm $(ASMFLAGS) $< |
| 26 | |
| 27 | install: kernel.elf |
| 28 | cp kernel.elf ../boot/ |
swissChili | 0b35bf2 | 2021-02-18 12:49:40 -0800 | [diff] [blame^] | 29 | rm -f ../bin/bluejay.iso |
swissChili | d813792 | 2021-02-17 15:34:07 -0800 | [diff] [blame] | 30 | grub-mkrescue -o ../bin/bluejay.iso .. |
| 31 | |
swissChili | 0b35bf2 | 2021-02-18 12:49:40 -0800 | [diff] [blame^] | 32 | .PHONY: install qemu clean qemu-iso debug |