feat: rerun build if linker script changes

This commit is contained in:
2021-10-22 13:42:55 +03:00
parent 3e6b7a71e6
commit b61cb052ec
2 changed files with 13 additions and 1 deletions
+1 -1
View File
@@ -66,7 +66,7 @@ endif
all: kernel initrd
kernel:
cd kernel && cargo build $(CARGO_BUILD_OPTS)
cd kernel && ARCH=$(ARCH) MACH=$(MACH) cargo build $(CARGO_BUILD_OPTS)
ifeq ($(ARCH),aarch64)
$(LLVM_BASE)/llvm-strip -o $(O)/kernel.strip $(O)/kernel
$(LLVM_BASE)/llvm-size $(O)/kernel.strip
+12
View File
@@ -0,0 +1,12 @@
use std::env;
fn main() -> Result<(), i32> {
let arch = env::var("ARCH").expect("$ARCH is not set");
let mach = if arch == "aarch64" {
env::var("MACH").expect("$MACH is not set")
} else {
"none".to_owned()
};
println!("cargo:rerun-if-changed=../etc/{}-{}.ld", arch, mach);
Ok(())
}