4 bool compile_verbose = false;
6 /* Compile multiple object files into a single. Returns NULL if fails. */
7 char *link_objects(const void *ctx, const char *basename,
8 const char *objs, char **errmsg)
10 char *file = temp_file(ctx, ".o", basename);
13 printf("Linking objects into %s\n", file);
15 if (run_command(ctx, NULL, errmsg, "ld -r -o %s %s", file, objs))
22 /* Compile a single C file to an object file. */
23 bool compile_object(const void *ctx, const char *cfile, const char *ccandir,
26 const char *outfile, char **output)
29 printf("Compiling %s\n", outfile);
30 return run_command(ctx, NULL, output,
31 "%s %s -I%s -c -o %s %s",
32 compiler, cflags, ccandir, outfile, cfile);
35 /* Compile and link single C file, with object files.
36 * Returns false on failure. */
37 bool compile_and_link(const void *ctx, const char *cfile, const char *ccandir,
38 const char *objs, const char *compiler,
40 const char *libs, const char *outfile, char **output)
43 printf("Compiling and linking %s\n", outfile);
44 return run_command(ctx, NULL, output,
45 "%s %s -I%s -o %s %s %s %s",
47 ccandir, outfile, cfile, objs, libs);