aboutsummaryrefslogtreecommitdiff
path: root/build.rs
blob: a57e0a9c3cff81455376e0358ff9da4fb942afc5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// Copyright 2019 Robin Krahl <robin.krahl@ireas.org>
// SPDX-License-Identifier: GPL-3.0-or-later

use std::env;
use std::fs::File;
use std::io::{Result, Write};
use std::path::PathBuf;

fn main() -> Result<()> {
    let out = PathBuf::from(env::var_os("OUT_DIR").unwrap());
    let mut file = File::create(out.join("memory.x"))?;
    file.write_all(include_bytes!("etc/memory.x"))?;

    println!("cargo:rustc-link-search={}", out.display());
    println!("cargo:rerun-if-changed=etc/memory.x");

    Ok(())
}