5 #include <ccan/str/str.h>
6 #include <ccan/talloc/talloc.h>
8 int main(int argc, char *argv[])
15 const char *style = "depends";
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")) {
32 if (argv[1] && streq(argv[1], "--tests")) {
35 style = "testdepends";
38 errx(1, "Usage: ccan_depends [--direct] [--compile] [--non-ccan] [--tests] <dir>\n"
39 "Spits out all the ccan dependencies (recursively unless --direct)");
41 /* We find depends without compiling by looking for ccan/ */
42 if (!ccan && !compile)
43 errx(1, "--non-ccan needs --compile");
46 deps = get_deps(talloc_autofree_context(), argv[1],
47 style, recurse, compile_info);
49 deps = get_safe_ccan_deps(talloc_autofree_context(),
50 argv[1], style, recurse);
52 for (i = 0; deps[i]; i++)
53 if (strstarts(deps[i], "ccan/") == ccan)
54 printf("%s\n", deps[i]);