blob: 16c5628d94846083f92938eaf0ce24b4cc81a98d [file] [log] [blame]
swissChili7eef4382021-02-21 19:23:15 -08001SOURCES = 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 \
14 scan_codes.o
15CFLAGS = -nostdlib -nostdinc -fno-builtin -fno-stack-protector -ffreestanding -m32 -O2 -g
16LDFLAGS = -Tlink.ld -melf_i386
17ASMFLAGS = -felf
18QEMUFLAGS = -d cpu_reset
19
20JAYROOT = ../../
21
22kernel.elf: $(SOURCES)
23 ld $(LDFLAGS) -o $@ $^
24
25clean:
26 rm -f *.o *.bin *.elf $(JAYROOT)/bin/*.iso
27
28debug: kernel.elf
29 qemu-system-i386 -s -S -kernel kernel.elf &
30 @echo run "target remote localhost:1234" to connect to qemu
31 gdb
32 @pkill qemu-system-i38
33
34qemu: kernel.elf
35 qemu-system-i386 $(QEMUFLAGS) -monitor stdio -kernel kernel.elf -no-reboot
36
37qemu-iso: install
38 qemu-system-i386 $(QEMUFLAGS) -monitor stdio $(JAYROOT)/bin/bluejay.iso
39
40scan_codes.c: gen_scan_codes.py scan_codes.tsv
41 python3 $< > $@
42
43.s.o:
44 nasm $(ASMFLAGS) $<
45
46install: kernel.elf
swissChilid3a652e2021-02-21 22:16:06 -080047 cp kernel.elf $(JAYROOT)/boot/
swissChili7eef4382021-02-21 19:23:15 -080048 rm -f $(JAYROOT)/bin/bluejay.iso
swissChilid3a652e2021-02-21 22:16:06 -080049 grub-mkrescue -o $(JAYROOT)/bin/bluejay.iso $(JAYROOT)
swissChili7eef4382021-02-21 19:23:15 -080050
51.PHONY: install qemu clean qemu-iso debug