summaryrefslogtreecommitdiff
path: root/myrbuild
diff options
context:
space:
mode:
authorOri Bernstein <orib@google.com>2012-10-04 14:52:01 -0400
committerOri Bernstein <orib@google.com>2012-10-04 14:52:01 -0400
commitc40815889c460edd815ead46f1593510e0c56147 (patch)
tree848d51ca8fc066b11bb5560c4c5d96fb87540c38 /myrbuild
parent08b1eacc62abb4f77fd7403c692cdc4b84c7dd76 (diff)
downloadmc-c40815889c460edd815ead46f1593510e0c56147.tar.gz
Filter duplicate libraries.
Diffstat (limited to 'myrbuild')
-rw-r--r--myrbuild/myrbuild.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/myrbuild/myrbuild.c b/myrbuild/myrbuild.c
index 9432fbd..3923967 100644
--- a/myrbuild/myrbuild.c
+++ b/myrbuild/myrbuild.c
@@ -154,6 +154,16 @@ void getdeps(char *file, char **deps, size_t depsz, size_t *ndeps)
*ndeps = i;
}
+int inlist(char **list, size_t sz, char *str)
+{
+ size_t i;
+
+ for (i = 0; i < sz; i++)
+ if (!strcmp(list[i], str))
+ return 1;
+ return 0;
+}
+
void compile(char *file)
{
size_t i, ndeps;
@@ -171,7 +181,7 @@ void compile(char *file)
localdep = fromuse(deps[i]);
compile(localdep);
free(localdep);
- } else {
+ } else if (!inlist(libs, nlibs, deps[i])) {
lappend(&libs, &nlibs, deps[i]);
}
}