- if (!*infofile) {
- *infofile = compile_info(ctx, dir);
- if (!*infofile)
- errx(1, "Could not compile _info for '%s'", dir);
+ if (recurse) {
+ deps = get_deps(ctx, dir, true, get_info);
+ for (i = 0; deps[i]; i++) {
+ char **newlibs, *subdir;
+ size_t newlen;
+
+ if (!strstarts(deps[i], "ccan/"))
+ continue;
+
+ subdir = talloc_asprintf(ctx, "%s/%s",
+ talloc_dirname(ctx, dir),
+ deps[i] + strlen("ccan/"));
+
+ newlibs = get_one_libs(ctx, subdir, get_info);
+ newlen = talloc_array_length(newlibs);
+ libs = talloc_realloc(ctx, libs, char *, len + newlen);
+ memcpy(&libs[len], newlibs,
+ sizeof(newlibs[0])*newlen);
+ len += newlen;
+ }