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