-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathMakefile
64 lines (51 loc) · 1.43 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
AS=../i686-elf-as
CC=../i686-elf-gcc
CFLAGS=-std=gnu99 -ffreestanding -O2 -Wall -Wextra
KERNEL_CC_LIST:=\
kernel/arch/i386/gdt.o \
kernel/arch/i386/idt.o \
kernel/arch/i386/irq.o \
kernel/arch/i386/isr.o \
kernel/display/display.o\
kernel/libc/stdio/stdio.o \
kernel/main.o \
kernel/drivers/serial.o \
kernel/drivers/keyboard.o \
kernel/drivers/timer.o \
kernel/system/binary/conversion.o \
kernel/libc/stdlib/stdlib.o \
kernel/system/init.o \
kernel/system/stderr.o \
kernel/libc/string/string.o \
kernel/system/binary/encryption.o \
kernel/system/memory/kheap.o \
kernel/system/memory/kmemory.o \
kernel/libc/generic/allocator.o \
kernel/libc/generic/types/stack.o \
kernel/libc/generic/types/list.o \
kernel/libc/generic/types/btree.o \
kernel/system/input/stdin.o \
kernel/startup.o \
kernel/modules/cshell/cshell.o \
kernel/modules/login/login.o
KERNEL_AS_LIST:=\
kernel/boot.o
KERNEL_INCLUDE_DIR=kernel/include
all: kernel
.PHONY: kernel
kernel: $(KERNEL_CC_LIST) $(KERNEL_AS_LIST)
$(CC) -T linker/linker.ld -o Marvin.bin -ffreestanding -O2 -nostdlib $^ -lgcc -I$(KERNEL_INCLUDE_DIR)
%.o: %.c
$(CC) $(CFLAGS) -c $< -o $@ -I$(KERNEL_INCLUDE_DIR)
%.o: %.s
$(AS) $< -o $@
run:
qemu-system-i386 -kernel Marvin.bin
.PHONY: iso
iso: kernel
cp Marvin.iso .bin iso/boot/Marvin.bin
grub-mkrescue -o Marvin.iso iso/
run-iso: iso
qemu-system-i386 -cdrom Marvin.iso \
clean:
find -type f \( -name "*.o" -o -name "*.bin" -o -name "*.iso" \) -delete