new option -o
authorbernhardheld <bernhardheld@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Sat, 11 Jan 2003 01:40:30 +0000 (01:40 +0000)
committerbernhardheld <bernhardheld@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Sat, 11 Jan 2003 01:40:30 +0000 (01:40 +0000)
git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@2147 4a8a32a2-be11-0410-ad9d-d568d2c75423

24 files changed:
.version
ChangeLog
device/lib/Makefile.in
src/SDCCBBlock.c
src/SDCCglobl.h
src/SDCCglue.c
src/SDCCmain.c
src/asm.c
src/ds390/main.c
src/pic/glue.c
src/pic/pcode.c
src/pic/ralloc.c
src/pic16/glue.c
src/pic16/pcode.c
src/pic16/ralloc.c
src/z80/main.c
support/regression/fwk/lib/timeout.c
support/regression/ports/ds390/spec.mk
support/regression/ports/gbz80/spec.mk
support/regression/ports/mcs51-stack-auto/spec.mk
support/regression/ports/mcs51/spec.mk
support/regression/ports/ucz80/spec.mk
support/regression/ports/xa51/spec.mk
support/regression/ports/z80/spec.mk

index f90b1afc082fd7893e2baff542cf85cfb803c551..0bee604df761bde7de6502876b5cb0504dfa8701 100644 (file)
--- a/.version
+++ b/.version
@@ -1 +1 @@
-2.3.2
+2.3.3
index 0b3ddc7d5476ffbf9cb7c6c54f21de499a244024..877ab712e3fa4da5bf2e018d899206392db2d6d0 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,29 @@
+2003-01-11  Bernhard Held <bernhard@bernhardheld.de>
+
+       * .version: Bumped version number to 2.3.3
+       * src/SDCCBBlock.c: new option -o
+       * src/SDCCglobl.h: new option -o
+       * src/SDCCglue.c: new option -o
+       * src/SDCCmain.c: new option -o
+       * src/asm.c: new option -o
+       * src/ds390/main.c: new option -o
+       * src/pic/glue.c: new option -o
+       * src/pic/pcode.c: new option -o
+       * src/pic/ralloc.c: new option -o
+       * src/pic16/glue.c: new option -o
+       * src/pic16/pcode.c: new option -o
+       * src/pic16/ralloc.c: new option -o
+       * src/z80/main.c: new option -o
+       * device/lib/Makefile.in: use -o
+       * support/regression/ports/ds390/spec.mk: use -o
+       * support/regression/ports/gbz80/spec.mk: use -o
+       * support/regression/ports/mcs51/spec.mk: use -o
+       * support/regression/ports/mcs51-stack-auto/spec.mk: use -o
+       * support/regression/ports/z80/spec.mk: use -o
+       * support/regression/ports/ucz80/spec.mk: use -o
+       * support/regression/ports/xa51/spec.mk: use -o
+       * support/regression/fwk/lib/timeout.c: fix usage string
+
 2003-01-09  Bernhard Held <bernhard@bernhardheld.de>
        * src/mcs51/gen.c (genPlus): replaced "mov b,acc" by "mov b,a" Fiorenzo D. Ramaglia <fd.ramaglia@tin.it>
        
index 572ff51a486af92b6fa22f7cb534e9f87f9b7194..b4b868ef27925abd7cdf500aef92130ec9d80ffd 100644 (file)
@@ -233,9 +233,7 @@ include clean.mk
 .SUFFIXES: .rel .o
 
 $(PORTDIR)/%$(OEXT): %.c
