+ list_for_each(&m->c_files, i, list) {
+ char *fullfile = talloc_asprintf(m, "%s/%s", m->dir, i->name);
+ char *output;
+
+ i->compiled = maybe_temp_file(m, "", false, fullfile);
+ if (!compile_object(m, fullfile, ccan_dir, "", i->compiled,
+ &output)) {
+ talloc_free(i->compiled);
+ i->compiled = NULL;
+ return talloc_asprintf(m,
+ "Dependency %s"
+ " did not build:\n%s",
+ m->basename, output);
+ }
+ }
+ return NULL;
+}
+
+char *build_submodule(struct manifest *m)
+{
+ char *errstr;
+ struct stat st;
+
+ if (m->compiled)
+ return NULL;
+
+ if (!expect_obj_file(m))
+ return NULL;
+
+ m->compiled = talloc_asprintf(m, "%s.o", m->dir);
+ if (stat(m->compiled, &st) == 0)
+ return NULL;
+
+ if (verbose >= 2)
+ printf(" Building dependency %s\n", m->dir);
+
+ errstr = build_subdir_objs(m);
+ if (errstr)
+ return errstr;
+
+ m->compiled = build_module(m, false, &errstr);
+ if (!m->compiled)
+ return errstr;
+ return NULL;