blob: e4b11fda7f495074bf522165415842394a3b1d81 (
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
44
45
46
47
|
# MIT License, Copyright (c) 2020 Marvin Borner
COBJS = main.o \
drivers/vesa.o \
drivers/cpu.o \
drivers/serial.o \
drivers/interrupts.o \
drivers/interrupts_asm.o \
drivers/keyboard.o \
drivers/ide.o \
drivers/timer.o \
features/fs.o \
features/psf.o \
features/gui.o \
features/load.o \
features/proc.o \
lib/str.o \
lib/mem.o \
lib/math.o \
lib/conv.o \
lib/print.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
# TODO: Use lib as external library
CFLAGS = $(CSFLAGS) -Wall -Wextra -nostdlib -nostdinc -ffreestanding -fno-builtin -mgeneral-regs-only -std=c99 -m32 -pedantic-errors -Wl,-ekernel_main -Ilib/inc/ -Iinc/
ASFLAGS = -f elf32 -O3
all: compile
%.o: %.c
@$(CC) -c $(CFLAGS) $< -o $@
%_asm.o: %.asm
@$(AS) $(ASFLAGS) $< -o $@
compile: $(COBJS)
@mkdir -p ../build/
@$(AS) -f bin entry.asm -o ../build/boot.bin
@$(LD) -N -ekernel_main -Ttext 0x00050000 -o ../build/kernel.bin $(COBJS) --oformat binary
@$(CC) $(CFLAGS) -o ../build/debug.o $(COBJS)
|