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 static char *obj_list(const struct manifest *m, enum compile_type ctype)
27 char *list = talloc_strdup(m, "");
30 /* Objects from all the C files. */
31 list_for_each(&m->c_files, i, list)
32 list = talloc_asprintf_append(list, "%s ",
38 char *build_module(struct manifest *m,
39 enum compile_type ctype, char **errstr)
41 return link_objects(m, m->basename, obj_list(m, ctype), errstr);
44 static void do_build(struct manifest *m,
45 unsigned int *timeleft,
50 if (list_empty(&m->c_files)) {
51 /* No files? No score, but we "pass". */
57 m->compiled[COMPILE_NORMAL]
58 = build_module(m, COMPILE_NORMAL, &errstr);
59 if (!m->compiled[COMPILE_NORMAL]) {
60 score_file_error(score, NULL, 0, "%s", errstr);
65 score->score = score->total;
68 struct ccanlint module_builds = {
69 .key = "module_builds",
70 .name = "Module can be built from object files",
74 .needs = "objects_build"
77 REGISTER_TEST(module_builds);