4 #include <ccan/err/err.h>
5 #include <ccan/str/str.h>
7 int main(int argc, char *argv[])
14 const char *style = "depends";
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")) {
31 if (argv[1] && streq(argv[1], "--tests")) {
34 style = "testdepends";
37 errx(1, "Usage: ccan_depends [--direct] [--compile] [--non-ccan] [--tests] <dir>\n"
38 "Spits out all the ccan dependencies (recursively unless --direct)");
40 /* We find depends without compiling by looking for ccan/ */
41 if (!ccan && !compile)
42 errx(1, "--non-ccan needs --compile");
45 deps = get_deps(NULL, argv[1], style, recurse, compile_info);
47 deps = get_safe_ccan_deps(NULL, argv[1], style, recurse);
49 for (i = 0; deps[i]; i++)
50 if (strstarts(deps[i], "ccan/") == ccan)
51 printf("%s\n", deps[i]);