-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.rs
35 lines (31 loc) · 1.32 KB
/
build.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/***************************************************************************************************
* Copyright (c) 2019 by the authors
*
* Author: André Borrmann
* License: Apache License 2.0
**************************************************************************************************/
//! Build script to pre-compile the assembly files containing the majority of the bootstrap code
//! and some initial configuration required before rust code could pick up processing
//!
extern crate cc;
use std::env;
fn main() {
let script_location = env::current_dir().unwrap();
if let Some(target_arch) = env::var_os("CARGO_CFG_TARGET_ARCH") {
if target_arch == "aarch64" && env::var("DOCS_RS").is_err() {
cc::Build::new()
.file("src/asm/aarch64/bootstrap.S")
.flag("-march=armv8-a")
.compile("bootstrap");
cc::Build::new()
.file("src/asm/aarch64/exceptionvector.S")
.flag("-march=armv8-a")
.compile("excvector");
// print the linker file location of the boot crate to the env-variables
println!("cargo:linkerscript={}/link64.ld", script_location.display());
println!("cargo:rerun-if-changed=link64.ld");
println!("cargo:rerun-if-changed=src/asm/aarch64/bootstrap.S");
println!("cargo:rerun-if-changed=src/asm/aarch64/exceptionvector.S");
}
}
}