4 require (built "program" ["main.c"; "utils.c"])
6 (* Goal: build the final program from source files. *)
7 and built program sources =
8 target (more_recent [program] sources);
9 List.iter (fun s -> require (compiled s)) sources;
11 let objects = List.map (change_file_extension "o") sources in
12 sh "cd $builddir && cc %s -o %s" (String.concat " " objects) program
14 (* Goal: Make sure a C file is compiled (to an object file). *)
16 let o_file = change_file_extension "o" c_file in
17 target (more_recent [o_file] [c_file]);
18 require (file_exists c_file);
19 sh "cd $builddir && cc -c %s -o %s" c_file o_file