 +        Command::new("make")
 +            .arg(format!("INCDIR={}", src.display()))
 +            .arg("-C").arg(build_dir)
-+            .status().unwrap().success()
++            .status_or_panic().success()
 +    }
 +
 +    fs::copy(build_dir.join(".libs/libbacktrace.a"), dst.join("libbacktrace.a")).unwrap();

+            .env("CFLAGS", cflags.connect(" "))
+            .arg(format!("--target={}", ctxt.target()))
+            .arg(format!("--host={}", ctxt.host()))
+            .status().unwrap().success()
+    }
+
+    let mut options = OpenOptions::new();

+path = "../liblibc"
diff --git a/src/liballoc/build.rs b/src/liballoc/build.rs
new file mode 100644
index 0000000..7fb1260
--- /dev/null
+++ b/src/liballoc/build.rs
@@ -0,0 +1,208 @@
+#![allow(dead_code)]
+
+use std::fs::File;
+use std::io::Read;
+use std::ops::Range;
+use std::path::{Path, PathBuf};
+use std::process::{Command, ExitStatus};
+use std::{env, fs, iter};
+
+trait StatusOrPanic {
+    fn status_or_panic(&mut self) -> ExitStatus;
+}
+
+impl StatusOrPanic for Command {
+    fn status_or_panic(&mut self) -> ExitStatus {
+        self.status().unwrap_or_else(|_| {
+            panic!("error: failed to execute {:?}", self)
+        })
+    }
+}
+
+fn main() {
+    let ref ctxt = Ctxt::new().unwrap();
