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