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 ;
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] ;
#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;
}
-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)
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)) {
{
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");
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)) {
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 */
/* 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 */
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 */