Changed it so each target can have their own command line.
authormichaelh <michaelh@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Fri, 4 Feb 2000 04:27:28 +0000 (04:27 +0000)
committermichaelh <michaelh@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Fri, 4 Feb 2000 04:27:28 +0000 (04:27 +0000)
git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@62 4a8a32a2-be11-0410-ad9d-d568d2c75423

src/SDCCmain.c
src/mcs51/main.c
src/port.h
src/z80/main.c

index ff58b6090de9501d4f786e8ae460ef26b99e612c..cdcccb8ea1db706a8258ebdfb12cec4d8f005b5f 100644 (file)
@@ -50,7 +50,7 @@ FILE  *cdbFile = NULL  ;/* debugger information output file */
 char  *fullSrcFileName ;/* full name for the source file */
 char  *srcFileName     ;/* source file name with the .c stripped */
 char  *moduleName      ;/* module name is srcFilename stripped of any path */
-char *preArgv[128]        ;/* pre-processor arguments  */
+const char *preArgv[128]          ;/* pre-processor arguments  */
 int   currRegBank = 0 ;
 struct optimize optimize ;
 struct options  options ;
@@ -58,7 +58,7 @@ char *VersionString = SDCC_VERSION_STR /*"Version 2.1.8a"*/;
 short preProcOnly = 0;
 short noAssemble = 0;
 char *linkOptions[128];
-char *asmOptions[128];
+const char *asmOptions[128];
 char *libFiles[128] ;
 int nlibFiles = 0;
 char *libPaths[128] ;
@@ -115,20 +115,11 @@ char    *preOutName;
 #define OPTION_CALLEE_SAVES "-callee-saves"
 #define OPTION_NOREGPARMS   "-noregparms"
 
-static const char *linkCmd[] = {
-    "$1", "-nf", "$2", NULL
-};
-
-static const char *preCmd[] = {
+static const char *_preCmd[] = {
     "sdcpp", "-version", "-Wall", "-lang-c++", "-DSDCC=1", 
     "-I" SDCC_INCLUDE_DIR, "$l", "$1", "$2", NULL
 };
 
-static const char *asmCmd[] = {
-    "$1", "-plosgffc", "$2.asm", NULL
-};
-
-
 extern PORT mcs51_port;
 extern PORT z80_port;
 
@@ -408,7 +399,7 @@ static void processFile (char *s)
   
 }
 
-static void _addToList(char **list, const char *str)
+static void _addToList(const char **list, const char *str)
 {
     /* This is the bad way to do things :) */
     while (*list)
@@ -1052,7 +1043,7 @@ static void linkEdit (char **envp)
     fprintf (lnkfile,"\n-e\n");
     fclose(lnkfile);
 
-    _buildCmdLine(buffer, argv, linkCmd, port->linker.exec_name, srcFileName, NULL, NULL);
+    _buildCmdLine(buffer, argv, port->linker.cmd, srcFileName, NULL, NULL, NULL);
 
     /* call the linker */
     if (my_system(argv[0], argv)) {
@@ -1076,7 +1067,7 @@ static void assemble (char **envp)
 {
     char *argv[128];  /* assembler arguments */
 
-    _buildCmdLine(buffer, argv, asmCmd, port->assembler.exec_name, srcFileName, NULL, asmOptions);
+    _buildCmdLine(buffer, argv, port->assembler.cmd, srcFileName, NULL, NULL, asmOptions);
 
     if (my_system(argv[0], argv)) {
        perror("Cannot exec assember");
@@ -1112,7 +1103,7 @@ static int preProcess (char **envp)
     if (!preProcOnly)
        preOutName = strdup(tmpnam(NULL));
 
-    _buildCmdLine(buffer, argv, preCmd, fullSrcFileName, 
+    _buildCmdLine(buffer, argv, _preCmd, fullSrcFileName, 
                  preOutName, srcFileName, preArgv);
 
     if (my_system(argv[0], argv)) {
index 843bb0ff7998b2e666222eeeb60c3e2d04328270..1e487e928b6c131fe759556aba66be381b5381b2 100644 (file)
@@ -58,18 +58,31 @@ static const char *_mcs51_getRegName(struct regs *reg)
     return "err";
 }
 
+/** $1 is always the basename.
+    $2 is always the output file.
+    $3 varies
+    $l is the list of extra options that should be there somewhere...
+    MUST be terminated with a NULL.
+*/
+static const char *_linkCmd[] = {
+    "aslink", "-nf", "$1", NULL
+};
+
+static const char *_asmCmd[] = {
+    "asx8051", "-plosgffc", "$1.asm", NULL
+};
+
 /* Globals */
 PORT mcs51_port = {
     "mcs51",
     "MCU 8051",                        /* Target name */
     {  
-       "asx8051",              /* Assembler executable name */
+       _asmCmd,
        "-plosgffc",            /* Options with debug */
        "-plosgff",             /* Options without debug */
-       FALSE                   /* TRUE if the assembler requires an output name */
     },
     {
-       "aslink",               /* Linker executable name */
+       _linkCmd
     },
     {
        /* Sizes: char, short, int, long, ptr, fptr, gptr, bit, float, max */
index 1630fdb2b419dbaf82b2a5fe74df5e8ae8fba923..87c6a90537d5669b758b767ef66abe3a294c61d6 100644 (file)
@@ -15,20 +15,18 @@ typedef struct {
 
     /* assembler related information */
     struct {
-       /** Command to run (eg as-z80) */
-       const char *exec_name;
-       /** Arguments for debug mode */
+       /** Command to run and arguments (eg as-z80) */
+       const char **cmd;
+       /** Arguments for debug mode.  PENDING: ignored */
        const char *debug_opts;
-       /** Arguments for normal assembly mode */
+       /** Arguments for normal assembly mode.  PENDING: ignored */
        const char *plain_opts;
-       /** TRUE if the output file name should be pre-pended to the args */
-       bool requires_output_name;
     } assembler;
 
     /* linker related info */
     struct {
        /** Command to run (eg link-z80) */
-       const char *exec_name;
+       const char **cmd;
     } linker;
 
     /** Basic type sizes */
index a5e4697fe14f46029bc78d04c11580e51f4d3e1f..cc416fa2eeb64f2c6a491860040aaae3147358b8 100644 (file)
@@ -40,18 +40,31 @@ static const char *_z80_getRegName(struct regs *reg)
     return "err";
 }
 
+/** $1 is always the basename.
+    $2 is always the output file.
+    $3 varies
+    $l is the list of extra options that should be there somewhere...
+    MUST be terminated with a NULL.
+*/
+static const char *_linkCmd[] = {
+    "link-z80", "-nf", "$1", NULL
+};
+
+static const char *_asmCmd[] = {
+    "as-z80", "-plosgff", "$1.o", "$1.asm", NULL
+};
+
 /* Globals */
 PORT z80_port = {
     "z80",
     "Zilog Z80",               /* Target name */
     {  
-       "as-z80",               /* Assembler executable name */
+       _asmCmd,
        "-plosgff",             /* Options with debug */
        "-plosgff",             /* Options without debug */
-       TRUE                    /* TRUE if the assembler requires an output name */
     },
     {
-       "link-z80",             /* Linker executable name */
+       _linkCmd
     },
     {
        /* Sizes: char, short, int, long, ptr, fptr, gptr, bit, float, max */