diff --git a/lib/codegen-meta/src/gen_build_deps.rs b/lib/codegen-meta/src/gen_build_deps.rs deleted file mode 100644 index a267bc664e..0000000000 --- a/lib/codegen-meta/src/gen_build_deps.rs +++ /dev/null @@ -1,48 +0,0 @@ -//! Generate build dependencies for Cargo. -//! -//! The `build.rs` script is invoked by cargo when building lib/codegen to -//! generate Rust code from the instruction descriptions. Cargo needs to know when -//! it is necessary to rerun the build script. -//! -//! If the build script outputs lines of the form: -//! cargo:rerun-if-changed=/path/to/file -//! -//! cargo will rerun the build script when those files have changed since the last -//! build. - -use error; - -use std::fs; -use std::path; - -/// Recursively find all interesting source files and directories in the -/// directory tree starting at `dir`. Yield a path to each file. -fn source_files(dir: &path::PathBuf) -> Result, error::Error> { - let mut files = Vec::new(); - if dir.is_dir() { - for entry in fs::read_dir(&dir)? { - let entry = entry?; - let path = entry.path(); - if path.is_dir() { - let mut child_dir_files = source_files(&path)?; - files.append(&mut child_dir_files); - } else if let Some(ext) = path.extension() { - if ext == "rs" { - files.push(path.to_str().unwrap().to_string()); - } - } - } - } - Ok(files) -} - -/// Generate the lines of `cargo:rerun-if-changed` output, for each Rust source -/// file inside of the cranelift-codegen-meta crate. -pub fn generate(meta_dir: &path::PathBuf) -> Result<(), error::Error> { - println!("Dependencies from Rust meta language directory:"); - source_files(&meta_dir)? - .into_iter() - .for_each(|p| println!("cargo:rerun-if-changed={}", p)); - - Ok(()) -} diff --git a/lib/codegen-meta/src/lib.rs b/lib/codegen-meta/src/lib.rs index 7a199be9f5..f7533e9709 100644 --- a/lib/codegen-meta/src/lib.rs +++ b/lib/codegen-meta/src/lib.rs @@ -1,5 +1,4 @@ pub mod error; -pub mod gen_build_deps; pub mod gen_types; mod base; diff --git a/lib/codegen/build.rs b/lib/codegen/build.rs index f9ba9b8e4a..5e9795d8d5 100644 --- a/lib/codegen/build.rs +++ b/lib/codegen/build.rs @@ -80,22 +80,9 @@ fn main() { // Now that the Python build process is complete, generate files that are // emitted by the `cretonne_codegen_meta` crate. // ------------------------------------------------------------------------ - - // Identify the directory of the Rust codegen-meta external crate. - let rust_meta_dir = crate_dir - .parent() - .map(|d| d.join("codegen-meta")) - .unwrap_or_else(|| { - eprintln!("Error: Could not find path to lib/codegen-meta crate."); - process::exit(1); - }); - if let Err(err) = meta::gen_types::generate("new_types.rs", &out_dir) { eprintln!("Error: {}", err); process::exit(1); - } else if let Err(err) = meta::gen_build_deps::generate(&rust_meta_dir) { - eprintln!("Error: {}", err); - process::exit(1); } }