From d43c1af88b1834a00f8b5f09aa0af1a5e4f5b4aa Mon Sep 17 00:00:00 2001 From: dzwdz Date: Mon, 18 Jul 2022 14:01:21 +0200 Subject: user: a super primitive ELF loader holy shit. this was simpler than i expected it to be --- Makefile | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'Makefile') 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 $@ -- cgit v1.2.3