X-Git-Url: https://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=tools%2Fdepends.c;h=a7c353c27d04571473808b67692219cc46cf2b12;hp=3dcd9d38e2c8cae54dc37867422cd6bc8b108cc4;hb=10e5e329a1a8804ff6461e1724071364cf6be572;hpb=a64257be339a8485f66ca9bafd6be7077aa873cd diff --git a/tools/depends.c b/tools/depends.c index 3dcd9d38..a7c353c2 100644 --- a/tools/depends.c +++ b/tools/depends.c @@ -40,7 +40,7 @@ lines_from_cmd(const void *ctx, const char *format, ...) * temp_file helps here. */ char *compile_info(const void *ctx, const char *dir) { - char *info_c_file, *info, *ccandir, *compiled, *output; + char *info_c_file, *info, *compiled, *output; size_t len; int fd; @@ -59,12 +59,8 @@ char *compile_info(const void *ctx, const char *dir) if (close(fd) != 0) return NULL; - ccandir = talloc_dirname(ctx, dir); - if (strrchr(ccandir, '/')) - *strrchr(ccandir, '/') = '\0'; - compiled = temp_file(ctx, "", "info"); - if (compile_and_link(ctx, info_c_file, ccandir, "", + if (compile_and_link(ctx, info_c_file, find_ccan_dir(dir), "", CCAN_COMPILER, CCAN_CFLAGS " -I.", "", compiled, &output)) return compiled; @@ -209,8 +205,7 @@ get_all_deps(const void *ctx, const char *dir, const char *style, continue; subdir = talloc_asprintf(ctx, "%s/%s", - talloc_dirname(ctx, dir), - deps[i] + strlen("ccan/")); + find_ccan_dir(dir), deps[i]); newdeps = get_one(ctx, subdir, "depends", get_info); /* Should be short, so brute-force out dups. */ @@ -285,8 +280,7 @@ char **get_libs(const void *ctx, const char *dir, const char *style, continue; subdir = talloc_asprintf(ctx, "%s/%s", - talloc_dirname(ctx, dir), - deps[i] + strlen("ccan/")); + find_ccan_dir(dir), deps[i]); newlibs = get_one_libs(ctx, subdir, get_info); newlen = talloc_array_length(newlibs);