From: Rusty Russell Date: Sat, 15 Nov 2008 12:25:25 +0000 (+1030) Subject: Hack to fix test builds, by ignoring deps with no .o's (ie. X-Git-Url: http://git.ozlabs.org/?p=ccan;a=commitdiff_plain;h=c4b2c672dcb8da1c16d0e2ec918a944cf82f0553;hp=0c492447b997ad50c289314a7ba41cca6bcc1c3c Hack to fix test builds, by ignoring deps with no .o's (ie. headers-only) --- diff --git a/tools/run_tests.c b/tools/run_tests.c index 45069635..105a3e4b 100644 --- a/tools/run_tests.c +++ b/tools/run_tests.c @@ -4,6 +4,8 @@ #include #include #include +#include +#include #include "ccan/tap/tap.h" #include "ccan/talloc/talloc.h" #include "ccan/str/str.h" @@ -107,11 +109,19 @@ static int build(const char *dir, const char *name, int fail) char **deps; for (deps = get_deps(talloc_autofree_context(), dir, true); *deps; deps++) { + char *newobj; + struct stat st; + if (!strstarts(*deps, "ccan/")) continue; /* ccan/foo -> ccan/foo.o */ - externals = talloc_asprintf_append(externals, " %s.o", *deps); + newobj = talloc_asprintf(name, "%s.o", *deps); + + /* Only if it exists. Makefile sorts this out. */ + if (stat(newobj, &st) == 0 || errno != ENOENT) + externals = talloc_asprintf_append(externals, + " %s", newobj); } cmd = talloc_asprintf(name, "gcc " CFLAGS " %s -o %s %s %s%s%s",