1 #include <tools/ccanlint/ccanlint.h>
2 #include <tools/tools.h>
3 #include <ccan/talloc/talloc.h>
4 #include <ccan/str/str.h>
18 static const char *can_build(struct manifest *m)
21 return "Safe mode enabled";
25 void build_objects(struct manifest *m,
26 bool keep, struct score *score, const char *flags)
29 bool errors = false, warnings = false;
31 if (list_empty(&m->c_files))
36 list_for_each(&m->c_files, i, list) {
38 char *fullfile = talloc_asprintf(m, "%s/%s", m->dir, i->name);
40 i->compiled = maybe_temp_file(m, "", keep, fullfile);
41 if (!compile_object(score, fullfile, ccan_dir, compiler, flags,
42 i->compiled, &output)) {
43 talloc_free(i->compiled);
44 score_file_error(score, i, 0,
45 "Compiling object files:\n%s",
48 } else if (!streq(output, "")) {
49 score_file_error(score, i, 0,
50 "Compiling object files gave"
59 score->score = score->total - warnings;
63 static void check_objs_build(struct manifest *m,
65 unsigned int *timeleft, struct score *score)
67 build_objects(m, keep, score, cflags);
70 struct ccanlint objects_build = {
71 .key = "objects_build",
72 .name = "Module object files can be built",
73 .check = check_objs_build,
75 .needs = "depends_exist"
78 REGISTER_TEST(objects_build);