Back to index

lightning-sunbird  0.9+nobinonly
arm-wince-gcc.c
Go to the documentation of this file.
00001 #include "toolpaths.h"
00002 
00003 int 
00004 main(int argc, char **argv)
00005 {
00006   int startOfArgvs;
00007   int i = 0;
00008   int j = 0;
00009   int link = 0;
00010 
00011   char* args[1000];
00012   char  outputFileArg[1000];
00013 
00014   args[i++] = CL_PATH;
00015   args[i++] = "/I\"" WCE_INC "\""; 
00016   args[i++] = "/I\"" SHUNT_INC "\"";
00017   args[i++] = "/FI\"mozce_shunt.h\"";
00018 
00019   args[i++] = "/DMOZCE_STATIC_BUILD";
00020 
00021   #ifdef WM50
00022   args[i++] = "/D_WIN32_WCE=501";
00023   args[i++] = "/DUNDER_CE=501";
00024   args[i++] = "/DWIN32_PLATFORM_WFSP";
00025   #else
00026   args[i++] = "/D_WIN32_WCE=420";
00027   args[i++] = "/DUNDER_CE=420";
00028   args[i++] = "/DWIN32_PLATFORM_PSPC=400"; 
00029   #endif
00030 
00031   args[i++] = "/DARM";
00032   args[i++] = "/DWINCE";
00033   args[i++] = "/D_ARM_";
00034 
00035   //  args[i++] = "/DDEPRECATE_SUPPORTED";
00036   //  args[i++] = "/DSTDC_HEADERS";
00037 
00038   //  args[i++] = "/Gy";  // For link warning LNK1166
00039 
00040   args[i++] = "/Zc:wchar_t-";          // 
00041   args[i++] = "/GS-";                  // disable security checks
00042   args[i++] = "/GR-";                  // disable C++ RTTI
00043 
00044   //  args[i++] = "/fp:fast";
00045   //args[i++] = "/fp:precise";
00046 
00047   startOfArgvs = i;
00048   
00049   i += argpath_conv(&argv[1], &args[i]);
00050 
00051   // if /Fe is passed, then link
00052   //
00053   // if -o is passed, then blank out this argument, and place a "/Fo"
00054   // before the next argument
00055   while(argv[j])
00056   {
00057     if (strncmp(argv[j], "-o", 2) == 0)
00058     {
00059            if ( strstr(args[startOfArgvs+j], ".obj") )
00060            {
00061                   // If we are outputting a .OBJ file, then we are
00062                   // NOT linking, and we need to do some fancy
00063                   // footwork to output "/FoFILENAME" as an argument
00064                   args[startOfArgvs+j-1] = "";
00065                   strcpy(outputFileArg, "/Fo");
00066                   strcat(outputFileArg, args[startOfArgvs+j]);
00067                   args[startOfArgvs+j] = outputFileArg;
00068            } else
00069            {
00070             argv[j] = "";
00071                   // Otherwise, we are linking as usual
00072                   link = 1;
00073            }
00074     }
00075     j++;
00076   }
00077 
00078   if (link)
00079   {
00080     args[i++] = "/link";
00081 
00082     args[i++] = "-ENTRY:mainACRTStartup";
00083   #ifdef WM50
00084   args[i++] = "/subsystem:\"WINDOWSCE,5.01\"";
00085   #else
00086   args[i++] = "/subsystem:\"WINDOWSCE,4.20\"";
00087     args[i++] = "/MACHINE:ARM";
00088   #endif
00089 
00090     args[i++] = "-LIBPATH:\"" WCE_LIB "\"";
00091     args[i++] = "-LIBPATH:\"" SHUNT_LIB "\"";
00092     args[i++] = "-LIBPATH:\"c:/Program Files/Microsoft Visual Studio 8/VC/ce/lib/armv4i/\"";
00093 
00094     args[i++] = "shunt.lib";
00095     args[i++] = "winsock.lib"; 
00096     args[i++] = "corelibc.lib";
00097     args[i++] = "coredll.lib";
00098 
00099     //    args[i++] = "-OPT:REF";
00100     //    args[i++] = "-OPT:ICF";
00101 
00102 
00103     args[i++] = "-NODEFAULTLIB:LIBC";
00104     args[i++] = "-NODEFAULTLIB:OLDNAMES";
00105     args[i++] = "-NODEFAULTLIB:LIBCMT";
00106     args[i++] = "-NODEFAULTLIB:LIBCMTD";
00107 
00108 
00109   }
00110   args[i] = NULL;
00111 
00112   dumpargs(args);
00113   run(args);
00114   return 0;
00115 }