swissChili | 7eef438 | 2021-02-21 19:23:15 -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 | log.o \ |
| 9 | irq.o \ |
| 10 | pic.o \ |
| 11 | timer.o \ |
| 12 | paging.o \ |
| 13 | switch_table.o \ |
| 14 | scan_codes.o |
| 15 | CFLAGS = -nostdlib -nostdinc -fno-builtin -fno-stack-protector -ffreestanding -m32 -O2 -g |
| 16 | LDFLAGS = -Tlink.ld -melf_i386 |
| 17 | ASMFLAGS = -felf |
| 18 | QEMUFLAGS = -d cpu_reset |
| 19 | |
| 20 | JAYROOT = ../../ |
| 21 | |
| 22 | kernel.elf: $(SOURCES) |
| 23 | ld $(LDFLAGS) -o $@ $^ |
| 24 | |
| 25 | clean: |
| 26 | rm -f *.o *.bin *.elf $(JAYROOT)/bin/*.iso |
| 27 | |
| 28 | debug: kernel.elf |
| 29 | qemu-system-i386 -s -S -kernel kernel.elf & |
| 30 | @echo run "target remote localhost:1234" to connect to qemu |
| 31 | gdb |
| 32 | @pkill qemu-system-i38 |
| 33 | |
| 34 | qemu: kernel.elf |
| 35 | qemu-system-i386 $(QEMUFLAGS) -monitor stdio -kernel kernel.elf -no-reboot |
| 36 | |
| 37 | qemu-iso: install |
| 38 | qemu-system-i386 $(QEMUFLAGS) -monitor stdio $(JAYROOT)/bin/bluejay.iso |
| 39 | |
| 40 | scan_codes.c: gen_scan_codes.py scan_codes.tsv |
| 41 | python3 $< > $@ |
| 42 | |
| 43 | .s.o: |
| 44 | nasm $(ASMFLAGS) $< |
| 45 | |
| 46 | install: kernel.elf |
swissChili | d3a652e | 2021-02-21 22:16:06 -0800 | [diff] [blame^] | 47 | cp kernel.elf $(JAYROOT)/boot/ |
swissChili | 7eef438 | 2021-02-21 19:23:15 -0800 | [diff] [blame] | 48 | rm -f $(JAYROOT)/bin/bluejay.iso |
swissChili | d3a652e | 2021-02-21 22:16:06 -0800 | [diff] [blame^] | 49 | grub-mkrescue -o $(JAYROOT)/bin/bluejay.iso $(JAYROOT) |
swissChili | 7eef438 | 2021-02-21 19:23:15 -0800 | [diff] [blame] | 50 | |
| 51 | .PHONY: install qemu clean qemu-iso debug |