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