diff --git a/src/Cargo.lock b/src/Cargo.lock index c463f2bb747c..e7fa572fa3ad 100644 --- a/src/Cargo.lock +++ b/src/Cargo.lock @@ -221,6 +221,7 @@ dependencies = [ name = "compiler_builtins" version = "0.0.0" dependencies = [ + "build_helper 0.1.0", "core 0.0.0", "gcc 0.3.43 (registry+https://github.com/rust-lang/crates.io-index)", ] diff --git a/src/liballoc_jemalloc/build.rs b/src/liballoc_jemalloc/build.rs index a3402bf39942..cd2e8e4ec20f 100644 --- a/src/liballoc_jemalloc/build.rs +++ b/src/liballoc_jemalloc/build.rs @@ -21,8 +21,6 @@ use std::process::Command; use build_helper::{run, rerun_if_changed_anything_in_dir, up_to_date}; fn main() { - println!("cargo:rerun-if-changed=build.rs"); - // FIXME: This is a hack to support building targets that don't // support jemalloc alongside hosts that do. The jemalloc build is // controlled by a feature of the std crate, and if that feature diff --git a/src/libcompiler_builtins/Cargo.toml b/src/libcompiler_builtins/Cargo.toml index 1a549ae823ac..3f844b3f09e3 100644 --- a/src/libcompiler_builtins/Cargo.toml +++ b/src/libcompiler_builtins/Cargo.toml @@ -15,4 +15,5 @@ doc = false core = { path = "../libcore" } [build-dependencies] +build_helper = { path = "../build_helper" } gcc = "0.3.27" diff --git a/src/libcompiler_builtins/build.rs b/src/libcompiler_builtins/build.rs index 16ecf8825667..564404ca71d6 100644 --- a/src/libcompiler_builtins/build.rs +++ b/src/libcompiler_builtins/build.rs @@ -33,6 +33,7 @@ //! error (if any) and then we just add it to the list. Overall, that cost is //! far far less than working with compiler-rt's build system over time. +extern crate build_helper; extern crate gcc; use std::collections::BTreeMap; @@ -404,5 +405,8 @@ fn main() { cfg.file(Path::new("../compiler-rt/lib/builtins").join(src)); } + // Can't reuse `sources` list becuse it doesn't contain header files. + build_helper::rerun_if_changed_anything_in_dir(Path::new("../compiler-rt")); + cfg.compile("libcompiler-rt.a"); } diff --git a/src/libflate/build.rs b/src/libflate/build.rs index 12016980a2c6..78d2ef1e37d2 100644 --- a/src/libflate/build.rs +++ b/src/libflate/build.rs @@ -11,6 +11,7 @@ extern crate gcc; fn main() { + println!("cargo:rerun-if-changed=../rt/miniz.c"); gcc::Config::new() .file("../rt/miniz.c") .compile("libminiz.a"); diff --git a/src/librustc_asan/build.rs b/src/librustc_asan/build.rs index 015be14bd495..3e95e0dbebef 100644 --- a/src/librustc_asan/build.rs +++ b/src/librustc_asan/build.rs @@ -34,6 +34,4 @@ fn main() { .unwrap()) .join("../compiler-rt")); } - - println!("cargo:rerun-if-changed=build.rs"); } diff --git a/src/librustc_llvm/build.rs b/src/librustc_llvm/build.rs index c74a9308e4eb..b74bccb70593 100644 --- a/src/librustc_llvm/build.rs +++ b/src/librustc_llvm/build.rs @@ -144,9 +144,7 @@ fn main() { cfg.flag("-DLLVM_RUSTLLVM"); } - println!("cargo:rerun-if-changed=../rustllvm/PassWrapper.cpp"); - println!("cargo:rerun-if-changed=../rustllvm/RustWrapper.cpp"); - println!("cargo:rerun-if-changed=../rustllvm/ArchiveWrapper.cpp"); + build_helper::rerun_if_changed_anything_in_dir(Path::new("../rustllvm")); cfg.file("../rustllvm/PassWrapper.cpp") .file("../rustllvm/RustWrapper.cpp") .file("../rustllvm/ArchiveWrapper.cpp") diff --git a/src/librustc_lsan/build.rs b/src/librustc_lsan/build.rs index 5773777d1f81..ec968f51184f 100644 --- a/src/librustc_lsan/build.rs +++ b/src/librustc_lsan/build.rs @@ -34,6 +34,4 @@ fn main() { .unwrap()) .join("../compiler-rt")); } - - println!("cargo:rerun-if-changed=build.rs"); } diff --git a/src/librustc_msan/build.rs b/src/librustc_msan/build.rs index 7a4c8f707393..466fa641deab 100644 --- a/src/librustc_msan/build.rs +++ b/src/librustc_msan/build.rs @@ -34,6 +34,4 @@ fn main() { .unwrap()) .join("../compiler-rt")); } - - println!("cargo:rerun-if-changed=build.rs"); } diff --git a/src/librustc_tsan/build.rs b/src/librustc_tsan/build.rs index 84326ae8a710..95ce237b2673 100644 --- a/src/librustc_tsan/build.rs +++ b/src/librustc_tsan/build.rs @@ -34,6 +34,4 @@ fn main() { .unwrap()) .join("../compiler-rt")); } - - println!("cargo:rerun-if-changed=build.rs"); } diff --git a/src/librustdoc/build.rs b/src/librustdoc/build.rs index fcb7af11dce2..9fa6406c1d8b 100644 --- a/src/librustdoc/build.rs +++ b/src/librustdoc/build.rs @@ -8,9 +8,12 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +extern crate build_helper; extern crate gcc; fn main() { + let src_dir = std::path::Path::new("../rt/hoedown/src"); + build_helper::rerun_if_changed_anything_in_dir(src_dir); let mut cfg = gcc::Config::new(); cfg.file("../rt/hoedown/src/autolink.c") .file("../rt/hoedown/src/buffer.c") @@ -21,6 +24,6 @@ fn main() { .file("../rt/hoedown/src/html_smartypants.c") .file("../rt/hoedown/src/stack.c") .file("../rt/hoedown/src/version.c") - .include("../rt/hoedown/src") + .include(src_dir) .compile("libhoedown.a"); } diff --git a/src/libstd/build.rs b/src/libstd/build.rs index 038dea77f3ea..834e3d092112 100644 --- a/src/libstd/build.rs +++ b/src/libstd/build.rs @@ -21,8 +21,6 @@ use std::process::Command; use build_helper::{run, rerun_if_changed_anything_in_dir, up_to_date}; fn main() { - println!("cargo:rerun-if-changed=build.rs"); - let target = env::var("TARGET").expect("TARGET was not set"); let host = env::var("HOST").expect("HOST was not set"); if cfg!(feature = "backtrace") && !target.contains("apple") && !target.contains("msvc") && diff --git a/src/libunwind/build.rs b/src/libunwind/build.rs index ea0d76978339..ed3d5212bf25 100644 --- a/src/libunwind/build.rs +++ b/src/libunwind/build.rs @@ -11,6 +11,7 @@ use std::env; fn main() { + println!("cargo:rerun-if-changed=build.rs"); let target = env::var("TARGET").expect("TARGET was not set"); if target.contains("linux") {