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