1 #include <tools/ccanlint/ccanlint.h>
2 #include <tools/tools.h>
3 #include <ccan/talloc/talloc.h>
4 #include <ccan/str/str.h>
17 static const char *can_build(struct manifest *m)
20 return "Safe mode enabled";
24 static char *obj_list(const struct manifest *m)
26 char *list = talloc_strdup(m, "");
29 /* Objects from all the C files. */
30 list_for_each(&m->c_files, i, list)
31 list = talloc_asprintf_append(list, "%s ", i->compiled);
36 static void do_build(struct manifest *m,
38 unsigned int *timeleft,
41 char *filename, *errstr;
43 if (list_empty(&m->c_files)) {
44 /* No files? No score, but we "pass". */
50 filename = link_objects(m, m->basename, false, obj_list(m), &errstr);
52 score->error = "The object file didn't build";
53 score_file_error(score, NULL, 0, errstr);
58 char *realname = talloc_asprintf(m, "%s.o", m->dir);
59 /* We leave this object file around, all built. */
60 if (!move_file(filename, realname))
61 err(1, "Renaming %s to %s", filename, realname);
64 score->score = score->total;
67 struct ccanlint build = {
69 .name = "Module can be built from object files",
74 REGISTER_TEST(build, &depends_built, NULL);