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