mod macros {
extern crate glob;
extern crate pnet_macros;
extern crate syntex;
use std::env;
use std::path::Path;
pub fn expand() {
let pattern = "./src/**/*.rs.in";
for entry in glob::glob(pattern).expect("Failed to read glob pattern") {
if let Ok(path) = entry {
let src = Path::new(path.to_str().expect("Invalid src Specified."));
let out_dir = env::var_os("OUT_DIR").expect("Invalid OUT_DIR.");
let file = Path::new(path.file_stem().expect("Invalid file_stem."));
let dst = Path::new(&out_dir).join(file);
let mut registry = syntex::Registry::new();
pnet_macros::register(&mut registry);
registry.expand("", &src, &dst).unwrap();
}
}
}
}
fn main() {
macros::expand();
}