aboutsummaryrefslogtreecommitdiff
path: root/libs/libc/Makefile
diff options
context:
space:
mode:
authorMarvin Borner2021-03-26 21:55:50 +0100
committerMarvin Borner2021-03-26 22:02:20 +0100
commit05498860e8f7b1e8bb27880bc7526de026694804 (patch)
tree3bddf16e9439a950a3810d45e42a5cefdbcb7663 /libs/libc/Makefile
parenta96e9c4c858d47f61b89d879aa0ce6a02bdacb38 (diff)
Renamed libs
Cleaner and more flexible.
Diffstat (limited to 'libs/libc/Makefile')
-rw-r--r--libs/libc/Makefile42
1 files changed, 42 insertions, 0 deletions
diff --git a/libs/libc/Makefile b/libs/libc/Makefile
new file mode 100644
index 0000000..1c66f43
--- /dev/null
+++ b/libs/libc/Makefile
@@ -0,0 +1,42 @@
+# MIT License, Copyright (c) 2020 Marvin Borner
+
+# TODO: Remove cpu from libc?
+COBJS = sanitize.o \
+ errno.o \
+ str.o \
+ alloc.o \
+ mem.o \
+ math.o \
+ crypto.o \
+ conv.o \
+ print.o \
+ cpu.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 += -Duserspace
+libc: $(COBJS)
+ @$(AS) $(ASFLAGS) crt/crt0.asm -o crt0.o
+ @mkdir -p ../../build/
+ @$(AR) rcs ../../build/libc.a crt0.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