summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile27
l---------initrd/init.elf1
l---------initrd/testelf.elf1
3 files changed, 13 insertions, 16 deletions
diff --git a/Makefile b/Makefile
index 33469c2..81e128d 100644
--- a/Makefile
+++ b/Makefile
@@ -64,23 +64,22 @@ out/bootstrap: src/user_bootstrap/linker.ld $(call from_sources, src/user_bootst
@mkdir -p $(@D)
@$(CC) $(LFLAGS) -T $^ -o $@
-initrd/testelf.elf: out/testelf.elf
- @# dummy
-
-initrd/init.elf: out/init.elf
- @# dummy
-
-out/testelf.elf: src/user/linker.ld $(call from_sources, src/user/app/testelf/) $(call from_sources, src/user/lib/) $(call from_sources, src/shared/)
- @mkdir -p $(@D)
- @$(CC) $(LFLAGS) -Wl,-pie -Wl,-no-dynamic-linker -T $^ -o $@
+define userbin_template =
+out/initrd/$(1).elf: src/user/linker.ld $(call from_sources, src/user/app/$(1)/) $(call from_sources, src/user/lib/) $(call from_sources, src/shared/)
+ @mkdir -p $$(@D)
+ @$(CC) $(LFLAGS) -Wl,-pie -Wl,-no-dynamic-linker -T $$^ -o $$@
+endef
+USERBINS := $(shell ls src/user/app)
+$(foreach bin,$(USERBINS),$(eval $(call userbin_template,$(bin))))
-out/init.elf: src/user/linker.ld $(call from_sources, src/user/app/init/) $(call from_sources, src/user/lib/) $(call from_sources, src/shared/)
+out/initrd/%: initrd/%
@mkdir -p $(@D)
- @$(CC) $(LFLAGS) -Wl,-pie -Wl,-no-dynamic-linker -T $^ -o $@
+ @cp $< $@
-# TODO automatically resolve symlinks
-out/initrd.tar: $(shell find initrd/) out/testelf.elf out/init.elf
- cd initrd; tar chf ../$@ *
+out/initrd.tar: $(patsubst %,out/%,$(shell find initrd/ -type f)) \
+ $(patsubst %,out/initrd/%.elf,$(USERBINS))
+ echo $^
+ cd out/initrd; tar chf ../initrd.tar *
out/fs/boot/init: out/bootstrap out/initrd.tar
@mkdir -p $(@D)
diff --git a/initrd/init.elf b/initrd/init.elf
deleted file mode 120000
index 21a467a..0000000
--- a/initrd/init.elf
+++ /dev/null
@@ -1 +0,0 @@
-../out/init.elf \ No newline at end of file
diff --git a/initrd/testelf.elf b/initrd/testelf.elf
deleted file mode 120000
index 8f2f99c..0000000
--- a/initrd/testelf.elf
+++ /dev/null
@@ -1 +0,0 @@
-../out/testelf.elf \ No newline at end of file