blob: 9029f26dbde04872f72e7a675bf4f73e338a3ad8 [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 \
swissChili9752ab32021-03-05 11:20:13 -080017 vfs.o \
swissChili6c0519e2021-03-07 19:40:23 -080018 multiboot.o \
19 vfs_initrd.o
swissChili8efa4922021-03-02 16:34:49 -080020
21JAYROOT = ../../
swissChilidc25b2b2021-02-23 17:07:13 -080022CFLAGS = -nostdlib -nostdinc -fno-builtin -fno-stack-protector -ffreestanding \
swissChili8efa4922021-03-02 16:34:49 -080023 -m32 -O2 -g -Wall -Wno-unused-function -Wno-unused-variable \
24 -I$(JAYROOT)/include
swissChili7eef4382021-02-21 19:23:15 -080025LDFLAGS = -Tlink.ld -melf_i386
26ASMFLAGS = -felf
27QEMUFLAGS = -d cpu_reset
28
swissChili7eef4382021-02-21 19:23:15 -080029kernel.elf: $(SOURCES)
30 ld $(LDFLAGS) -o $@ $^
31
32clean:
33 rm -f *.o *.bin *.elf $(JAYROOT)/bin/*.iso
34
35debug: kernel.elf
36 qemu-system-i386 -s -S -kernel kernel.elf &
37 @echo run "target remote localhost:1234" to connect to qemu
38 gdb
39 @pkill qemu-system-i38
40
41qemu: kernel.elf
42 qemu-system-i386 $(QEMUFLAGS) -monitor stdio -kernel kernel.elf -no-reboot
43
44qemu-iso: install
45 qemu-system-i386 $(QEMUFLAGS) -monitor stdio $(JAYROOT)/bin/bluejay.iso
46
47scan_codes.c: gen_scan_codes.py scan_codes.tsv
48 python3 $< > $@
49
50.s.o:
51 nasm $(ASMFLAGS) $<
52
swissChilif46600c2021-03-03 12:35:33 -080053$(JAYROOT)/boot/initrd.img:
54 $(MAKE) -C $(JAYROOT)/boot/initrd initrd.img
55 cp $(JAYROOT)/boot/initrd/initrd.img $(JAYROOT)/boot/
56
57install: kernel.elf $(JAYROOT)/boot/initrd.img
swissChilid3a652e2021-02-21 22:16:06 -080058 cp kernel.elf $(JAYROOT)/boot/
swissChili7eef4382021-02-21 19:23:15 -080059 rm -f $(JAYROOT)/bin/bluejay.iso
swissChilid3a652e2021-02-21 22:16:06 -080060 grub-mkrescue -o $(JAYROOT)/bin/bluejay.iso $(JAYROOT)
swissChili7eef4382021-02-21 19:23:15 -080061
swissChilif46600c2021-03-03 12:35:33 -080062.PHONY: install qemu clean qemu-iso debug $(JAYROOT)/boot/initrd.img