blob: cc1b83620ddf0649af088670fc8d5783ef01a769 (
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
# TODO: Remove cpu from libc?
COBJS = crt/crt0.o \
sanitize.o \
errno.o \
str.o \
alloc.o \
mem.o \
math.o \
crypto.o \
conv.o \
print.o \
sys.o \
list.o \
stack.o \
random.o
CC = ccache ../../cross/opt/bin/i686-elf-gcc
LD = ccache ../../cross/opt/bin/i686-elf-ld
AR = ccache ../../cross/opt/bin/i686-elf-ar
AS = ccache nasm
CFLAGS = $(CFLAGS_DEFAULT) -Iinc/
ASFLAGS = -f elf32
%.o: %.c
@$(CC) -c $(CFLAGS) $< -o $@
libc: CFLAGS += -pie -fPIE -fPIC -DUSER
libc: $(COBJS)
@mkdir -p ../../build/
@$(AS) $(ASFLAGS) crt/crti.asm -o ../../build/crti.o
@$(AS) $(ASFLAGS) crt/crtn.asm -o ../../build/crtn.o
@$(AR) rcs ../../build/libc.a ../../build/crti.o ../../build/crti.o $+
libk: CFLAGS += -DKERNEL -ffreestanding -I../../kernel/inc/ $(CFLAGS_EXTRA)
libk: $(COBJS)
@mkdir -p ../../build/
@$(AR) rcs ../../build/libk.a $+
clean:
@find . -name "*.o" -type f -delete
|