summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authordzwdz2022-07-18 14:01:21 +0200
committerdzwdz2022-07-18 14:01:21 +0200
commitd43c1af88b1834a00f8b5f09aa0af1a5e4f5b4aa (patch)
tree7743cd9eb761dee12711cf719ab846228a888dbd /Makefile
parent620bd6af8e005057e04c8a2891c7537ec3556345 (diff)
user: a super primitive ELF loader
holy shit. this was simpler than i expected it to be
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile20
1 files changed, 18 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index 0ecf158..6820aef 100644
--- a/Makefile
+++ b/Makefile
@@ -64,8 +64,16 @@ out/raw_init: src/user/linker.ld $(call from_sources, src/user/) $(call from_sou
@mkdir -p $(@D)
@$(CC) $(LFLAGS) -T $^ -o $@
-out/initrd.tar: $(shell find initrd/)
- cd initrd; tar cf ../$@ *
+initrd/test.elf: out/test.elf
+ @# dummy
+
+out/test.elf: src/usertestelf.ld out/obj/usertestelf.c.o out/obj/user/lib/syscall.s.o $(call from_sources, src/shared/)
+ @mkdir -p $(@D)
+ @$(CC) $(LFLAGS) -T $^ -o $@
+
+# TODO automatically resolve symlinks
+out/initrd.tar: $(shell find initrd/) out/test.elf
+ cd initrd; tar chf ../$@ *
out/fs/boot/init: out/raw_init out/initrd.tar
@mkdir -p $(@D)
@@ -87,6 +95,14 @@ out/obj/%.c.o: src/%.c
@mkdir -p $(@D)
@$(CC) $(CFLAGS) -c $^ -o $@
+out/obj/usertestelf.c.o: src/usertestelf.c
+ @mkdir -p $(@D)
+ @$(CC) $(CFLAGS) -fPIE -c $^ -o $@
+
+out/obj/shared/%.c.o: src/shared/%.c
+ @mkdir -p $(@D)
+ @$(CC) $(CFLAGS) -fPIC -c $^ -o $@
+
out/obj/kernel/arch/amd64/32/%.c.o: src/kernel/arch/amd64/32/%.c
@mkdir -p $(@D)
@$(CC) $(CFLAGS) -m32 -c $^ -o $@