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