aboutsummaryrefslogtreecommitdiff
path: root/apps/Makefile
blob: 16f108a4d01ef96c0f3a5afa35bf65895a599a46 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# MIT License, Copyright (c) 2020 Marvin Borner

COBJS = test.o
CC = ../cross/opt/bin/i686-elf-gcc
LD = ../cross/opt/bin/i686-elf-ld
OC = ../cross/opt/bin/i686-elf-objcopy

# TODO: Fix crash without optimizations
CSFLAGS = -mpreferred-stack-boundary=2 -fno-asynchronous-unwind-tables -Os

CFLAGS = $(CSFLAGS) -Wall -Wextra -nostdlib -nostdinc -ffreestanding -fno-builtin -mgeneral-regs-only -std=c99 -m32 -pedantic-errors -I../src/lib/inc/ -fPIE -Os

all: $(COBJS)

%.o: %.c
	@mkdir -p ../build/
	@$(CC) -c $(CFLAGS) $< -o $@
	@$(LD) -o $(@:.o=.elf) -Tlink.ld $@
	@$(OC) -O binary $(@:.o=.elf) ../build/$(@:.o=)