aboutsummaryrefslogtreecommitdiffstats
path: root/src/Makefile.build
diff options
context:
space:
mode:
Diffstat (limited to 'src/Makefile.build')
-rw-r--r--src/Makefile.build15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/Makefile.build b/src/Makefile.build
index b5474f5..22de06f 100644
--- a/src/Makefile.build
+++ b/src/Makefile.build
@@ -78,8 +78,18 @@ DEPENDS = $(patsubst %.o,%.d,$(OBJECTS))
threads/kernel.lds.s: CPPFLAGS += -P
threads/kernel.lds.s: threads/kernel.lds.S threads/loader.h
-kernel.o: threads/kernel.lds.s $(OBJECTS)
- $(LD) -T $< -o $@ $(OBJECTS)
+LIBDIR_RUST = $(SRCDIR)/../kernel-rs
+
+LIB_RUST = libkernel-rs.a
+
+$(LIB_RUST):
+ (cd $(LIBDIR_RUST) && cargo build)
+ cp $(LIBDIR_RUST)/target/debug/libkernel.a $@
+
+.PHONY: $(LIB_RUST)
+
+kernel.o: threads/kernel.lds.s $(OBJECTS) $(LIB_RUST)
+ $(LD) -T $< -o $@ $(OBJECTS) $(LIB_RUST)
kernel.bin: kernel.o
$(OBJCOPY) -O binary -R .note -R .comment -S $< $@.tmp
@@ -96,6 +106,7 @@ os.dsk: loader.bin kernel.bin
cat $^ > $@
clean::
+ (cd $(LIBDIR_RUST) && cargo clean)
rm -f $(OBJECTS) $(DEPENDS)
rm -f threads/loader.o threads/kernel.lds.s threads/loader.d
rm -f kernel.o kernel.lds.s