summaryrefslogtreecommitdiff
path: root/lib/libc/Makefile
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2024-07-04 23:41:00 -0400
committerIan Moffett <ian@osmora.org>2024-07-04 23:41:00 -0400
commitae83d32a56c38e5c7cd4497d64432387d4350a55 (patch)
treecf3b4832b4ddd4b47e7016f9e2b217654d8781d0 /lib/libc/Makefile
parent398e92ea9c4fdfbf5464eb99f3af79f6d583d693 (diff)
lib: Add initial libc
Signed-off-by: Ian Moffett <ian@osmora.org>
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..af91a87
--- /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_ASMOBJ) $(LIBC_OBJ) build/libc.a
+
+build/libc.a: build/
+ mkdir -p include/sys/
+ cp -f $(USRDIR)/include/sys/*.h include/sys
+ ar rcs build/libc.a $(LIBC_OBJ) $(LIBC_ASMOBJ)
+
+%.o: %.c
+ $(CC) $(CFLAGS) -Iinclude/ $< -o $@
+
+%.S.o: %.S
+ $(CC) $(CFLAGS) -Iinclude/ $< -o $@
+
+.PHONY:
+build/:
+ mkdir -p build/
+
+.PHONY: clean
+clean:
+ rm -f $(LIBC_OBJ) $(LIBC_ASMOBJ)
+ rm -rf build/