blob: 60a95ab319d7cad4308575b5df5c0693520df320 [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
swissChilif46600c2021-03-03 12:35:33 -080051$(JAYROOT)/boot/initrd.img:
52 $(MAKE) -C $(JAYROOT)/boot/initrd initrd.img
53 cp $(JAYROOT)/boot/initrd/initrd.img $(JAYROOT)/boot/
54
55install: kernel.elf $(JAYROOT)/boot/initrd.img
swissChilid3a652e2021-02-21 22:16:06 -080056 cp kernel.elf $(JAYROOT)/boot/
swissChili7eef4382021-02-21 19:23:15 -080057 rm -f $(JAYROOT)/bin/bluejay.iso
swissChilid3a652e2021-02-21 22:16:06 -080058 grub-mkrescue -o $(JAYROOT)/bin/bluejay.iso $(JAYROOT)
swissChili7eef4382021-02-21 19:23:15 -080059
swissChilif46600c2021-03-03 12:35:33 -080060.PHONY: install qemu clean qemu-iso debug $(JAYROOT)/boot/initrd.img