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