1 #include <tools/ccanlint/ccanlint.h>
2 #include <tools/tools.h>
3 #include <ccan/str/str.h>
4 #include <ccan/tal/path/path.h>
18 static const char *can_build(struct manifest *m)
21 return "Safe mode enabled";
25 static char *cflags_list(const struct manifest *m)
28 char *ret = tal_strdup(m, cflags);
30 char **flags = get_cflags(m, m->dir, get_or_compile_info);
31 for (i = 0; flags[i]; i++)
32 tal_append_fmt(&ret, " %s", flags[i]);
36 void build_objects(struct manifest *m,
37 struct score *score, const char *flags,
38 enum compile_type ctype)
41 bool errors = false, warnings = false;
43 if (list_empty(&m->c_files))
48 list_for_each(&m->c_files, i, list) {
50 char *fullfile = path_join(m, m->dir, i->name);
52 i->compiled[ctype] = temp_file(m, "", fullfile);
53 if (!compile_object(score, fullfile, ccan_dir, compiler, flags,
54 i->compiled[ctype], &output)) {
55 tal_free(i->compiled[ctype]);
56 score_file_error(score, i, 0,
57 "Compiling object files:\n%s",
60 } else if (!streq(output, "")) {
61 score_file_error(score, i, 0,
62 "Compiling object files gave"
71 score->score = score->total - warnings;
76 static void check_objs_build(struct manifest *m,
77 unsigned int *timeleft, struct score *score)
81 flags = cflags_list(m);
82 build_objects(m, score, flags, COMPILE_NORMAL);
85 struct ccanlint objects_build = {
86 .key = "objects_build",
87 .name = "Module object files can be built",
89 .check = check_objs_build,
91 .needs = "depends_exist info_ported"
94 REGISTER_TEST(objects_build);