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