aboutsummaryrefslogtreecommitdiff
path: root/Makefile
blob: 29217ea10e31fd0d281e17f4ba77a2ecdcf8a5f0 (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
# MIT License, Copyright (c) 2020 Marvin Borner

COBJS = src/main.o \
		src/drivers/vesa.o \
		src/drivers/cpu.o \
		src/drivers/serial.o \
		src/drivers/interrupts.o \
		src/lib/string.o
CC = cross/opt/bin/i686-elf-gcc
LD = cross/opt/bin/i686-elf-ld
AS = nasm

# TODO: Use lib as external library
CFLAGS = -Wall -Wextra -nostdlib -nostdinc -ffreestanding -mgeneral-regs-only -mno-80387 -std=c99 -pedantic-errors -Isrc/lib/inc/ -Isrc/inc/ -c

all: compile clean

%.o: %.c
	$(CC) $(CFLAGS) $< -o $@

kernel: $(COBJS)

compile: kernel
	mkdir -p build/
	$(AS) -f bin src/entry.asm -o build/boot.bin
	$(LD) -N -emain -Ttext 0x00050000 -o build/kernel.bin $(COBJS) --oformat binary

clean:
	find src/ -name "*.o" -type f -delete