build/wince/tools/linkargs.c
author Ehsan Akhgari <ehsan@mozilla.com>
Mon, 01 Feb 2010 23:00:06 -0500
changeset 40683 3dcfd44195d691654cf868e38fe4521f633aa079
parent 38402 08856cf466bd4f88371b399ad9c5afe374978998
child 68342 5c5d9ed49e5e1a0ae50d5eb5bf349444a2817291
permissions -rw-r--r--
Bug 542919 - Refactor the plain text editor initialization to facilitate lazy initialization; r=bzbarsky sr=roc

#include "toolspath.h"
#include "linkargs.h"

void checkLinkArgs(int* k, int* s, int* i, int* j, char** args, char** argv) {
      if (strncmp(argv[*j], "-DLL", 4) == 0 ||
	  strncmp(argv[*j], "/DLL", 4) == 0) {
	*k = 1;
      }
      if (strncmp(argv[*j], "-entry", 6) == 0 ||
	  strncmp(argv[*j], "/entry", 6) == 0 ||
	  strncmp(argv[*j], "-ENTRY", 6) == 0 ||
	  strncmp(argv[*j], "/ENTRY",6 ) == 0) {
	*k = 1;
      }
      if (strncmp(argv[*j], "-subsystem:", 11) == 0 ||
	  strncmp(argv[*j], "/subsystem:", 11) == 0 ||
	  strncmp(argv[*j], "-SUBSYSTEM:", 11) == 0 ||
	  strncmp(argv[*j], "/SUBSYSTEM:", 11) == 0) {
	*s = 1;
      }
}

void addLinkArgs(int k, int s, int *i, int *j, char** args, char** argv) {
  args[(*i)++] = "/LIBPATH:\"" WCE_LIB "\"";
  args[(*i)++] = "/LIBPATH:\"" WCE_CRT "\"";
  args[(*i)++] = "/LIBPATH:\"" ATL_LIB "\"";
  args[(*i)++] = "/LIBPATH:\"" OGLES_SDK_LIB "\"";
  args[(*i)++] = "/NODEFAULTLIB";

  args[(*i)++] = "/MAP";
  args[(*i)++] = "/MAPINFO:EXPORTS";

  if (getenv("LOCK_DLLS") != NULL) {
    // lock our dlls in memory
    args[(*i)++] = "/SECTION:.text,\!P";
    args[(*i)++] = "/SECTION:.rdata,\!P";
  }

#ifdef HAVE_SHUNT   // simple test to see if we're in configure or not
  if(getenv("NO_SHUNT") == NULL) {
    args[(*i)++] = "/LIBPATH:\"" SHUNT_LIB "\"";
    args[(*i)++] = "mozce_shunt.lib";
  }
#endif

  args[(*i)++] = "corelibc.lib";
  args[(*i)++] = "coredll.lib";
  args[(*i)++] = "ceshell.lib";
  args[(*i)++] = "mmtimer.lib";

  if (k==0)
    args[(*i)++] = "/ENTRY:mainACRTStartup";

  if (s==0){
    args[(*i)++] = "/subsystem:\"WINDOWSCE,5.02\"";
  }
}