aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorTianhao Wang <wth@riseup.net>2024-02-01 16:52:40 +0100
committerTianhao Wang <shrik3@mailbox.org>2024-06-11 15:13:37 +0200
commit3ee80cef337a6dbe049867cd64a1c62856aa904d (patch)
tree753ca5ec546f79e5968783e101731078f61e68d2 /Makefile
parente0ab81971bf1bcc5656a3911bb4fb1690834a282 (diff)
throw binaries into builds/
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile17
1 files changed, 11 insertions, 6 deletions
diff --git a/Makefile b/Makefile
index 71e2208..492ab0e 100644
--- a/Makefile
+++ b/Makefile
@@ -42,16 +42,16 @@ RUST_OBJECT = target/$(ARCH)-rustubs/$(RUST_BUILD)/librustubs.a
all: bootdisk.iso
-bootdisk.iso : kernel
- $(VERBOSE) cp kernel isofiles/boot/
+bootdisk.iso : $(BUILD)/kernel
+ $(VERBOSE) cp $< isofiles/boot/
$(VERBOSE) grub-mkrescue -d /usr/lib/grub/i386-pc --locales=en@piglatin --themes=none -o bootdisk.iso isofiles
# Note: explicitly tell the linker to use startup: as the entry point (we have no main here)
-kernel : rust_kernel startup.o $(ASMOBJ_PREFIXED)
- $(VERBOSE) ld -static -e startup -T $(LINKER_SCRIPT) -o ./kernel $(BUILD)/startup.o $(ASMOBJ_PREFIXED) $(RUST_OBJECT)
+$(BUILD)/kernel : rust_kernel startup.o $(ASMOBJ_PREFIXED)
+ $(VERBOSE) ld -static -e startup -T $(LINKER_SCRIPT) -o $@ $(BUILD)/startup.o $(ASMOBJ_PREFIXED) $(RUST_OBJECT)
# Note: this target works when the VPATH is set correctly
-$(BUILD)/_%.o : %.s
+$(BUILD)/_%.o : %.s | $(BUILD)
@echo "ASM $@"
@if test \( ! \( -d $(@D) \) \) ;then mkdir -p $(@D);fi
$(VERBOSE) $(ASM) -f $(ASMOBJFORMAT) -o $@ $<
@@ -64,10 +64,15 @@ rust_kernel:
cargo xbuild --target $(ARCH)-rustubs.json $(CARGO_XBUILD_FLAG)
# need nasm
-startup.o:
+# TODO make this arch dependent
+startup.o: startup.s | $(BUILD)
@if test \( ! \( -d $(@D) \) \) ;then mkdir -p $(@D);fi
nasm -f elf64 -o $(BUILD)/startup.o startup.s
+.PHONY: $(BUILD)
+$(BUILD):
+ @mkdir -p $@
+
clean:
cargo clean
rm -f bootdisk.iso