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