summaryrefslogtreecommitdiff
path: root/parse
diff options
context:
space:
mode:
authorOri Bernstein <ori@markovcorp.com>2017-07-12 10:43:32 -0700
committerOri Bernstein <ori@markovcorp.com>2017-07-12 10:43:32 -0700
commit40f9a316cfacf07650558b3fa516a3c0c42e1210 (patch)
tree35bdbd5d48a061f6398ce7a259832db23d892289 /parse
parent0b1ae8fb344e5e5a26f50fa5c2f0dbb5c1318b87 (diff)
downloadmc-40f9a316cfacf07650558b3fa516a3c0c42e1210.tar.gz
Add support for -O in 6m.
First step to not polluting source dirs.
Diffstat (limited to 'parse')
-rw-r--r--parse/parse.h1
-rw-r--r--parse/use.c14
2 files changed, 12 insertions, 3 deletions
diff --git a/parse/parse.h b/parse/parse.h
index a554982..1b70c18 100644
--- a/parse/parse.h
+++ b/parse/parse.h
@@ -538,6 +538,7 @@ int optdone(Optctx *c);
extern char debugopt[128];
extern int asmonly;
extern char *outfile;
+extern char *objdir;
extern char **incpaths;
extern size_t nincpaths;
extern char *localincpath;
diff --git a/parse/use.c b/parse/use.c
index e9a169c..d194576 100644
--- a/parse/use.c
+++ b/parse/use.c
@@ -1078,9 +1078,17 @@ readuse(Node *use, Stab *st, Vis vis)
fd = NULL;
p = NULL;
if (use->use.islocal) {
- snprintf(buf,sizeof buf, "%s/%s.use", localincpath, use->use.name);
- p = strdup(buf);
- fd = fopen(p, "r");
+ fd = NULL;
+ if (objdir) {
+ snprintf(buf,sizeof buf, "%s/%s/%s.use", objdir, localincpath, use->use.name);
+ p = strdup(buf);
+ fd = fopen(p, "r");
+ }
+ if (!fd) {
+ snprintf(buf,sizeof buf, "%s/%s.use", localincpath, use->use.name);
+ p = strdup(buf);
+ fd = fopen(p, "r");
+ }
if (!fd) {
fprintf(stderr, "could not open usefile %s\n", buf);
exit(1);