blob: 07f985af2b7dabdffe4a9cb3a17682dda1507287 (
plain) (
blame)
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
|
# MIT License, Copyright (c) 2020 Marvin Borner
COBJS = main.o \
drivers/interrupts.o \
drivers/interrupts_asm.o \
drivers/keyboard.o \
drivers/mouse.o \
drivers/ide.o \
drivers/timer.o \
features/fs.o \
features/load.o \
features/proc.o \
features/proc_asm.o \
features/syscall.o \
features/event.o
CC = ../cross/opt/bin/i686-elf-gcc
LD = ../cross/opt/bin/i686-elf-ld
OC = ../cross/opt/bin/i686-elf-objcopy
AS = nasm
# Flags to make the binary smaller TODO: Remove after indirect pointer support!
CSFLAGS = -mpreferred-stack-boundary=2 -fno-asynchronous-unwind-tables -Os
CFLAGS = $(CSFLAGS) -Wall -Wextra -nostdlib -nostdinc -ffreestanding -fno-builtin -mno-red-zone -mgeneral-regs-only -std=c99 -m32 -pedantic-errors -Wl,-ekernel_main -I../libc/inc/ -Iinc/ -Dkernel
ASFLAGS = -f elf32
all: compile bootloader
%.o: %.c
@$(CC) -c $(CFLAGS) $< -o $@
%_asm.o: %.asm
@$(AS) $(ASFLAGS) $< -o $@
bootloader:
@mkdir -p ../build/
@$(AS) -f bin entry.asm -o ../build/boot.bin
compile: $(COBJS)
@mkdir -p ../build/
@$(LD) -N -ekernel_main -Ttext 0x00050000 -o ../build/kernel.bin -L../build/ $+ -lk --oformat binary
@$(CC) $(CFLAGS) -o ../build/debug.o -L../build/ $+ -lk
|