forked from clstatham/k4dos
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.rs
More file actions
24 lines (18 loc) · 772 Bytes
/
build.rs
File metadata and controls
24 lines (18 loc) · 772 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
use std::{env, error::Error, process::Command};
fn main() -> Result<(), Box<dyn Error + Send + Sync>> {
// Get the name of the package.
let kernel_name = env::var("CARGO_PKG_NAME")?;
let status = Command::new("./deps.sh")
.args(["makeimg"])
.status()
.unwrap();
assert!(status.success());
println!("cargo:rustc-link-arg-bin={kernel_name}=--script=.cargo/linker.ld");
// Add linker args.
println!("cargo:rustc-link-arg-bin={kernel_name}=--gc-sections");
// Have cargo rerun this script if the linker script or CARGO_PKG_ENV changes.
println!("cargo:rerun-if-changed=.cargo/linker.ld");
println!("cargo:rerun-if-env-changed=CARGO_PKG_NAME");
println!("cargo:rerun-if-changed=build.rs");
Ok(())
}