diff options
| author | Tianhao Wang <wth@riseup.net> | 2024-02-01 16:52:40 +0100 |
|---|---|---|
| committer | Tianhao Wang <shrik3@mailbox.org> | 2024-06-11 15:13:37 +0200 |
| commit | 3ee80cef337a6dbe049867cd64a1c62856aa904d (patch) | |
| tree | 753ca5ec546f79e5968783e101731078f61e68d2 | |
| parent | e0ab81971bf1bcc5656a3911bb4fb1690834a282 (diff) | |
throw binaries into builds/
| -rw-r--r-- | .gitignore | 1 | ||||
| -rw-r--r-- | Makefile | 17 |
2 files changed, 12 insertions, 6 deletions
@@ -1,3 +1,4 @@ +/build /target Cargo.lock *.iso @@ -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 |
