]> git.ozlabs.org Git - ccan/blobdiff - tools/depends.c
Added module block_pool
[ccan] / tools / depends.c
index c631b9bc82968747147a1fd7328297a5d9fff3bc..c9cf88164cd81e37b4981e1e7da1f5a51756609d 100644 (file)
@@ -1,7 +1,7 @@
-#include "talloc/talloc.h"
-#include "str/str.h"
-#include "grab_file/grab_file.h"
-#include "str_talloc/str_talloc.h"
+#include <ccan/talloc/talloc.h>
+#include <ccan/str/str.h>
+#include <ccan/grab_file/grab_file.h>
+#include <ccan/str_talloc/str_talloc.h>
 #include "tools.h"
 #include <err.h>
 #include <stdbool.h>
@@ -39,8 +39,8 @@ static int unlink_info(char *infofile)
 /* Be careful about trying to compile over running programs (parallel make) */
 static char *compile_info(const void *ctx, const char *dir)
 {
-       char *infofile = talloc_asprintf(ctx, "%s/_info.%u", dir, getpid());
-       char *cmd = talloc_asprintf(ctx, "cc " CFLAGS " -o %s %s/_info.c",
+       char *infofile = talloc_asprintf(ctx, "%s/info.%u", dir, getpid());
+       char *cmd = talloc_asprintf(ctx, "cc " CFLAGS " -o %s -x c %s/_info",
                                    infofile, dir);
        talloc_set_destructor(infofile, unlink_info);
        if (system(cmd) != 0)
@@ -98,7 +98,7 @@ static char **get_one_safe_deps(const void *ctx,
        char **deps, **lines, *raw, *fname;
        unsigned int i, n = 0;
 
-       fname = talloc_asprintf(ctx, "%s/_info.c", dir);
+       fname = talloc_asprintf(ctx, "%s/_info", dir);
        raw = grab_file(fname, fname, NULL);
        if (!raw)
                errx(1, "Could not open %s", fname);
@@ -112,6 +112,10 @@ static char **get_one_safe_deps(const void *ctx,
                char *str;
                unsigned int len;
 
+               /* Ignore lines starting with # (e.g. #include) */
+               if (lines[i][0] == '#')
+                       continue;
+
                /* Start of line, or after ". */
                if (strstarts(lines[i], "ccan/"))
                        str = lines[i];