ref: 3c9502102b2b01d6b32dad5f4f23f6f1fe736721
parent: a1dd897c58ff6cccef581446d3808eda347285f2
author: Ori Bernstein <[email protected]>
date: Fri Jun 7 19:33:44 EDT 2013
Fix the library link adding.
--- a/myrbuild/myrbuild.c
+++ b/myrbuild/myrbuild.c
@@ -42,6 +42,7 @@
char *sysname;
regex_t usepat;
+Htab *compiled;
static void usage(char *prog)
{
@@ -188,6 +189,7 @@
size_t i, ndeps;
char **cmd;
size_t ncmd;
+ char *s;
char *localdep;
char *deps[512];
char use[1024];
@@ -194,13 +196,11 @@
char obj[1024];
char *extra[] = {"-g", "-o", "" /* filename */};
+ if (hthas(compiled, file))
+ return;
if (hassuffix(file, ".myr")) {
swapsuffix(use, sizeof use, file, ".myr", ".use");
swapsuffix(obj, sizeof obj, file, ".myr", ".o");
- if (isfresh(file, use))
- return;
- if (isfresh(file, obj))
- return;
getdeps(file, deps, 512, &ndeps);
for (i = 0; i < ndeps; i++) {
if (isquoted(deps[i])) {
@@ -211,6 +211,10 @@
lappend(&libs, &nlibs, deps[i]);
}
}
+ if (isfresh(file, use))
+ return;
+ if (isfresh(file, obj))
+ return;
gencmd(&cmd, &ncmd, muse, file, NULL, 0);
run(cmd);
@@ -224,6 +228,8 @@
gencmd(&cmd, &ncmd, as, file, extra, 3);
run(cmd);
}
+ s = strdup(file);
+ htput(compiled, s, s);
}
void mergeuse(char **files, size_t nfiles)
@@ -383,6 +389,7 @@
if (libname && binname)
die("Can't specify both library and binary names");
+ compiled = mkht(strhash, streq);
regcomp(&usepat, "^[[:space:]]*use[[:space:]]+([^[:space:]]+)", REG_EXTENDED);
for (i = optind; i < argc; i++)
compile(argv[i]);