Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure bpf_c files exist to avoid accidental rebuilds as the tree changes #2143

Merged
merged 1 commit into from
Dec 13, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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