summaryrefslogtreecommitdiff
path: root/myrbuild
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2014-02-26 20:46:00 -0500
committerOri Bernstein <ori@eigenstate.org>2014-02-26 20:46:00 -0500
commit9e41da83ab7022ef3abffad13e0b30d08a1c4da5 (patch)
treec392bdd5dff385fe7222121a2b3bcc9c3a56de00 /myrbuild
parent9109f705674f744cacb8f2b5f27214f1e0062c03 (diff)
downloadmc-9e41da83ab7022ef3abffad13e0b30d08a1c4da5.tar.gz
Add support for '-S' command in myrbuild.
This will generate asm files when building with myrbuild, no direct calls to 6m needed.
Diffstat (limited to 'myrbuild')
-rw-r--r--myrbuild/myrbuild.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/myrbuild/myrbuild.c b/myrbuild/myrbuild.c
index e47f155..9e57dea 100644
--- a/myrbuild/myrbuild.c
+++ b/myrbuild/myrbuild.c
@@ -21,6 +21,9 @@
Node *file;
char *filename;
+/* options to pass along to the compiler */
+int genasm = 0;
+
/* binaries we call out to */
char *mc = "6m";
char *as = "as";
@@ -238,7 +241,8 @@ void compile(char *file)
char *deps[512];
char use[1024];
char obj[1024];
- char *extra[] = {"-g", "-o", "" /* filename */};
+ char *extra[32];
+ size_t nextra = 0;
if (hthas(compiled, file))
return;
@@ -265,14 +269,18 @@ void compile(char *file)
gencmd(&cmd, &ncmd, muse, file, NULL, 0);
run(cmd);
- gencmd(&cmd, &ncmd, mc, file, NULL, 0);
+ if (genasm)
+ extra[nextra++] = "-S";
+ gencmd(&cmd, &ncmd, mc, file, extra, nextra);
run(cmd);
} else if (hassuffix(file, ".s")) {
swapsuffix(obj, sizeof obj, file, ".s", ".o");
if (isfresh(file, obj))
goto done;
- extra[2] = obj;
- gencmd(&cmd, &ncmd, as, file, extra, 3);
+ extra[nextra++] = "-g";
+ extra[nextra++] = "-o";
+ extra[nextra++] = obj;
+ gencmd(&cmd, &ncmd, as, file, extra, nextra);
run(cmd);
}
done:
@@ -449,6 +457,7 @@ int main(int argc, char **argv)
case 'b': binname = optarg; break;
case 'l': libname = optarg; break;
case 's': ldscript = optarg; break;
+ case 'S': genasm = 1; break;
case 'C': mc = optarg; break;
case 'A': as = optarg; break;
case 'M': muse = optarg; break;