-       $(CC) $(CPPFLAGS) $(CFLAGS) -c $<
-       mv -f `basename $@` $@
-       mv -f `basename $@ $(OEXT)`.asm $(PORTDIR)
+       $(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@
 
 # Remaking configuration
 # ----------------------
index a656fb77c6c992e04a6f919be3af242706c747d3..2d879cef1f92db395c1e9f155366bd33cbd69823 100644 (file)
@@ -102,7 +102,7 @@ FILE *appendDumpFile (int id) {
 
   if (!dumpFilesPtr->filePtr) {
     // not used before, create it
-    strcpy (scratchFileName, srcFileName);
+    strcpy (scratchFileName, dstFileName);
     strcat (scratchFileName, dumpFilesPtr->ext);
     if (!(dumpFilesPtr->filePtr = fopen (scratchFileName, "w"))) {
       werror (E_FILE_OPEN_ERR, scratchFileName);
index 1a62ccc42351e499a2b73d785d30fd6136313549..b705b5d78b755c9a26c710119c09b87f54fdb4d4 100644 (file)
@@ -53,7 +53,6 @@
 #define PATH_MAX 255           /* define a reasonable value */
 #endif
 
-#define  MAX_FNAME_LEN  128
 #define  MAX_REG_PARMS  1
 typedef int bool;
 
@@ -260,8 +259,15 @@ struct options
 extern int noAssemble;         /* no assembly, stop after code generation */
 extern char *yytext;
 extern char *currFname;
-extern char *srcFileName;      /* source file name without the extenstion */
-extern char *moduleName;       /* source file name without path & extension */
+extern char *fullSrcFileName;  /* full name for the source file; */
+                               /* can be NULL while linking without compiling */
+extern char *fullDstFileName;  /* full name for the output file; */
+                               /* only given by -o, otherwise NULL */
+extern char *dstFileName;      /* destination file name without extension */
+extern char *dstPath;          /* path for the output files; */
+                               /* "" is equivalent with cwd */
+extern char *moduleName;       /* module name is source file without path and extension */
+                               /* can be NULL while linking without compiling */
 extern int currLineno;         /* current line number    */
 extern int yylineno;           /* line number of the current file SDCC.lex */
 extern FILE *yyin;             /* */
index 45d374228148f75f9a0f1bed58d43e907d4508f8..75c40870403e09a3b6afb4ada19a4d72ef3579b4 100644 (file)
@@ -1460,8 +1460,16 @@ glue (void)
 
   if (!options.c1mode)
     {
-      sprintf (scratchFileName, srcFileName);
+      /* -o option overrides default name? */
+      if (noAssemble && fullDstFileName)
+        {
+          strcpy (scratchFileName, fullDstFileName);
+        }
+      else
+        {
+          strcpy (scratchFileName, dstFileName);
       strcat (scratchFileName, port->assembler.file_ext);
+        }
     }
   else
     {
index 5c3e0e2782cc8f0662ccf41009e642ac1650d6c6..19e9e7cf2d3b0dd7feb951ddbb9c32c15b61557e 100644 (file)
@@ -51,9 +51,15 @@ extern int yyparse ();
 
 FILE *srcFile;                 /* source file          */
 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 *fullSrcFileName;         /* full name for the source file; */
+                               /* can be NULL while linking without compiling */
+char *fullDstFileName;         /* full name for the output file; */
+                               /* only given by -o, otherwise NULL */
+char *dstFileName;             /* destination file name without extension */
+char *dstPath = "";            /* path for the output files; */
+                               /* "" is equivalent with cwd */
+char *moduleName;              /* module name is source file without path and extension */
+                               /* can be NULL while linking without compiling */
 const char *preArgv[128];      /* pre-processor arguments  */
 int currRegBank = 0;
 int RegBankUsed[4]={1, 0, 0, 0};       /*JCF: Reg Bank 0 used by default*/
@@ -150,6 +156,7 @@ optionsTable[] = {
     { 0,    "--nojtbound",          &optimize.noJTabBoundary, "Don't generate boundary check for jump tables" },
     { 0,    "--noloopreverse",      &optimize.noLoopReverse, "Disable the loop reverse optimisation" },
     { 'c',  "--compile-only",       &options.cc_only, "Compile and assemble, but do not link" },
+    { 'o',  NULL,                   NULL, "Place the output into the given path resp. file" },
     { 0,    "--dumpraw",            &options.dump_raw, "Dump the internal structure after the initial parse" },
     { 0,    "--dumpgcse",           &options.dump_gcse, NULL },
     { 0,    "--dumploop",           &options.dump_loop, NULL },
@@ -535,7 +542,7 @@ processFile (char *s)
     {
       /* source file name : not if we already have a
          source file */
-      if (srcFileName)
+      if (fullSrcFileName)
        {
          werror (W_TOO_MANY_SRC, s);
          return;
@@ -554,28 +561,35 @@ processFile (char *s)
       /* get rid of the "."-extension */
 
       /* is there a dot at all? */
-      if (strchr (buffer, '.') &&
+      if (strrchr (buffer, '.') &&
           /* is the dot in the filename, not in the path? */
-          (strrchr (buffer, '/' ) < strrchr (buffer, '.') ||
-           strrchr (buffer, '\\') < strrchr (buffer, '.')))
+          (strrchr (buffer, DIR_SEPARATOR_CHAR) < strrchr (buffer, '.')))
+        {
         *strrchr (buffer, '.') = '\0';
-
-      srcFileName = Safe_alloc ( strlen (buffer) + 1);
-      strcpy (srcFileName, buffer);
+        }
 
       /* get rid of any path information
-         for the module name; do this by going
-         backwards till we get to either '/' or '\' or ':'
-         or start of buffer */
+         for the module name; */
       fext = buffer + strlen (buffer);
+#if NATIVE_WIN32
+      /* do this by going backwards till we
+         get '\' or ':' or start of buffer */
       while (fext != buffer &&
-            *(fext - 1) != '\\' &&
-            *(fext - 1) != '/' &&
+            *(fext - 1) != DIR_SEPARATOR_CHAR &&
             *(fext - 1) != ':')
+        {
        fext--;
-      moduleName = Safe_alloc ( strlen (fext) + 1);
-      strcpy (moduleName, fext);
-
+        }
+#else
+      /* do this by going backwards till we
+         get '/' or start of buffer */
+      while (fext != buffer &&
+            *(fext - 1) != DIR_SEPARATOR_CHAR)
+        {
+          fext--;
+        }
+#endif
+      moduleName = Safe_strdup ( fext );
       return;
     }
 
@@ -603,7 +617,7 @@ processFile (char *s)
 static void
 _processC1Arg (char *s)
 {
-  if (srcFileName)
+  if (fullSrcFileName)
     {
       if (options.out_name)
        {
@@ -784,7 +798,7 @@ tryHandleSimpleOpt(char **argv, int *pi)
 /*-----------------------------------------------------------------*/
 /* parseCmdLine - parses the command line and sets the options     */
 /*-----------------------------------------------------------------*/
-int
+static int
 parseCmdLine (int argc, char **argv)
 {
   int i;
@@ -1010,6 +1024,46 @@ parseCmdLine (int argc, char **argv)
             case 'l':
                 libFiles[nlibFiles++] = getStringArg("-l", argv, &i, argc);
                 break;
+            
+            case 'o':
+              {
+                char *p;
+
+                /* copy the file name into the buffer */
+                strcpy (buffer, getStringArg("-o", argv, &i, argc));
+                /* point to last character */
+                p = buffer + strlen (buffer) - 1;
+                if (*p == DIR_SEPARATOR_CHAR)
+                  {
+                    /* only output path specified */
+                    dstPath = Safe_strdup (buffer);
+                    fullDstFileName = NULL;
+                  }
+                else
+                  {
+                    fullDstFileName = Safe_strdup (buffer);
+
+                    /* get rid of the "."-extension */
+
+                    /* is there a dot at all? */
+                    if (strrchr (buffer, '.') &&
+                        /* is the dot in the filename, not in the path? */
+                        (strrchr (buffer, DIR_SEPARATOR_CHAR) < strrchr (buffer, '.')))
+                      *strrchr (buffer, '.') = '\0';
+
+                    dstFileName = Safe_strdup (buffer);
+
+                    /* strip module name to get path */
+                    p = strrchr (buffer, DIR_SEPARATOR_CHAR);
+                    if (p)
+                      {
+                        /* path with trailing / */
+                        p[1] = '\0';
+                        dstPath = Safe_strdup (buffer);
+                      }
+                  }
+                break;
+              }
 
            case 'W':
               /* pre-processer options */
@@ -1103,14 +1157,49 @@ parseCmdLine (int argc, char **argv)
        }
     }
 
+  /* if no dstFileName given with -o, we've to find one: */
+  if (!dstFileName)
+    {
+      /* use the modulename from the C-source */
+      if (fullSrcFileName)
+        {
+          dstFileName = Safe_alloc (strlen (dstPath) + strlen (moduleName) + 1);
+          strcpy (dstFileName, dstPath);
+          strcat (dstFileName, moduleName);
+        }
+      /* use the modulename from the first object file */
+      else if (nrelFiles >= 1)
+        {
+          char *objectName;
+
+          strcpy (buffer, relFiles[0]);
+          /* remove extension (it must be .rel) */
+          *strrchr (buffer, '.') = '\0';
+          /* remove path */
+          objectName = strrchr (buffer, DIR_SEPARATOR_CHAR);
+          if (objectName)
+            {
+              ++objectName;
+            }
+          else
+            {
+              objectName = buffer;
+            }
+          dstFileName = Safe_alloc (strlen (dstPath) + strlen (objectName) + 1);
+          strcpy (dstFileName, dstPath);
+          strcat (dstFileName, objectName);
+        }
+      /* else no module given: help text is displayed */
+    }
+
   /* set up external stack location if not explicitly specified */
   if (!options.xstack_loc)
     options.xstack_loc = options.xdata_loc;
 
   /* if debug option is set the open the cdbFile */
-  if (options.debug && srcFileName)
+  if (options.debug && fullSrcFileName)
     {
-      sprintf (scratchFileName, "%s.adb", srcFileName); //JCF: Nov 30, 2002
+      sprintf (scratchFileName, "%s.adb", dstFileName); //JCF: Nov 30, 2002
       if ((cdbFile = fopen (scratchFileName, "w")) == NULL)
        werror (E_FILE_OPEN_ERR, scratchFileName);
       else
@@ -1130,13 +1219,10 @@ linkEdit (char **envp)
 {
   FILE *lnkfile;
   char *segName, *c;
-
   int i;
-  if (!srcFileName)
-    srcFileName = "temp";
 
   /* first we need to create the <filename>.lnk file */
-  sprintf (scratchFileName, "%s.lnk", srcFileName);
+  sprintf (scratchFileName, "%s.lnk", dstFileName);
   if (!(lnkfile = fopen (scratchFileName, "w")))
     {
       werror (E_FILE_OPEN_ERR, scratchFileName);
@@ -1243,8 +1329,8 @@ linkEdit (char **envp)
     fprintf (lnkfile, "-l %s\n", libFiles[i]);
 
   /* put in the object files */
-  if (strcmp (srcFileName, "temp"))
-    fprintf (lnkfile, "%s ", srcFileName);
+  if (fullSrcFileName)
+    fprintf (lnkfile, "%s ", dstFileName);
 
   for (i = 0; i < nrelFiles; i++)
     fprintf (lnkfile, "%s\n", relFiles[i]);
@@ -1258,7 +1344,7 @@ linkEdit (char **envp)
   if (port->linker.cmd)
     {
       char buffer2[PATH_MAX];
-      buildCmdLine (buffer2, port->linker.cmd, srcFileName, NULL, NULL, NULL);
+      buildCmdLine (buffer2, port->linker.cmd, dstFileName, NULL, NULL, NULL);
       buildCmdLine2 (buffer, buffer2);
     }
   else
@@ -1270,14 +1356,22 @@ linkEdit (char **envp)
     {
       exit (1);
     }
-
-  if (strcmp (srcFileName, "temp") == 0)
+  /* -o option overrides default name? */
+  if (fullDstFileName)
+    {
+      /* the linked file gets the name of the first modul */
+      if (fullSrcFileName)
     {
-      /* rename "temp.cdb" to "firstRelFile.cdb" */
-      char *f = strtok (Safe_strdup (relFiles[0]), ".");
-      f = strcat (f, ".cdb");
-      rename ("temp.cdb", f);
-      srcFileName = NULL;
+          strcpy (scratchFileName, dstFileName);
+        }
+      else
+        {
+          strcpy (scratchFileName, relFiles[0]);
+          /* strip ".rel" extension */
+          *strrchr (scratchFileName, '.') = '\0';
+        }
+      strcat (scratchFileName, options.out_fmt ? ".S19" : ".ihx");
+      rename (scratchFileName, fullDstFileName);
     }
 }
 
@@ -1291,7 +1385,7 @@ assemble (char **envp)
        port->assembler.do_assemble(asmOptions);
        return ;
     } else if (port->assembler.cmd) {
-       buildCmdLine (buffer, port->assembler.cmd, srcFileName, NULL,
+        buildCmdLine (buffer, port->assembler.cmd, dstFileName, NULL,
                      options.debug ? port->assembler.debug_opts : port->assembler.plain_opts,
                      asmOptions);
     } else {
@@ -1304,6 +1398,12 @@ assemble (char **envp)
        */
        exit (1);
     }
+    /* -o option overrides default name? */
+    if (options.cc_only && fullDstFileName) {
+        strcpy (scratchFileName, dstFileName);
+        strcat (scratchFileName, ".rel");
+        rename (scratchFileName, fullDstFileName);
+    }
 }
 
 /*-----------------------------------------------------------------*/
@@ -1549,8 +1649,28 @@ initValues (void)
   setMainValue ("objext", port->linker.rel_ext);
   setMainValue ("asmext", port->assembler.file_ext);
 
+  setMainValue ("dstfilename", dstFileName);
   setMainValue ("fullsrcfilename", fullSrcFileName ? fullSrcFileName : "fullsrcfilename");
-  setMainValue ("srcfilename", srcFileName ? srcFileName : "srcfilename");
+  
+  if (options.cc_only && fullDstFileName)
+    /* compile + assemble and -o given: -o specifies name of object file */
+    {
+      setMainValue ("z80objdstfilename", fullDstFileName);
+    }
+  else
+    {
+      setMainValue ("z80objdstfilename", "{z80stdobjdstfilename}");
+    }
+  if (fullDstFileName)
+    /* if we're linking, -o gives the final file name */
+    {
+      setMainValue ("z80linkdstfilename", fullDstFileName);
+    }
+  else
+    {
+      setMainValue ("z80linkdstfilename", "{z80stdlinkdstfilename}");
+    }
+
 }
 
 /*
@@ -1609,8 +1729,8 @@ main (int argc, char **argv, char **envp)
   parseCmdLine (argc, argv);
 
   /* if no input then printUsage & exit */
-  if ((!options.c1mode && !srcFileName && !nrelFiles) || 
-      (options.c1mode && !srcFileName && !options.out_name))
+  if ((!options.c1mode && !fullSrcFileName && !nrelFiles) ||
+      (options.c1mode && !fullSrcFileName && !options.out_name))
     {
       printUsage ();
       exit (0);
@@ -1619,7 +1739,7 @@ main (int argc, char **argv, char **envp)
   initValues ();
   _discoverPaths (argv[0]);
 
-  if (srcFileName)
+  if (fullSrcFileName)
     {
 
       initMem ();
@@ -1690,7 +1810,7 @@ main (int argc, char **argv, char **envp)
       !fatalError &&
       !noAssemble &&
       !options.c1mode &&
-      (srcFileName || nrelFiles))
+      (fullSrcFileName || nrelFiles))
     {
       if (port->linker.do_link)
        port->linker.do_link ();
index e1da90635b4053881b8fbf7f67ea14d302cda3f0..8b9f7798075154c11763ce867c7c3986efee523a 100644 (file)
--- a/src/asm.c
+++ b/src/asm.c
@@ -130,7 +130,7 @@ tvsprintf (char *buffer, const char *format, va_list ap)
              break;
            case 'F':
              // Source file name.
-             pInto = _appendAt (pInto, newFormat, srcFileName);
+             pInto = _appendAt (pInto, newFormat, fullSrcFileName);
               sz++;
              break;
             case 'N':
index f6fdd4e082b4ffc1876fc535dca5c81d18979478..a52127d9c71bad1eeb59a2db7663a54686759a20 100644 (file)
@@ -516,11 +516,11 @@ static void _tininative_do_assemble (const char * const *asmOptions)
     };
     char buffer[100];
 
-    buildCmdLine(buffer,macroCmd,srcFileName,NULL,NULL,NULL);
+    buildCmdLine(buffer,macroCmd,dstFileName,NULL,NULL,NULL);
     if (my_system(buffer)) {
        exit(1);
     }
-    buildCmdLine(buffer,a390Cmd,srcFileName,NULL,NULL,asmOptions);
+    buildCmdLine(buffer,a390Cmd,dstFileName,NULL,NULL,asmOptions);
     if (my_system(buffer)) {
        exit(1);
     }    
index e0f73fb7c1b42c958143df29235f2be4b69b1c93..160f8bde0f5e7f3632949c1e141ac564f649abc6 100644 (file)
@@ -808,8 +808,15 @@ picglue ()
   /* create the assembler file name */
     
   if (!options.c1mode) {
-    sprintf (buffer, srcFileName);
-    strcat (buffer, ".asm");
+    if (noAssemble && fullDstFileName)
+      {
+        sprintf (buffer, fullDstFileName);
+      }
+    else
+      {
+        sprintf (buffer, dstFileName);
+        strcat (buffer, ".asm");
+      }
   }
   else {
     strcpy(buffer, options.out_name);
index 28a806f29d1835d50fd358c46b0070c7bad8112c..b9d3418c087769256160f047c06e8c8d70721728 100644 (file)
@@ -1587,7 +1587,7 @@ void pcode_test(void)
     char buffer[100];
 
     /* create the file name */
-    strcpy(buffer,srcFileName);
+    strcpy(buffer,dstFileName);
     strcat(buffer,".p");
 
     if( !(pFile = fopen(buffer, "w" ))) {
index a8599cd75e00e3e9aacdc22e3d5eb4b21f70f82c..d4ab0afc798b72c3012899f27cd08e41bd03a72c 100644 (file)
@@ -102,14 +102,14 @@ debugLog (char *fmt,...)
   //char *bufferP=buffer;
   va_list ap;
 
-  if (!debug || !srcFileName)
+  if (!debug || !dstFileName)
     return;
 
 
   if (!debugF)
     {
       /* create the file name */
-      strcpy (buffer, srcFileName);
+      strcpy (buffer, dstFileName);
       strcat (buffer, ".d");
 
       if (!(debugF = fopen (buffer, (append ? "a+" : "w"))))
index 9c79d34ab00d6c9c555b5501b35aa030060d2542..6b601ce4f7227d13ab96e4713128b9fb287b8b39 100644 (file)
@@ -808,9 +808,16 @@ pic16glue ()
   /* create the assembler file name */
     
   if (!options.c1mode) {
-    sprintf (buffer, srcFileName);
+    if (noAssemble && fullDstFileName)
+      {
+        sprintf (buffer, fullDstFileName);
+      }
+    else
+      {
+        sprintf (buffer, dstFileName);
     strcat (buffer, ".asm");
   }
+  }
   else {
     strcpy(buffer, options.out_name);
   }
index 12fed71666aeaa101d5e83b80d260164623f87c5..b0a6645af6fd3c41c157682353c90e220fc39302 100644 (file)
@@ -2644,7 +2644,7 @@ void pic16_pcode_test(void)
     char buffer[100];
 
     /* create the file name */
-    strcpy(buffer,srcFileName);
+    strcpy(buffer,dstFileName);
     strcat(buffer,".p");
 
     if( !(pFile = fopen(buffer, "w" ))) {
index 638647feb26f45eb07045c5eec8bfc5d16be7732..60c2a88432996fbba1c2913fc4381006848b5a37 100644 (file)
@@ -104,14 +104,14 @@ debugLog (char *fmt,...)
   //char *bufferP=buffer;
   va_list ap;
 
-  if (!debug || !srcFileName)
+  if (!debug || !dstFileName)
     return;
 
 
   if (!debugF)
     {
       /* create the file name */
-      strcpy (buffer, srcFileName);
+      strcpy (buffer, dstFileName);
       strcat (buffer, ".d");
 
       if (!(debugF = fopen (buffer, (append ? "a+" : "w"))))
index 5389b50c82d4ab9083c7cd230304f4775cd5c5a8..eafbd6552f576da8f2ddd73f99098bb820918a11 100644 (file)
@@ -187,15 +187,10 @@ static void
 _gbz80_rgblink (void)
 {
   FILE *lnkfile;
-  const char *sz;
-
   int i;
-  sz = srcFileName;
-  if (!sz)
-    sz = "a";
 
   /* first we need to create the <filename>.lnk file */
-  sprintf (scratchFileName, "%s.lnk", sz);
+  sprintf (scratchFileName, "%s.lnk", dstFileName);
   if (!(lnkfile = fopen (scratchFileName, "w")))
     {
       werror (E_FILE_OPEN_ERR, scratchFileName);
@@ -204,8 +199,7 @@ _gbz80_rgblink (void)
 
   fprintf (lnkfile, "[Objects]\n");
 
-  if (srcFileName)
-    fprintf (lnkfile, "%s.o\n", sz);
+  fprintf (lnkfile, "%s.o\n", dstFileName);
 
   for (i = 0; i < nrelFiles; i++)
     fprintf (lnkfile, "%s\n", relFiles[i]);
@@ -216,11 +210,11 @@ _gbz80_rgblink (void)
     fprintf (lnkfile, "%s\n", libFiles[i]);
 
 
-  fprintf (lnkfile, "\n[Output]\n" "%s.gb", sz);
+  fprintf (lnkfile, "\n[Output]\n" "%s.gb", dstFileName);
 
   fclose (lnkfile);
 
-  buildCmdLine (buffer,port->linker.cmd, sz, NULL, NULL, NULL);
+  buildCmdLine (buffer,port->linker.cmd, dstFileName, NULL, NULL, NULL);
   /* call the linker */
   if (my_system (buffer))
     {
@@ -316,6 +310,9 @@ _setValues(void)
       setMainValue ("z80outext", ".ihx");
     }
 
+  setMainValue ("z80stdobjdstfilename" , "{dstfilename}{objext}");
+  setMainValue ("z80stdlinkdstfilename", "{dstfilename}{z80outext}");
+
   setMainValue ("z80extraobj", joinn (relFiles, nrelFiles));
   
   sprintf (buffer, "-b_CODE=0x%04X -b_DATA=0x%04X", options.code_loc, options.data_loc);
@@ -447,13 +444,13 @@ _hasNativeMulFor (iCode *ic, sym_link *left, sym_link *right)
     "{bindir}{sep}link-{port} -n -c -- {z80bases} -m -j" \
     " {z80libspec}" \
     " {z80extralibfiles} {z80extralibpaths}" \
-    " {z80outputtypeflag} {srcfilename}{z80outext}" \
+    " {z80outputtypeflag} {z80linkdstfilename}" \
     " {z80crt0}" \
-    " {srcfilename}{objext}" \
+    " {dstfilename}{objext}" \
     " {z80extraobj}" 
 
 #define ASMCMD \
-    "{bindir}{sep}as-{port} -plosgff {srcfilename}{objext} {srcfilename}{asmext}"
+    "{bindir}{sep}as-{port} -plosgff {z80objdstfilename} {dstfilename}{asmext}"
 
 /* Globals */
 PORT z80_port =
index 4e076f3d037be1d5e11b0b68a24127e7a9b1225d..899d247c8171743aa6a143399febf34aa33d21f5 100644 (file)
 
 #define USAGE PROGNAME " : 1.00\n" \
               "Usage : " PROGNAME " timeout_in_seconds filename [arguments]\n" \
-              "  ´filename´ is executed, the arguments are passed to ´filename´.\n" \
-              "  When ´filename´exits before the timeout expires, the\n" \
-              "  exit-status of ´filename´ is returned.\n" \
-              "  When the timeout expires before ´filename´ exits, ´filename´\n" \
+              "  \"filename\" is executed, the arguments are passed to \"filename\".\n" \
+              "  When \"filename\" exits before the timeout expires, the\n" \
+              "  exit-status of \"filename\" is returned.\n" \
+              "  When the timeout expires before \"filename\" exits, \"filename\"\n" \
               "  will be killed and an exit-status of 1 is returned.\n"
 
 /* First the program tries to limit the maximum CPU-time to the timeout-value.
@@ -163,3 +163,4 @@ main (int argc, char * const *argv)
         }
     }
 }
+
index 1ff106bd4d311a630d594b11e5d42cafd84cecd2..81f87942fc9be27c5aff83ab1d5ba7e245e926f7 100644 (file)
@@ -15,18 +15,16 @@ EXTRAS = fwk/lib/testfwk$(OBJEXT) $(PORTS_DIR)/$(PORT)/support$(OBJEXT)
 
 # Rule to link into .ihx
 %$(EXEEXT): %$(OBJEXT) $(EXTRAS)
-       $(SDCC) $(SDCCFLAGS) $(EXTRAS) $<
-       mv fwk/lib/testfwk.ihx $@
-       mv fwk/lib/testfwk.map $(@:.ihx=.map)
+       $(SDCC) $(SDCCFLAGS) $(EXTRAS) $< -o $@
 
 %$(OBJEXT): %.c
-       $(SDCC) $(SDCCFLAGS) -c $<
+       $(SDCC) $(SDCCFLAGS) -c $< -o $@
 
 # run simulator with 10 seconds timeout
 %.out: %$(EXEEXT) fwk/lib/timeout
        mkdir -p `dirname $@`
        -fwk/lib/timeout 10 $(S51) -tds390f -S in=/dev/null,out=$@ $< < $(PORTS_DIR)/ds390/uCsim.cmd >/dev/null || \
-          echo -e --- FAIL: \"timeout, simulation killed\" in $(<:.ihx=.c)"\n"--- Summary: 1/1/1: timeout >> $@
+          echo -e --- FAIL: \"timeout, simulation killed\" in $(<:$(EXEEXT)=.c)"\n"--- Summary: 1/1/1: timeout >> $@
        -grep -n FAIL $@ /dev/null || true
 
 fwk/lib/timeout: fwk/lib/timeout.c
index ae15c736b47659687b11912ca0e8e9b363f18b68..69fc47ccf51a3c76084bf296af1ff4901fe4af09 100644 (file)
@@ -11,7 +11,7 @@ EXTRAS = fwk/lib/testfwk$(OBJEXT) ports/$(PORT)/support$(OBJEXT)
 
 # Rule to link into .ihx
 %.gb: %.c $(EXTRAS)
-       $(SDCC) $(SDCCFLAGS) $< $(EXTRAS)
+       $(SDCC) $(SDCCFLAGS) $< $(EXTRAS) -o $@
 
 %$(OBJEXT): %.asm
        ../../bin/as-gbz80 -plosgff $@ $<
@@ -20,7 +20,7 @@ EXTRAS = fwk/lib/testfwk$(OBJEXT) ports/$(PORT)/support$(OBJEXT)
        ../../bin/as-gbz80 -plosgff $@ $<
 
 %$(OBJEXT): %.c
-       $(SDCC) $(SDCCFLAGS) -c $<
+       $(SDCC) $(SDCCFLAGS) -c $< -o $@
 
 # PENDING: Path to sdcc-extra
 %.out: %$(EXEEXT)
index 51b724f953ce7776b1d573577a4dcdcc51d51eb1..855aef422bcd88277eaa45bbee0818e1c21a2609 100644 (file)
@@ -43,10 +43,7 @@ $(LIBDIR):
        mkdir -p $(LIBDIR)
 
 $(LIBDIR)/%.rel: $(LIBSRCDIR)/%.c
-       -$(SDCC) -I../../device/include $(LIBSDCCFLAGS) -c $< \
-        && mv -f $(<:.c=.rel) $@ \
-        && mv -f $(<:.c=.asm) $(@:.rel=.asm) \
-        && mv -f $(<:.c=.lst) $(@:.rel=.lst)
+       -$(SDCC) -I../../device/include $(LIBSDCCFLAGS) -c $< -o $@
 
 lib-files:
        cp $(LIBSRCDIR)/*.lib $(LIBDIR)
index d2d05045c133dc05dad58d5ea307f3e0dec28438..ba313c3caa0bf58fe6b5bd560caeba3d3d013be4 100644 (file)
@@ -17,18 +17,16 @@ EXTRAS = fwk/lib/testfwk$(OBJEXT) $(PORTS_DIR)/$(PORT)/support$(OBJEXT)
 
 # Rule to link into .ihx
 %$(EXEEXT): %$(OBJEXT) $(EXTRAS)
-       $(SDCC) $(SDCCFLAGS) $(EXTRAS) $<
-       mv fwk/lib/testfwk.ihx $@
-       mv fwk/lib/testfwk.map $(@:.ihx=.map)
+       $(SDCC) $(SDCCFLAGS) $(EXTRAS) $< -o $@
 
 %$(OBJEXT): %.c
-       $(SDCC) $(SDCCFLAGS) -c $<
+       $(SDCC) $(SDCCFLAGS) -c $< -o $@
 
 # run simulator with 10 seconds timeout
 %.out: %$(EXEEXT) fwk/lib/timeout
        mkdir -p `dirname $@`
        -fwk/lib/timeout 10 $(S51) -t32 -S in=/dev/null,out=$@ $< < $(PORTS_DIR)/mcs51/uCsim.cmd >/dev/null \
-         || echo -e --- FAIL: \"timeout, simulation killed\" in $(<:.ihx=.c)"\n"--- Summary: 1/1/1: timeout >> $@
+         || echo -e --- FAIL: \"timeout, simulation killed\" in $(<:$(EXEEXT)=.c)"\n"--- Summary: 1/1/1: timeout >> $@
        -grep -n FAIL $@ /dev/null || true
 
 fwk/lib/timeout: fwk/lib/timeout.c
index 7a9c5728b70218d2a3404f45fd499cb459d9ac5b..3543fb1462066ee0cbeb6ef4f7c068dd49e89904 100644 (file)
@@ -17,26 +17,24 @@ EXTRAS = fwk/lib/testfwk$(OBJEXT) $(PORTS_DIR)/$(PORT)/support$(OBJEXT)
 #%$(EXEEXT): %$(OBJEXT) $(EXTRAS)
 
 %$(EXEEXT): %.c $(EXTRAS)
-       $(SDCC) $(SDCCFLAGS) $< $(EXTRAS)
-#      mv fwk/lib/testfwk.ihx $@
-#      mv fwk/lib/testfwk.map $(@:.ihx=.map)
+       $(SDCC) $(SDCCFLAGS) $< $(EXTRAS) -o $@
 
 %$(OBJEXT): %.asm
        $(SDCC_DIR)/bin/as-z80 -plosgff $@ $<
 
 %$(OBJEXT): %.c
-       $(SDCC) $(SDCCFLAGS) -c $<
+       $(SDCC) $(SDCCFLAGS) -c $< -o $@
 
 # run simulator with 10 seconds timeout
 %.out: %$(EXEEXT) fwk/lib/timeout
        mkdir -p `dirname $@`
        -fwk/lib/timeout 10 $(UCZ80) -t32 $< < $(PORTS_DIR)/$(PORT)/uCsim.cmd > $@ \
-         || echo -e --- FAIL: \"timeout, simulation killed\" in $(<:.ihx=.c)"\n"--- Summary: 1/1/1: timeout >> $@
+         || echo -e --- FAIL: \"timeout, simulation killed\" in $(<:$(EXEEXT)=.c)"\n"--- Summary: 1/1/1: timeout >> $@
        -grep -n FAIL $@ /dev/null || true
 
 fwk/lib/timeout: fwk/lib/timeout.c
 
 _clean:
        rm -f fwk/lib/timeout fwk/lib/timeout.exe $(PORTS_DIR)/$(PORT)/*.rel $(PORTS_DIR)/$(PORT)/*.rst \
-             $(PORTS_DIR)/$(PORT)/*.lst $(PORTS_DIR)/$(PORT)/*.sym $(PORTS_DIR)/$(PORT)/*.asm temp.lnk
+             $(PORTS_DIR)/$(PORT)/*.lst $(PORTS_DIR)/$(PORT)/*.sym temp.lnk
 
index 27137dde134c7d6740c0489b28e3f1e3a9996997..391c8f121b7b29f8803e56defd59a6d707958d22 100755 (executable)
@@ -15,12 +15,12 @@ EXTRAS = fwk/lib/testfwk$(OBJEXT) $(PORTS_DIR)/$(PORT)/support$(OBJEXT)
 
 # Rule to link into .hex
 %$(EXEEXT): %$(OBJEXT) $(EXTRAS)
-       $(SDCC) $(SDCCFLAGS) $(EXTRAS) $<
+       $(SDCC) $(SDCCFLAGS) $(EXTRAS) $< -o $@
        mv fwk/lib/testfwk.hex $@
        mv fwk/lib/testfwk.map $(@:.hex=.map)
 
 %$(OBJEXT): %.c
-       $(SDCC) $(SDCCFLAGS) -c $<
+       $(SDCC) $(SDCCFLAGS) -c $< -o $@
 
 # run simulator with 10 seconds timeout
 %.out: %$(EXEEXT) fwk/lib/timeout
index 312af767e97ff5590bf0f3dae8bddb363a763421..51001c3364be1c2c2a7cc91dae6eb76ed682f708 100644 (file)
@@ -16,7 +16,7 @@ EXTRAS = fwk/lib/testfwk$(OBJEXT) ports/$(PORT)/support$(OBJEXT)
 
 # Rule to link into .ihx
 %.ihx: %.c $(EXTRAS)
-       $(SDCC) $(SDCCFLAGS) $< $(EXTRAS)
+       $(SDCC) $(SDCCFLAGS) $< $(EXTRAS) -o $@
 
 %$(OBJEXT): %.asm
        $(SDCC_DIR)/bin/as-z80 -plosgff $@ $<
@@ -28,7 +28,7 @@ EXTRAS = fwk/lib/testfwk$(OBJEXT) ports/$(PORT)/support$(OBJEXT)
        $(SDCC) $(SDCCFLAGS) -c $<
 
 fwk/lib/testfwk$(OBJEXT): fwk/lib/testfwk.c
-       $(SDCC) $(SDCCFLAGS) -c $<
+       $(SDCC) $(SDCCFLAGS) -c $< -o $@
 
 # PENDING: Path to sdcc-extra
 %.out: %$(EXEEXT)