From: michaelh Date: Fri, 4 Feb 2000 04:27:28 +0000 (+0000) Subject: Changed it so each target can have their own command line. X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=746daa147031bfccb566dabd3d2892ccd98dc709;p=fw%2Fsdcc Changed it so each target can have their own command line. git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@62 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- diff --git a/src/SDCCmain.c b/src/SDCCmain.c index ff58b609..cdcccb8e 100644 --- a/src/SDCCmain.c +++ b/src/SDCCmain.c @@ -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)) { diff --git a/src/mcs51/main.c b/src/mcs51/main.c index 843bb0ff..1e487e92 100644 --- a/src/mcs51/main.c +++ b/src/mcs51/main.c @@ -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 */ diff --git a/src/port.h b/src/port.h index 1630fdb2..87c6a905 100644 --- a/src/port.h +++ b/src/port.h @@ -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 */ diff --git a/src/z80/main.c b/src/z80/main.c index a5e4697f..cc416fa2 100644 --- a/src/z80/main.c +++ b/src/z80/main.c @@ -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 */