aboutsummaryrefslogtreecommitdiff
path: root/lib/libc/Makefile
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2024-04-06 19:46:41 -0400
committerIan Moffett <ian@osmora.org>2024-04-06 19:48:10 -0400
commit8370d0a3eb373c37386de32ccd3a8a38ddeb8b02 (patch)
tree2f390a0f8206c8dca80362dd49b01ef3ecec1fc2 /lib/libc/Makefile
parenteccaaf54d8e5ab90ed0cf9dd3be8204e35115692 (diff)
build: Statically link libc
Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'lib/libc/Makefile')
-rw-r--r--lib/libc/Makefile19
1 files changed, 11 insertions, 8 deletions
diff --git a/lib/libc/Makefile b/lib/libc/Makefile
index fabb532..76a5359 100644
--- a/lib/libc/Makefile
+++ b/lib/libc/Makefile
@@ -5,14 +5,17 @@ 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) -znoexecstack $(LIBC_OBJ) \
- build/entry.o build/entry.S.o -o $@
+all: $(LIBC_ASMOBJ) $(LIBC_OBJ) build/libc.a
+
+build/libc.a: build/
+ ar rcs build/libc.a $(LIBC_OBJ) $(LIBC_ASMOBJ)
+
+#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) -znoexecstack $(LIBC_OBJ) \
+# build/entry.o build/entry.S.o -o $@
%.o: %.c
$(CC) $(CFLAGS) $< -o $@