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