aboutsummaryrefslogtreecommitdiff
path: root/lib/libc/Makefile
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2024-03-17 20:59:31 -0400
committerIan Moffett <ian@osmora.org>2024-03-17 20:59:31 -0400
commit0776264c266e7c1619b8b8b84d2da5384979bb3c (patch)
tree80b6ded012336e24c72cc2c16e4c3ce952b7b739 /lib/libc/Makefile
parent7895aaff402a021a1b04645ca8d251f760e5662e (diff)
parent2896f4126de2ee0fd1bab4b960bfb2213c359f18 (diff)
Merge branch 'user' into dev
Diffstat (limited to 'lib/libc/Makefile')
-rw-r--r--lib/libc/Makefile28
1 files changed, 28 insertions, 0 deletions
diff --git a/lib/libc/Makefile b/lib/libc/Makefile
new file mode 100644
index 0000000..aa09a4c
--- /dev/null
+++ b/lib/libc/Makefile
@@ -0,0 +1,28 @@
+CFLAGS = -c -fno-stack-protector -nostdlib -static -Iinclude/
+LIBC_CFILES = $(shell find src/ -name "*.c")
+LIBC_ASMFILES = $(shell find src/ -name "*.S")
+
+LIBC_OBJ = $(LIBC_CFILES:.c=.o)
+LIBC_ASMOBJ = $(LIBC_ASMFILES:.S=.S.o)
+
+all: $(LIBC_OBJ) build/ld.so
+
+build/ld.so: build/ linker/entry.c linker/entry.S
+ mkdir -p $(@D)
+ $(CC) $(CFLAGS) linker/entry.S -o build/entry.S.o
+ $(CC) $(CFLAGS) linker/entry.c -o build/entry.o
+ $(LD) build/entry.o build/entry.S.o -o $(LIBC_OBJ) -o $@
+
+%.o: %.c
+ $(CC) $(CFLAGS) $< -o $@
+
+%.S.o: %.S
+ gcc $(CFLAGS) $< -o $@
+
+.PHONY:
+build/:
+ mkdir -p build/
+
+.PHONY: clean
+clean:
+ rm -rf build/