From f2187093f8d19c39071502c9e95bacabd5febd88 Mon Sep 17 00:00:00 2001 From: Vadim Petrochenkov Date: Thu, 23 Feb 2017 18:49:54 +0300 Subject: [PATCH] Add/remove `rerun-if-changed` when necessary --- src/Cargo.lock | 1 + src/liballoc_jemalloc/build.rs | 2 -- src/libcompiler_builtins/Cargo.toml | 1 + src/libcompiler_builtins/build.rs | 4 ++++ src/libflate/build.rs | 1 + src/librustc_asan/build.rs | 2 -- src/librustc_llvm/build.rs | 4 +--- src/librustc_lsan/build.rs | 2 -- src/librustc_msan/build.rs | 2 -- src/librustc_tsan/build.rs | 2 -- src/librustdoc/build.rs | 5 ++++- src/libstd/build.rs | 2 -- src/libunwind/build.rs | 1 + 13 files changed, 13 insertions(+), 16 deletions(-) diff --git a/src/Cargo.lock b/src/Cargo.lock index c463f2bb747..e7fa572fa3a 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 a3402bf3994..cd2e8e4ec20 100644 --- a/src/liballoc_jemalloc/build.rs +++ b/src/liballoc_jemalloc/build.rs @@ -21,8 +21,6 @@ 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 1a549ae823a..3f844b3f09e 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 16ecf882566..564404ca71d 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 12016980a2c..78d2ef1e37d 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 015be14bd49..3e95e0dbebe 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 c74a9308e4e..b74bccb7059 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 5773777d1f8..ec968f51184 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 7a4c8f70739..466fa641dea 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 84326ae8a71..95ce237b267 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 fcb7af11dce..9fa6406c1d8 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 038dea77f3e..834e3d09211 100644 --- a/src/libstd/build.rs +++ b/src/libstd/build.rs @@ -21,8 +21,6 @@ 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 ea0d7697833..ed3d5212bf2 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") { -- 2.44.0