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