From 8370d0a3eb373c37386de32ccd3a8a38ddeb8b02 Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Sat, 6 Apr 2024 19:46:41 -0400 Subject: build: Statically link libc Signed-off-by: Ian Moffett --- lib/libc/Makefile | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'lib/libc/Makefile') 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 $@ -- cgit v1.2.3