summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authordzwdz2022-08-13 23:09:49 +0200
committerdzwdz2022-08-13 23:09:49 +0200
commit80280433ccef5aff8cba4e1f24c91037d3c1c9b3 (patch)
treea664dfa3045098b04d80a34dcd13c783c9a0b82a /Makefile
parent20e3f127a9c79f8ed9a9fcc3ffea0172eda4d606 (diff)
user: compile libc.a
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile16
1 files changed, 8 insertions, 8 deletions
diff --git a/Makefile b/Makefile
index b5c47d9..58f4dcb 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,6 @@
PATH := $(shell pwd)/toolchain/bin/:$(PATH)
+AR = x86_64-elf-ar
AS = x86_64-elf-as
CC = x86_64-elf-gcc
CHECK = sparse
@@ -70,10 +71,12 @@ out/fs/boot/kernel: src/kernel/linker.ld \
@grub-file --is-x86-multiboot $@ || echo "$@ has an invalid multiboot header"
@grub-file --is-x86-multiboot $@ || rm $@; test -e $@
-out/bootstrap: src/user/bootstrap/linker.ld \
- $(call from_sources, src/user/bootstrap/) \
- $(call from_sources, src/user/lib/) \
- $(call from_sources, src/shared/)
+out/libc.a: $(call from_sources, src/user/lib/) \
+ $(call from_sources, src/shared/)
+ @mkdir -p $(@D)
+ @$(AR) rcs $@ $^
+
+out/bootstrap: src/user/bootstrap/linker.ld $(call from_sources, src/user/bootstrap/) out/libc.a
@mkdir -p $(@D)
@$(CC) $(LFLAGS) -Wl,-Map=% -T $^ -o $@
@@ -90,10 +93,7 @@ out/hdd:
define userbin_template =
-out/initrd/bin/amd64/$(1): src/user/linker.ld \
- $(call from_sources, src/user/app/$(1)/) \
- $(call from_sources, src/user/lib/) \
- $(call from_sources, src/shared/)
+out/initrd/bin/amd64/$(1): src/user/linker.ld $(call from_sources, src/user/app/$(1)) out/libc.a
@mkdir -p $$(@D)
@$(CC) $(LFLAGS) -Wl,-pie -Wl,-no-dynamic-linker -T $$^ -o $$@
endef