Run sh/shout/shlines in a temporary directory.
[goaljobs.git] / examples / compile-c / compile.ml
index 043bc9a..8e43948 100644 (file)
@@ -9,14 +9,14 @@ and built program sources =
   List.iter (fun s -> require (compiled s)) sources;
 
   let objects = List.map (change_file_extension "o") sources in
-  sh "cc %s -o %s" (String.concat " " objects) program
+  sh "cd $builddir && cc %s -o %s" (String.concat " " objects) program
 
 (* Goal: Make sure a C file is compiled (to an object file). *)
 and compiled c_file =
   let o_file = change_file_extension "o" c_file in
   target (more_recent [o_file] [c_file]);
   require (file_exists c_file);
-  sh "cc -c %s -o %s" c_file o_file
+  sh "cd $builddir && cc -c %s -o %s" c_file o_file
 
 (* XXX IMPLICIT *)
 let () =