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 /* Object from all the C files. */
30 list_for_each(&m->c_files, i, list)
31 list = talloc_asprintf_append(list, "%.*s.o ",
32 strlen(i->name) - 2, i->name);
37 /* We leave this object file around after ccanlint runs, all built. */
38 static void *do_build(struct manifest *m)
40 if (list_empty(&m->c_files)) {
41 /* No files? No score, but we "pass". */
42 build.total_score = 0;
45 return run_command(m, "ld -r -o ../%s.o %s", m->basename, obj_list(m));
48 static const char *describe_build(struct manifest *m, void *check_result)
50 return talloc_asprintf(check_result,
51 "The object file for the module didn't build:\n"
52 "%s", (char *)check_result);
55 struct ccanlint build = {
56 .name = "Module can be built",
59 .describe = describe_build,
63 REGISTER_TEST(build, &depends_built, NULL);