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

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

CFLAGS = -Wall -Wextra -nostdlib -nostdinc -fno-builtin -std=c99 -m32 -pedantic-errors -I../libc/inc/ -I../libgui/inc/ -I../libtxt/inc/ -fPIE -Duserspace -Os

all: $(COBJS)

%.o: %.c
	@mkdir -p ../build/apps/
	@$(CC) -c $(CFLAGS) $< -o $@
	@$(LD) -o $(@:.o=.elf) -Tlink.ld -L../build/ $@ -lc -lgui -ltxt
	@$(OC) -O binary $(@:.o=.elf) ../build/apps/$(@:.o=)
# @cp $(@:.o=.elf) ../build/apps/$(@:.o=.dbg)

# %.o: %.c
# 	@mkdir -p ../build/apps/
# 	@$(CC) -c $(CFLAGS) $< -o $@
# 	@$(CC) -r $(CFLAGS) -o ../build/apps/$(@:.o=) -L../build $< -lc