swissChili | 2b5acc8 | 2021-03-13 17:06:42 -0800 | [diff] [blame] | 1 | init(kernel, kernel.elf) |
| 2 | |
| 3 | preset(freestanding) |
| 4 | preset(optimize) |
| 5 | preset(debug) |
| 6 | preset(32) |
| 7 | preset(warn) |
| 8 | preset(nasm) |
| 9 | |
| 10 | archetype(c) |
| 11 | archetype(asm) |
| 12 | |
| 13 | depends(initrd, $(ROOT)/boot/initrd, initrd.img) |
swissChili | 1a3f07f | 2021-04-05 20:01:55 -0700 | [diff] [blame] | 14 | depends(ata_pio, dri/ata_pio, ata_pio.a) |
swissChili | e849174 | 2021-04-08 20:38:06 -0700 | [diff] [blame] | 15 | depends(pci, dri/pci, pci.a) |
swissChili | 5fe85a1 | 2021-05-31 08:10:27 -0700 | [diff] [blame^] | 16 | depends(ide, dri/ide, ide.a) |
swissChili | e849174 | 2021-04-08 20:38:06 -0700 | [diff] [blame] | 17 | # AHCI not yet implemented |
| 18 | # depends(ahci, dri/ahci, ahci.a) |
swissChili | 1a3f07f | 2021-04-05 20:01:55 -0700 | [diff] [blame] | 19 | |
swissChili | 402a383 | 2021-05-29 21:41:31 -0700 | [diff] [blame] | 20 | TEST ?= |
| 21 | test_defines = $(TEST:%=-DTEST_%) |
| 22 | |
| 23 | CFLAGS += -I $(ROOT)/include/kernel $(test_defines) |
swissChili | 2b5acc8 | 2021-03-13 17:06:42 -0800 | [diff] [blame] | 24 | |
swissChili | 6422869 | 2021-03-16 08:19:23 -0700 | [diff] [blame] | 25 | LDFLAGS += -Tlink.ld -melf_i386 |
swissChili | 7be3274 | 2021-04-03 21:17:24 -0700 | [diff] [blame] | 26 | ASMFLAGS += -felf -Fdwarf |
swissChili | 2b5acc8 | 2021-03-13 17:06:42 -0800 | [diff] [blame] | 27 | QEMUFLAGS = -d cpu_reset |
| 28 | |
| 29 | OBJECTS = boot.o \ |
| 30 | main.o \ |
| 31 | descriptor_tables.o \ |
| 32 | io.o \ |
| 33 | vga.o \ |
| 34 | gdt_flush.o \ |
| 35 | idt.o \ |
| 36 | log.o \ |
| 37 | irq.o \ |
| 38 | pic.o \ |
| 39 | timer.o \ |
| 40 | paging.o \ |
| 41 | switch_table.o \ |
| 42 | scan_codes.o \ |
| 43 | kheap.o \ |
| 44 | alloc.o \ |
| 45 | vfs.o \ |
| 46 | multiboot.o \ |
swissChili | 6422869 | 2021-03-16 08:19:23 -0700 | [diff] [blame] | 47 | vfs_initrd.o \ |
swissChili | e20b79b | 2021-03-17 21:20:13 -0700 | [diff] [blame] | 48 | syscall.o \ |
swissChili | cfd3c3c | 2021-04-03 15:04:24 -0700 | [diff] [blame] | 49 | task.o \ |
swissChili | 1a3f07f | 2021-04-05 20:01:55 -0700 | [diff] [blame] | 50 | task_api.o \ |
swissChili | aed6ff3 | 2021-05-29 17:51:04 -0700 | [diff] [blame] | 51 | faults.o \ |
swissChili | e849174 | 2021-04-08 20:38:06 -0700 | [diff] [blame] | 52 | lib(ata_pio) \ |
swissChili | 5fe85a1 | 2021-05-31 08:10:27 -0700 | [diff] [blame^] | 53 | lib(pci) \ |
| 54 | lib(ide) |
swissChili | 2b5acc8 | 2021-03-13 17:06:42 -0800 | [diff] [blame] | 55 | |
| 56 | type(custom_link) |
| 57 | |
swissChili | cfd3c3c | 2021-04-03 15:04:24 -0700 | [diff] [blame] | 58 | debug-wait: kernel.elf |
| 59 | qemu-system-i386 -s -S -kernel kernel.elf |
| 60 | |
swissChili | 2b5acc8 | 2021-03-13 17:06:42 -0800 | [diff] [blame] | 61 | debug: kernel.elf |
| 62 | qemu-system-i386 -s -S -kernel kernel.elf & |
| 63 | @echo run "target remote localhost:1234" to connect to qemu |
swissChili | cfd3c3c | 2021-04-03 15:04:24 -0700 | [diff] [blame] | 64 | gdb $< |
swissChili | 2b5acc8 | 2021-03-13 17:06:42 -0800 | [diff] [blame] | 65 | @pkill qemu-system-i38 |
| 66 | |
| 67 | qemu: kernel.elf |
| 68 | qemu-system-i386 $(QEMUFLAGS) -monitor stdio -kernel kernel.elf -no-reboot |
| 69 | |
| 70 | qemu-iso: install |
| 71 | qemu-system-i386 $(QEMUFLAGS) -monitor stdio $(ROOT)/bin/bluejay.iso |
| 72 | |
| 73 | scan_codes.c: gen_scan_codes.py scan_codes.tsv |
| 74 | python3 $< > $@ |
| 75 | |
| 76 | install: kernel.elf lib(initrd) |
| 77 | cp kernel.elf $(ROOT)/boot/ |
| 78 | rm -f $(ROOT)/bin/bluejay.iso |
| 79 | grub-mkrescue -o $(ROOT)/bin/bluejay.iso $(ROOT) |
| 80 | |
| 81 | finish |