shithub: mc

Download patch

ref: 9e41da83ab7022ef3abffad13e0b30d08a1c4da5
parent: 9109f705674f744cacb8f2b5f27214f1e0062c03
author: Ori Bernstein <[email protected]>
date: Wed Feb 26 15:46:00 EST 2014

Add support for '-S' command in myrbuild.

    This will generate asm files when building with myrbuild, no
    direct calls to 6m needed.

--- 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 @@
     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 @@
         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 @@
             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;