5 #include <ccan/str/str.h>
6 #include <ccan/talloc/talloc.h>
8 int main(int argc, char *argv[])
15 char *dirname, *basename;
17 if (argv[1] && streq(argv[1], "--direct")) {
22 if (argv[1] && streq(argv[1], "--compile")) {
27 if (argv[1] && streq(argv[1], "--non-ccan")) {
33 errx(1, "Usage: ccan_depends [--direct] [--compile] [--non-ccan] <dir>\n"
34 "Spits out all the ccan dependencies (recursively unless --direct)");
36 /* We find depends without compiling by looking for ccan/ */
37 if (!ccan && !compile)
38 errx(1, "--non-ccan needs --compile");
40 dirname = talloc_dirname(NULL, argv[1]);
41 basename = talloc_basename(NULL, argv[1]);
44 deps = get_deps(talloc_autofree_context(),
45 dirname, basename, recurse);
47 deps = get_safe_ccan_deps(talloc_autofree_context(),
48 dirname, basename, recurse);
50 for (i = 0; deps[i]; i++)
51 if (strstarts(deps[i], "ccan/") == ccan)
52 printf("%s\n", deps[i]);