Skip to content

Commit

Permalink
Ensure bpf_c files exist to avoid accidental rebuilds as the tree cha…
Browse files Browse the repository at this point in the history
…nges
  • Loading branch information
mvines committed Dec 13, 2018
1 parent 8782b14 commit 59a094c
Showing 1 changed file with 19 additions and 9 deletions.
28 changes: 19 additions & 9 deletions programs/native/bpf_loader/build.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use std::env;
use std::path::Path;
use std::process::Command;

fn main() {
Expand All @@ -11,16 +12,25 @@ fn main() {
+ &env::var("PROFILE").unwrap()
+ &"/bpf".to_string();

println!("cargo:rerun-if-changed=../../../sdk/bpf/bpf.mk");
println!("cargo:rerun-if-changed=../../../sdk/bpf/inc/solana_sdk.h");
let rerun_if_changed_files = vec![
"../../../sdk/bpf/bpf.mk",
"../../../sdk/bpf/inc/solana_sdk.h",
"../../bpf/c/makefile",
"../../bpf/c/src/bench_alu.c",
"../../bpf/c/src/move_funds.c",
"../../bpf/c/src/noop++.cc",
"../../bpf/c/src/noop.c",
"../../bpf/c/src/struct_pass.c",
"../../bpf/c/src/struct_ret.c",
];

for file in rerun_if_changed_files {
if !Path::new(file).is_file() {
panic!("{} is not a file", file);
}
println!("cargo:rerun-if-changed={}", file);
}

println!("cargo:rerun-if-changed=../../bpf/c/makefile");
println!("cargo:rerun-if-changed=../../bpf/c/src/bench_alu.c");
println!("cargo:rerun-if-changed=../../bpf/c/src/move_funds.c");
println!("cargo:rerun-if-changed=../../bpf/c/src/noop.c");
println!("cargo:rerun-if-changed=../../bpf/c/src/noop++.c");
println!("cargo:rerun-if-changed=../../bpf/c/src/struct_pass.c");
println!("cargo:rerun-if-changed=../../bpf/c/src/struct_ret.c");
println!("cargo:warning=(not a warning) Compiling C-based BPF programs");
let status = Command::new("make")
.current_dir("../../bpf/c")
Expand Down

0 comments on commit 59a094c

Please sign in to comment.