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)
42 if (list_empty(&m->c_files)) {
43 /* No files? No score, but we "pass". */
44 build.total_score = 0;
47 filename = link_objects(m, obj_list(m), &err);
48 if (filename && keep) {
49 char *realname = talloc_asprintf(m, "%s.o", m->dir);
50 /* We leave this object file around, all built. */
51 if (!move_file(filename, realname))
52 return talloc_asprintf(m, "Failed to rename %s to %s",
59 static const char *describe_build(struct manifest *m, void *check_result)
61 return talloc_asprintf(check_result,
62 "The object file for the module didn't build:\n"
63 "%s", (char *)check_result);
66 struct ccanlint build = {
68 .name = "Module can be built from object files",
71 .describe = describe_build,
75 REGISTER_TEST(build, &depends_built, NULL);