5 #include <ccan/str/str.h>
6 #include <ccan/talloc/talloc.h>
8 int main(int argc, char *argv[])
16 if (argv[1] && streq(argv[1], "--direct")) {
21 if (argv[1] && streq(argv[1], "--compile")) {
26 if (argv[1] && streq(argv[1], "--non-ccan")) {
32 errx(1, "Usage: ccan_depends [--direct] [--compile] [--non-ccan] <dir>\n"
33 "Spits out all the ccan dependencies (recursively unless --direct)");
35 /* We find depends without compiling by looking for ccan/ */
36 if (!ccan && !compile)
37 errx(1, "--non-ccan needs --compile");
40 deps = get_deps(talloc_autofree_context(), argv[1],
43 deps = get_safe_ccan_deps(talloc_autofree_context(),
44 argv[1], recurse, NULL);
46 for (i = 0; deps[i]; i++)
47 if (strstarts(deps[i], "ccan/") == ccan)
48 printf("%s\n", deps[i]);