Check for '.' in filename only, not the whole path.
[fw/sdcc] / as / mcs51 / lkmain.c
index cc695c9bc2f730d6a281065e1d8fbb00b8695395..548a44fdf53ba6e222c337bba8c1681192fff450 100644 (file)
 #include <string.h>
 #include "aslink.h"
 
+#ifdef WIN32T
+#include <time.h>
+
+void Timer(int action, char * message)
+{
+       static double start, end, total=0.0;
+    static const double secs_per_tick = 1.0 / CLOCKS_PER_SEC;
+
+    if(action==0) start=clock()*secs_per_tick;
+    else if(action==1)
+    {
+       end=clock() * secs_per_tick;
+               printf("%s \t%f seconds.\n", message, (end-start));
+               total+=end-start;
+    }
+    else
+    {
+               printf("Total time: \t%f seconds.\n", total);
+               total=0.0;
+    }
+}
+#endif
+
 /* yuck - but including unistd.h causes problems on Cygwin by redefining
  * Addr_T.
  */
@@ -176,6 +199,10 @@ char *argv[];
        register char *p;
        register int c, i;
 
+#ifdef WIN32T
+    Timer(0, "");
+#endif
+
        startp = (struct lfile *) new (sizeof (struct lfile));
 
        pflag = 1;
@@ -344,6 +371,10 @@ char *argv[];
        //JCF:
        CreateAOMF51();
 
+#ifdef WIN32T
+    Timer(1, "Linker execution time");
+#endif
+
        lkexit(lkerr);
        return 0;
 }
@@ -434,6 +465,29 @@ link_main()
        if ((c=endline()) == 0) { return; }
        switch (c) {
 
+    case 'O': /*For some important sdcc options*/
+        if (pass == 0)
+        {
+            if(strlen(sdccopt)==0)
+            {
+                strcpy(sdccopt, &ip[1]);
+                strcpy(sdccopt_module, curr_module);
+            }
+            else
+            {
+                if(strcmp(sdccopt, &ip[1])!=0)
+                {
+                                   fprintf(stderr,
+                                   "?ASlink-Warning-Conflicting sdcc options:\n"
+                    "   \"%s\" in module \"%s\" and\n"
+                    "   \"%s\" in module \"%s\".\n",
+                    sdccopt, sdccopt_module, &ip[1], curr_module);
+                                   lkerr++;
+                }
+            }
+        }
+               break;
+
        case 'X':
                radix = 16;
                break;
@@ -463,7 +517,10 @@ link_main()
 
        case 'M':
                if (pass == 0)
+        {
+            strcpy(curr_module, &ip[1]);
                        module();
+        }
                break;
 
        case 'A':