bug 474737 - Windows ce tools refactor, NPOTB r=dougt, ted
authorBrad Lassey <blassey@mozilla.com>
Wed, 28 Jan 2009 13:13:56 -0500
changeset 24372 69502a5ec1afee641cd7175e7c8f41d09bfabe30
parent 24371 eb44ad0afada3005430ddb2fa65c835d2344e813
child 24386 ba138c008f8925404d649605d544888594fd9b1a
push idunknown
push userunknown
push dateunknown
reviewersdougt, ted
bugs474737
milestone1.9.2a1pre
bug 474737 - Windows ce tools refactor, NPOTB r=dougt, ted
allmakefiles.sh
build/Makefile.in
build/wince/shunt/Makefile.in
build/wince/shunt/include/sys/Makefile.in
build/wince/shunt/include/windows.h.in
build/wince/shunt/include/ymath.h.in
build/wince/tools/Makefile
build/wince/tools/Makefile.in
build/wince/tools/arm-wince-as.c
build/wince/tools/arm-wince-gcc.c
build/wince/tools/arm-wince-lib.c
build/wince/tools/arm-wince-link.c
build/wince/tools/arm-wince-res.c
build/wince/tools/toolspath.h
build/wince/tools/vs8ppc2003arm/arm-wince-as.c
build/wince/tools/vs8ppc2003arm/arm-wince-gcc.c
build/wince/tools/vs8ppc2003arm/arm-wince-lib.c
build/wince/tools/vs8ppc2003arm/arm-wince-link.c
build/wince/tools/vs8ppc2003arm/arm-wince-res.c
build/wince/tools/vs8ppc2003arm/build_tools.bat
build/wince/tools/vs8ppc2003arm/toolspath.h
build/wince/tools/vs9ppc2003arm/arm-wince-as.c
build/wince/tools/vs9ppc2003arm/arm-wince-gcc.c
build/wince/tools/vs9ppc2003arm/arm-wince-lib.c
build/wince/tools/vs9ppc2003arm/arm-wince-link.c
build/wince/tools/vs9ppc2003arm/arm-wince-res.c
build/wince/tools/vs9ppc2003arm/toolspath.h
config/autoconf.mk.in
configure.in
--- a/allmakefiles.sh
+++ b/allmakefiles.sh
@@ -61,16 +61,21 @@ build/Makefile
 build/unix/Makefile
 config/Makefile
 config/autoconf.mk
 config/mkdepend/Makefile
 config/doxygen.cfg
 config/tests/src-simple/Makefile
 probes/Makefile
 extensions/Makefile
+build/wince/tools/Makefile
+build/wince/shunt/Makefile
+build/wince/shunt/include/windows.h
+build/wince/shunt/include/ymath.h
+build/wince/shunt/include/sys/Makefile
 "
 
 if [ "$MOZ_MEMORY" ]; then
   add_makefiles "
     memory/jemalloc/Makefile
   "
 fi
 
--- a/build/Makefile.in
+++ b/build/Makefile.in
@@ -48,16 +48,20 @@ MODULE = build
 ifeq (,$(filter WINCE WINNT OS2,$(OS_ARCH)))
 DIRS		= unix
 endif
 
 ifeq (WINNT,$(OS_ARCH))
 DIRS = win32
 endif
 
+ifdef WINCE
+DIRS += wince/tools wince/shunt
+endif
+
 DIRS += pgo
 
 include $(topsrcdir)/config/rules.mk
 
 
 ifeq ($(USE_SHORT_LIBNAME), 1)
 PROGRAM = $(MOZ_APP_NAME)$(BIN_SUFFIX)
 else
new file mode 100644
--- /dev/null
+++ b/build/wince/shunt/Makefile.in
@@ -0,0 +1,91 @@
+# ***** BEGIN LICENSE BLOCK *****
+# Version: MPL 1.1/GPL 2.0/LGPL 2.1
+#
+# The contents of this file are subject to the Mozilla Public License Version
+# 1.1 (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+# http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+# for the specific language governing rights and limitations under the
+# License.
+#
+# The Original Code is Mozilla core build scripts.
+#
+# The Initial Developer of the Original Code is
+# Brad Lassey <blassey@mozilla.com>
+#
+# Portions created by the Initial Developer are Copyright (C) 2008
+# the Mozilla Foundation <http://www.mozilla.org/>. All Rights Reserved.
+#
+# Contributor(s): 
+#
+# Alternatively, the contents of this file may be used under the terms of
+# either the GNU General Public License Version 2 or later (the "GPL"), or
+# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+# in which case the provisions of the GPL or the LGPL are applicable instead
+# of those above. If you wish to allow use of your version of this file only
+# under the terms of either the GPL or the LGPL, and not to allow others to
+# use your version of this file under the terms of the MPL, indicate your
+# decision by deleting the provisions above and replace them with the notice
+# and other provisions required by the GPL or the LGPL. If you do not delete
+# the provisions above, a recipient may use your version of this file under
+# the terms of any one of the MPL, the GPL or the LGPL.
+#
+# ***** END LICENSE BLOCK *****
+
+DEPTH = ../../..
+topsrcdir = @top_srcdir@
+srcdir = @srcdir@
+VPATH = @srcdir@
+MODULE = shunt
+
+TOPSRCDIR = $(topsrcdir)
+OBJDIR = $(DEPTH)
+
+include $(DEPTH)/config/autoconf.mk
+
+EXPORTS = include/windows.h \
+  include/ymath.h \
+  include/direct.h \
+  include/errno.h \
+  include/fcntl.h \
+  include/io.h \
+  include/mbstring.h \
+  include/mozce_shunt.h \
+  include/process.h \
+  include/signal.h \
+  $(NULL)
+
+DIRS += include/sys
+
+BUILD_SWITCH = -Build
+REBUILD_SWITCH = -Rebuild
+CLEAN_SWITCH = -clean
+
+MOZCE_DEVENV=vs$(MOZ_MSVCVERSION)
+
+MOZCE_SHUNT_SLN=$(TOPSRCDIR)/build/wince/shunt/build/$(MOZCE_DEVENV)/mozce_shunt_static.sln
+MOZCE_SHUNT_BUILDDIR=$(srcdir)/build/vs$(MOZ_MSVCVERSION)
+
+MOZCE_PROJECT="Release|Windows Mobile 6 Professional SDK (ARMV4I)"
+
+include $(topsrcdir)/config/rules.mk
+
+
+$(MOZCE_SHUNT_BUILDDIR)/mozce_shunt.lib:: $(MOZCE_SHUNT_BUILDDIR)/mozce_shunt.dll
+
+
+$(MOZCE_SHUNT_BUILDDIR)/mozce_shunt.dll:
+	devenv $(MOZCE_SHUNT_SLN) $(BUILD_SWITCH) $(MOZCE_PROJECT)
+
+libs:: $(MOZCE_SHUNT_BUILDDIR)/mozce_shunt.dll $(MOZCE_SHUNT_BUILDDIR)/mozce_shunt.lib
+	$(INSTALL) $(MOZCE_SHUNT_BUILDDIR)/mozce_shunt.dll  $(DIST)/bin
+	$(INSTALL) $(MOZCE_SHUNT_BUILDDIR)/mozce_shunt.lib  $(DIST)/lib
+
+install:: $(MOZCE_SHUNT_BUILDDIR)/mozce_shunt.dll $(MOZCE_SHUNT_BUILDDIR)/mozce_shunt.lib
+	$(SYSINSTALL) $(MOZCE_SHUNT_BUILDDIR)/mozce_shunt.dll  $(DESTDIR)$(bindir)
+	$(SYSINSTALL) $(MOZCE_SHUNT_BUILDDIR)/mozce_shunt.lib  $(DESTDIR)$(libdir)
+
+
new file mode 100644
--- /dev/null
+++ b/build/wince/shunt/include/sys/Makefile.in
@@ -0,0 +1,49 @@
+# ***** BEGIN LICENSE BLOCK *****
+# Version: MPL 1.1/GPL 2.0/LGPL 2.1
+#
+# The contents of this file are subject to the Mozilla Public License Version
+# 1.1 (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+# http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+# for the specific language governing rights and limitations under the
+# License.
+#
+# The Original Code is Mozilla core build scripts.
+#
+# The Initial Developer of the Original Code is
+# Brad Lassey <blassey@mozilla.com>
+#
+# Portions created by the Initial Developer are Copyright (C) 2008
+# the Mozilla Foundation <http://www.mozilla.org/>. All Rights Reserved.
+#
+# Contributor(s): 
+#
+# Alternatively, the contents of this file may be used under the terms of
+# either the GNU General Public License Version 2 or later (the "GPL"), or
+# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+# in which case the provisions of the GPL or the LGPL are applicable instead
+# of those above. If you wish to allow use of your version of this file only
+# under the terms of either the GPL or the LGPL, and not to allow others to
+# use your version of this file under the terms of the MPL, indicate your
+# decision by deleting the provisions above and replace them with the notice
+# and other provisions required by the GPL or the LGPL. If you do not delete
+# the provisions above, a recipient may use your version of this file under
+# the terms of any one of the MPL, the GPL or the LGPL.
+#
+# ***** END LICENSE BLOCK *****
+
+DEPTH = ../../../../..
+topsrcdir = @top_srcdir@
+srcdir = @srcdir@
+VPATH = @srcdir@
+
+include $(DEPTH)/config/autoconf.mk
+
+include $(topsrcdir)/config/rules.mk
+
+export:: $(srcdir)/stat.h $(srcdir)/types.h
+	$(INSTALL) $^ $(DIST)/include/shunt/sys
+
new file mode 100644
--- /dev/null
+++ b/build/wince/shunt/include/windows.h.in
@@ -0,0 +1,50 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is MOZCE Lib.
+ *
+ * The Initial Developer of the Original Code is Doug Turner <dougt@meer.net>.
+
+ * Portions created by the Initial Developer are Copyright (C) 2008
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *  John Wolfe <wolfe@lobo.us>
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+
+#ifndef MOZCE_WINDOWS_H
+#define MOZCE_WINDOWS_H
+
+// This is to work around the inconistancy of GetProcAddress between 
+// windows desktop and wince, see bug 464190
+
+#include "@WINCE_SDK_DIR@/Include/Armv4i/windows.h"
+#ifdef GetProcAddress
+#undef GetProcAddress
+#endif
+#define GetProcAddress GetProcAddressA
+#endif
new file mode 100644
--- /dev/null
+++ b/build/wince/shunt/include/ymath.h.in
@@ -0,0 +1,52 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is MOZCE Lib.
+ *
+ * The Initial Developer of the Original Code is Doug Turner <dougt@meer.net>.
+
+ * Portions created by the Initial Developer are Copyright (C) 2008
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *  John Wolfe <wolfe@lobo.us>
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+
+#ifndef MOZCE_YMATH_H
+#define MOZCE_YMATH_H
+
+// This is to work around _FNan not being defined on wince, see bug 464180
+
+#include "@WINCE_SDK_DIR@/Include/Armv4i/ymath.h"
+#define _FMAX	    ((1 << (15 - _FOFF)) - 1)
+#define _FOFF	    7
+#define _FSIGN    0x8000
+#define INIT(w0)  {w0, 0}
+static const _Dconst _FNanWinCE = {INIT((_FMAX << _FOFF)
+  | (1 << (_FOFF - 1)))};
+#define _FNan _FNanWinCE
+#endif
--- a/build/wince/tools/Makefile
+++ b/build/wince/tools/Makefile
@@ -36,64 +36,100 @@
 # ***** END LICENSE BLOCK *****
 
 DEVENV_FLAG=-
 
 CC=cl -O2
 
 MOZCE_DEVENV=vs$(MOZ_MSVCVERSION)
 
-MOZCE_SHUNT_SLN=../shunt/build/$(MOZCE_DEVENV)/mozce_shunt_static.sln
+MOZCE_SHUNT_SLN=$(TOPSRCDIR)/build/wince/shunt/build/$(MOZCE_DEVENV)/mozce_shunt_static.sln
 MOZCE_PROJECT="Release|Windows Mobile 6 Professional SDK (ARMV4I)"
 MOZCE_SHUNT_DLL=../shunt/build/$(MOZCE_DEVENV)/mozce_shunt.dll
-MOZCE_TOOLS_DIR=$(MOZCE_DEVENV)ppc2003arm
+MOZCE_TOOLS_DIR=$(TOPSRCDIR)/build/wince/tools
+MOZCE_TOOLS_BIN_DIR=$(OBJDIR)/dist/sdk/bin
 
 BUILD_SWITCH=$(DEVENV_FLAG)Build
 REBUILD_SWITCH=$(DEVENV_FLAG)Rebuild
 CLEAN_SWITCH=$(DEVENV_FLAG)clean
 
+ifeq ($(VCINSTALLDIR),)
+$(error Environment variable VCINSTALLDIR not set! Are you using MozillaBuild?)
+endif
 
-all: output_some_env \
-	 $(MOZCE_TOOLS_DIR)/arm-wince-as.exe \
-	 $(MOZCE_TOOLS_DIR)/arm-wince-gcc.exe \
-	 $(MOZCE_TOOLS_DIR)/arm-wince-lib.exe \
-	 $(MOZCE_TOOLS_DIR)/arm-wince-link.exe \
-	 $(MOZCE_TOOLS_DIR)/arm-wince-res.exe 
+ifeq ($(WINCE_SDK_DIR),)
+$(error Environment variable WINCE_SDK_DIR not set! It must be passed to make if not running from configure)
+endif
+
+ifeq ($(MOZ_MSVCVERSION),)
+$(error Environment variable MOZ_MSVCVERSION not set! Are you using MozillaBuild?)
+endif
+
+CFLAGS += \
+  -DVC_PATH='"$(subst \,\\,$(VCINSTALLDIR))\\"' \
+  -DWM_SDK_PATH='"$(subst \,\\,$(WINCE_SDK_DIR))\\"' \
+  -DMOZCE_DEVENV='"$(MOZCE_DEVENV)"' \
+  -DTOPSRCDIR='"$(TOPSRCDIR)"' \
+  $(NULL)
+
+ifneq ($(WINDOWSSDKDIR),)
+CFLAGS += -DWIN_SDK_PATH='"$(subst \,\\,$(WINDOWSSDKDIR))"'
+else
+ifeq ($(SDKDIR),)
+$(error Environment variable WINDOWSSDKDIR not set! Are you using MozillaBuild?)
+else
+CFLAGS += -DWIN_SDK_PATH='"$(subst \,\\,$(SDKDIR))"'
+endif
+endif
+
+ifdef VPATH
+CFLAGS	+= -DSHUNT_INC='"$(OBJDIR)/dist/include/shunt"'
+else
+CFLAGS	+= -DSHUNT_INC='"$(TOPSRCDIR)/build/wince/shunt/include"'
+endif
+CFLAGS += -DEBUG -Zi
+
+all: libs
+
+libs:  output_some_env \
+	 $(MOZCE_TOOLS_BIN_DIR)/arm-wince-as.exe \
+	 $(MOZCE_TOOLS_BIN_DIR)/arm-wince-gcc.exe \
+	 $(MOZCE_TOOLS_BIN_DIR)/arm-wince-lib.exe \
+	 $(MOZCE_TOOLS_BIN_DIR)/arm-wince-link.exe \
+	 $(MOZCE_TOOLS_BIN_DIR)/arm-wince-res.exe 
 	devenv $(MOZCE_SHUNT_SLN) $(BUILD_SWITCH) $(MOZCE_PROJECT)
 
+clean: clobber
+
+
 clobber:
-	rm -f $(MOZCE_TOOLS_DIR)/*.exe
-	rm -f $(MOZCE_TOOLS_DIR)/*.obj
-	rm -f *.obj
-	rm -f *.exe
-	rm -rf bin
+	rm $(MOZCE_TOOLS_BIN_DIR)/arm-wince-as.exe 
+	rm $(MOZCE_TOOLS_BIN_DIR)/arm-wince-gcc.exe 
+	rm $(MOZCE_TOOLS_BIN_DIR)/arm-wince-lib.exe 
+	rm $(MOZCE_TOOLS_BIN_DIR)/arm-wince-link.exe 
+	rm $(MOZCE_TOOLS_BIN_DIR)/arm-wince-res.exe 
 	devenv $(MOZCE_SHUNT_SLN) $(CLEAN_SWITCH) $(MOZCE_PROJECT)
 
 output_some_env:
 	@echo FOUND $(MOZCE_DEVENV)
 	@echo FOUND $(MOZCE_DEVENV): VSINSTALLDIR=$(VSINSTALLDIR) / MINGW32=$(MINGW32) / MSYSTEM=$(MSYSTEM)
 	@echo FOUND $(MOZCE_DEVENV)
 
-$(MOZCE_TOOLS_DIR)/arm-wince-as.exe:	$(MOZCE_TOOLS_DIR)/arm-wince-as.c $(MOZCE_TOOLS_DIR)/toolspath.h
-	$(CC) $(MOZCE_TOOLS_DIR)/arm-wince-as.c
-	mkdir -p bin;
-	cp arm-wince-as.exe bin; mv arm-wince-as.exe $(MOZCE_TOOLS_DIR); rm *.obj
+$(MOZCE_TOOLS_BIN_DIR)/arm-wince-as.exe:	$(MOZCE_TOOLS_DIR)/arm-wince-as.c $(MOZCE_TOOLS_DIR)/toolspath.h $(MOZCE_TOOLS_DIR)/Makefile
+	mkdir -p $(MOZCE_TOOLS_BIN_DIR);
+	$(CC) $(CFLAGS) -Fe$@ $(MOZCE_TOOLS_DIR)/arm-wince-as.c
 
-$(MOZCE_TOOLS_DIR)/arm-wince-gcc.exe:	$(MOZCE_TOOLS_DIR)/arm-wince-gcc.c $(MOZCE_TOOLS_DIR)/toolspath.h
-	$(CC) $(MOZCE_TOOLS_DIR)/arm-wince-gcc.c
-	mkdir -p bin;
-	cp arm-wince-gcc.exe bin; mv arm-wince-gcc.exe $(MOZCE_TOOLS_DIR); rm *.obj
+$(MOZCE_TOOLS_BIN_DIR)/arm-wince-gcc.exe:	$(MOZCE_TOOLS_DIR)/arm-wince-gcc.c $(MOZCE_TOOLS_DIR)/toolspath.h $(MOZCE_TOOLS_DIR)/Makefile
+	mkdir -p $(MOZCE_TOOLS_BIN_DIR);
+	$(CC) $(CFLAGS) -Fe$@ $(MOZCE_TOOLS_DIR)/arm-wince-gcc.c
 
-$(MOZCE_TOOLS_DIR)/arm-wince-lib.exe:	$(MOZCE_TOOLS_DIR)/arm-wince-lib.c $(MOZCE_TOOLS_DIR)/toolspath.h
-	$(CC) $(MOZCE_TOOLS_DIR)/arm-wince-lib.c
-	mkdir -p bin;
-	cp arm-wince-lib.exe bin; mv arm-wince-lib.exe $(MOZCE_TOOLS_DIR); rm *.obj
+$(MOZCE_TOOLS_BIN_DIR)/arm-wince-lib.exe:	$(MOZCE_TOOLS_DIR)/arm-wince-lib.c $(MOZCE_TOOLS_DIR)/toolspath.h $(MOZCE_TOOLS_DIR)/Makefile
+	mkdir -p $(MOZCE_TOOLS_BIN_DIR);
+	$(CC) $(CFLAGS) -Fe$@ $(MOZCE_TOOLS_DIR)/arm-wince-lib.c
 
-$(MOZCE_TOOLS_DIR)/arm-wince-link.exe:	$(MOZCE_TOOLS_DIR)/arm-wince-link.c $(MOZCE_TOOLS_DIR)/toolspath.h
-	$(CC) $(MOZCE_TOOLS_DIR)/arm-wince-link.c
-	mkdir -p bin;
-	cp arm-wince-link.exe bin; mv arm-wince-link.exe $(MOZCE_TOOLS_DIR); rm *.obj
+$(MOZCE_TOOLS_BIN_DIR)/arm-wince-link.exe:	$(MOZCE_TOOLS_DIR)/arm-wince-link.c $(MOZCE_TOOLS_DIR)/toolspath.h $(MOZCE_TOOLS_DIR)/Makefile
+	mkdir -p $(MOZCE_TOOLS_BIN_DIR);
+	$(CC) $(CFLAGS) -Fe$@ $(MOZCE_TOOLS_DIR)/arm-wince-link.c
 
-$(MOZCE_TOOLS_DIR)/arm-wince-res.exe:	$(MOZCE_TOOLS_DIR)/arm-wince-res.c $(MOZCE_TOOLS_DIR)/toolspath.h
-	$(CC) $(MOZCE_TOOLS_DIR)/arm-wince-res.c
-	mkdir -p bin;
-	cp arm-wince-res.exe bin; mv arm-wince-res.exe $(MOZCE_TOOLS_DIR); rm *.obj
+$(MOZCE_TOOLS_BIN_DIR)/arm-wince-res.exe:	$(MOZCE_TOOLS_DIR)/arm-wince-res.c $(MOZCE_TOOLS_DIR)/toolspath.h $(MOZCE_TOOLS_DIR)/Makefile
+	mkdir -p $(MOZCE_TOOLS_BIN_DIR);
+	$(CC) $(CFLAGS) -Fe$@ $(MOZCE_TOOLS_DIR)/arm-wince-res.c
 
new file mode 100644
--- /dev/null
+++ b/build/wince/tools/Makefile.in
@@ -0,0 +1,53 @@
+# ***** BEGIN LICENSE BLOCK *****
+# Version: MPL 1.1/GPL 2.0/LGPL 2.1
+#
+# The contents of this file are subject to the Mozilla Public License Version
+# 1.1 (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+# http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+# for the specific language governing rights and limitations under the
+# License.
+#
+# The Original Code is Mozilla core build scripts.
+#
+# The Initial Developer of the Original Code is
+# Brad Lassey <blassey@mozilla.com>
+#
+# Portions created by the Initial Developer are Copyright (C) 2005
+# the Mozilla Foundation <http://www.mozilla.org/>. All Rights Reserved.
+#
+# Contributor(s): 
+#
+# Alternatively, the contents of this file may be used under the terms of
+# either the GNU General Public License Version 2 or later (the "GPL"), or
+# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+# in which case the provisions of the GPL or the LGPL are applicable instead
+# of those above. If you wish to allow use of your version of this file only
+# under the terms of either the GPL or the LGPL, and not to allow others to
+# use your version of this file under the terms of the MPL, indicate your
+# decision by deleting the provisions above and replace them with the notice
+# and other provisions required by the GPL or the LGPL. If you do not delete
+# the provisions above, a recipient may use your version of this file under
+# the terms of any one of the MPL, the GPL or the LGPL.
+#
+# ***** END LICENSE BLOCK *****
+
+DEPTH = ../../..
+topsrcdir = @top_srcdir@
+srcdir = @srcdir@
+VPATH = @srcdir@
+
+
+TOPSRCDIR = $(topsrcdir)
+OBJDIR = $(shell cd $(DEPTH); pwd -W)
+
+include $(DEPTH)/config/autoconf.mk
+
+include $(topsrcdir)/build/wince/tools/Makefile
+
+export::
+
+tools::
\ No newline at end of file
rename from build/wince/tools/vs9ppc2003arm/arm-wince-as.c
rename to build/wince/tools/arm-wince-as.c
--- a/build/wince/tools/vs9ppc2003arm/arm-wince-as.c
+++ b/build/wince/tools/arm-wince-as.c
@@ -6,12 +6,10 @@ main(int argc, char **argv)
   char* args[1000];
   int i = 0;
   
   args[i++] = ASM_PATH;
   args[i++] = "-I\"" WCE_INC "\""; 
 
   i += argpath_conv(&argv[1], &args[i]);
 
-  dumpargs(args);
-
   return run(args);
 }
rename from build/wince/tools/vs9ppc2003arm/arm-wince-gcc.c
rename to build/wince/tools/arm-wince-gcc.c
--- a/build/wince/tools/vs9ppc2003arm/arm-wince-gcc.c
+++ b/build/wince/tools/arm-wince-gcc.c
@@ -1,36 +1,36 @@
+
 #include "toolspath.h"
 
 int
 main(int argc, char **argv)
 {
   int startOfArgvs;
   int i = 0;
   int j = 0;
   int link = 0;
 
   char* args[1000];
   char  outputFileArg[1000];
 
   args[i++] = CL_PATH;
-  args[i++] = "/I\"" WCE_INC "\"";
   args[i++] = "/I\"" SHUNT_INC "\"";
   args[i++] = "/FI\"mozce_shunt.h\"";
 
   args[i++] = "/DMOZCE_STATIC_BUILD";
   args[i++] = "/DUNICODE";
   args[i++] = "/D_UNICODE_";
   args[i++] = "/DARM";
   args[i++] = "/D_ARM_";
   args[i++] = "/DWINCE";
   args[i++] = "/D_WIN32_WCE=0x502";
   args[i++] = "/DUNDER_CE";
-  args[i++] = "/DWIN32_PLATFORM_WFSP";
-//  args[i++] = "/DWIN32_PLATFORM_PSPC";
+//  args[i++] = "/DWIN32_PLATFORM_WFSP";
+  args[i++] = "/DWIN32_PLATFORM_PSPC";
 //  args[i++] = "/DPOCKETPC2003_UI_MODEL";
   args[i++] = "/D_WINDOWS";
   args[i++] = "/DNO_ERRNO";
 
   args[i++] = "/Zc:wchar_t-";          //
   args[i++] = "/GS-";                  // disable security checks
   args[i++] = "/GR-";                  // disable C++ RTTI
   args[i++] = "/fp:fast";
@@ -76,18 +76,18 @@ main(int argc, char **argv)
       args[i++] = "/LIBPATH:\"" WCE_CRT "\"";
       args[i++] = "/LIBPATH:\"" SHUNT_LIB "\"";
       args[i++] = "mozce_shunt.lib";
       args[i++] = "winsock.lib";
       args[i++] = "corelibc.lib";
       args[i++] = "coredll.lib";
 
 
-      args[i++] = "/NODEFAULTLIB:LIBC";
+      //args[i++] = "/NODEFAULTLIB:LIBC";
       args[i++] = "/NODEFAULTLIB:OLDNAMES";
 
     }
 
   args[i] = NULL;
 
-  dumpargs(args);
+  //  dumpargs(args);
   return run(args);
 }
rename from build/wince/tools/vs9ppc2003arm/arm-wince-lib.c
rename to build/wince/tools/arm-wince-lib.c
rename from build/wince/tools/vs9ppc2003arm/arm-wince-link.c
rename to build/wince/tools/arm-wince-link.c
--- a/build/wince/tools/vs9ppc2003arm/arm-wince-link.c
+++ b/build/wince/tools/arm-wince-link.c
@@ -51,12 +51,12 @@ main(int argc, char **argv)
     args[i++] = "/ENTRY:main";
 
   if (s==0){
     args[i++] = "/subsystem:\"WINDOWSCE,5.02\"";
   }
 
   argpath_conv(&argv[1], &args[i]);
 
-  dumpargs(args);
+  //  dumpargs(args);
 
   return run(args);
 }
rename from build/wince/tools/vs9ppc2003arm/arm-wince-res.c
rename to build/wince/tools/arm-wince-res.c
--- a/build/wince/tools/vs9ppc2003arm/arm-wince-res.c
+++ b/build/wince/tools/arm-wince-res.c
@@ -5,16 +5,17 @@ main(int argc, char **argv)
 {
   int iRetVal;
   char* args[1000];
   int i = 0;
   int j = 0;
   int k = 0;
   int s = 0;
   args[i++] = RC_PATH;
-  //  args[i++] = "/I\"" WCE_RC_INC "\"";
+  args[i++] = "/I\"" WCE_RC_INC "\"";
+  args[i++] = "/I\"" WM_SDK_INC  "\"";
 
   argpath_conv(&argv[1], &args[i]);
 
-  dumpargs(args);
+  //  dumpargs(args);
 
   return run(args);
 }
rename from build/wince/tools/vs9ppc2003arm/toolspath.h
rename to build/wince/tools/toolspath.h
--- a/build/wince/tools/vs9ppc2003arm/toolspath.h
+++ b/build/wince/tools/toolspath.h
@@ -1,26 +1,27 @@
 #include <windows.h>
 #include <stdio.h>
 #include <process.h>
 
-#ifndef TOPSRCDIR
-#include "../topsrcdir.h"
+#define WCE_BIN    VC_PATH "ce\\bin\\x86_arm\\"
+#define WCE_RC_BIN WIN_SDK_PATH  "bin\\"
+#define WCE_CRT    VC_PATH "ce\\lib\\armv4i"
+#define WM_SDK_INC    WM_SDK_PATH "Include/Armv4i"
+#define WCE_LIB    WM_SDK_PATH "Lib/Armv4i"
+#define WCE_RC_INC  VC_PATH "ce\\atlmfc\\include"
+#define WCE_INC  VC_PATH "ce\\include"
+
+#ifndef SHUNT_LIB
+#define SHUNT_LIB TOPSRCDIR "/build/wince/shunt/build/" MOZCE_DEVENV
 #endif
 
-#define WCE_BIN    "c:\\Program Files\\Microsoft Visual Studio 9.0\\VC\\ce\\bin\\x86_arm\\"
-#define WCE_RC_BIN "c:\\Program Files\\Microsoft SDKs\\Windows\\v6.0a\\bin\\"
-//#define WCE_RC_BIN "c:\\Program Files\\Microsoft Visual Studio 9.0\\VC\\bin\\"
-#define WCE_CRT    "c:\\Program Files\\Microsoft Visual Studio 9.0\\VC\\ce\\lib\\armv4i"
-#define WCE_INC    "c:\\Program Files\\Windows Mobile 6 SDK\\PocketPC\\Include\\Armv4i"
-#define WCE_LIB    "c:\\Program Files\\Windows Mobile 6 SDK\\PocketPC\\Lib\\Armv4i"
-#define WCE_RC_INC  "C:\\Program Files\\Microsoft Visual Studio 9.0\\VC\\ce\\atlmfc\\include"
-
-#define SHUNT_LIB TOPSRCDIR "/build/wince/shunt/build/vs9/"
+#ifndef SHUNT_INC
 #define SHUNT_INC TOPSRCDIR "/build/wince/shunt/include/"
+#endif
 
 #define ASM_PATH  WCE_BIN "armasm.exe"
 #define CL_PATH   WCE_BIN "cl.exe"
 #define LIB_PATH  WCE_BIN "lib.exe"
 #define LINK_PATH WCE_BIN "link.exe"
 #define RC_PATH   WCE_RC_BIN "rc.exe"
 
 #define MAX_NOLEAK_BUFFERS 1000
@@ -226,18 +227,18 @@ DWORD run(char** args)
  int i, j;
 
 
  // Clear any link env variable that might get us tangled up
  _putenv("LINK=");
  _putenv("LIBPATH=");
  _putenv("CC=");
 
- _putenv("INCLUDE=" WCE_INC);
- _putenv("LIB=" WCE_LIB);
+ _putenv("INCLUDE=" SHUNT_INC ";" WM_SDK_INC ";" WCE_INC);
+ _putenv("LIB=" WCE_LIB ";" WCE_CRT);
 
  for (j=1; args[j]; j++)
  {
    int len = strlen(args[j]);
    strcat(&theArgs[totalLen], args[j]);
    totalLen += len;
 
    strcat(&theArgs[totalLen], " ");
deleted file mode 100644
--- a/build/wince/tools/vs8ppc2003arm/arm-wince-as.c
+++ /dev/null
@@ -1,17 +0,0 @@
-#include "toolspath.h"
-
-int 
-main(int argc, char **argv)
-{  
-  char* args[1000];
-  int i = 0;
-  
-  args[i++] = ASM_PATH;
-  args[i++] = "-I\"" WCE_INC "\""; 
-
-  i += argpath_conv(&argv[1], &args[i]);
-
-  dumpargs(args);
-
-  return run(args);
-}
deleted file mode 100644
--- a/build/wince/tools/vs8ppc2003arm/arm-wince-gcc.c
+++ /dev/null
@@ -1,93 +0,0 @@
-#include "toolspath.h"
-
-int
-main(int argc, char **argv)
-{
-  int startOfArgvs;
-  int i = 0;
-  int j = 0;
-  int link = 0;
-
-  char* args[1000];
-  char  outputFileArg[1000];
-
-  args[i++] = CL_PATH;
-  args[i++] = "/I\"" WCE_INC "\"";
-  args[i++] = "/I\"" SHUNT_INC "\"";
-  args[i++] = "/FI\"mozce_shunt.h\"";
-
-  args[i++] = "/DMOZCE_STATIC_BUILD";
-  args[i++] = "/DUNICODE";
-  args[i++] = "/D_UNICODE_";
-  args[i++] = "/DARM";
-  args[i++] = "/D_ARM_";
-  args[i++] = "/DWINCE";
-  args[i++] = "/D_WIN32_WCE=0x502";
-  args[i++] = "/DUNDER_CE";
-  args[i++] = "/DWIN32_PLATFORM_WFSP";
-//  args[i++] = "/DWIN32_PLATFORM_PSPC";
-//  args[i++] = "/DPOCKETPC2003_UI_MODEL";
-  args[i++] = "/D_WINDOWS";
-  args[i++] = "/DNO_ERRNO";
-
-  args[i++] = "/Zc:wchar_t-";          //
-  args[i++] = "/GS-";                  // disable security checks
-  args[i++] = "/GR-";                  // disable C++ RTTI
-  args[i++] = "/fp:fast";
-
-  startOfArgvs = i;
-
-  i += argpath_conv(&argv[1], &args[i]);
-
-  // if /Fe is passed, then link
-  //
-  // if -o is passed, then blank out this argument, and place a "/Fo"
-  // before the next argument
-  while(argv[j])
-    {
-      if (strncmp(argv[j], "-o", 2) == 0)
-	{
-	  printf("%s is -o\n",argv[j]);
-
-
-	  link = strstr(args[startOfArgvs+j], ".obj") ? 0:1;
-
-
-	  // If we are outputting a .OBJ file, then we are
-	  // NOT linking, and we need to do some fancy
-	  // footwork to output "/FoFILENAME" as an argument
-	  args[startOfArgvs+j-1] = "";
-	  strcpy(outputFileArg, ( strstr(args[startOfArgvs+j], ".exe") )?"/Fe":"/Fo");
-	  strcat(outputFileArg, args[startOfArgvs+j]);
-	  args[startOfArgvs+j] = outputFileArg;
-	}
-      j++;
-    }
-
-  if (link)
-    {
-      args[i++] = "/link";
-
-      args[i++] = "/ENTRY:main";
-
-      args[i++] = "/SUBSYSTEM:WINDOWSCE,5.02";
-
-      args[i++] = "/LIBPATH:\"" WCE_LIB "\"";
-      args[i++] = "/LIBPATH:\"" WCE_CRT "\"";
-      args[i++] = "/LIBPATH:\"" SHUNT_LIB "\"";
-      args[i++] = "mozce_shunt.lib";
-      args[i++] = "winsock.lib";
-      args[i++] = "corelibc.lib";
-      args[i++] = "coredll.lib";
-
-
-      args[i++] = "/NODEFAULTLIB:LIBC";
-      args[i++] = "/NODEFAULTLIB:OLDNAMES";
-
-    }
-
-  args[i] = NULL;
-
-  dumpargs(args);
-  return run(args);
-}
deleted file mode 100644
--- a/build/wince/tools/vs8ppc2003arm/arm-wince-lib.c
+++ /dev/null
@@ -1,16 +0,0 @@
-#include "toolspath.h"
-
-
-int 
-main(int argc, char **argv)
-{
-  char* args[1000];
-  int i = 0;
-
-  args[i++] = LIB_PATH;
-
-  argpath_conv(&argv[1], &args[i]);
-
-  return run(args);
-
-}
deleted file mode 100644
--- a/build/wince/tools/vs8ppc2003arm/arm-wince-link.c
+++ /dev/null
@@ -1,62 +0,0 @@
-#include "toolspath.h"
-
-int
-main(int argc, char **argv)
-{
-  int iRetVal;
-  char* args[1000];
-  int i = 0;
-  int j = 0;
-  int k = 0;
-  int s = 0;
-  args[i++] = LINK_PATH;
-
-  args[i++] = "/LIBPATH:\"" WCE_LIB "\"";
-  args[i++] = "/LIBPATH:\"" WCE_CRT "\"";
-  args[i++] = "/LIBPATH:\"" SHUNT_LIB "\"";
-
-  args[i++] = "corelibc.lib";
-  args[i++] = "coredll.lib";
-  args[i++] = "ceshell.lib";
-  args[i++] = "mmtimer.lib";
-  args[i++] = "mozce_shunt.lib";
-
-  args[i++] = "/NODEFAULTLIB:LIBC";
-  args[i++] = "/NODEFAULTLIB:OLDNAMES";
-  args[i++] = "/NODEFAULTLIB:MSVCRT";
-
-  // if -DLL is not passed, then change the entry to 'main'
-  while(argv[j]) {
-
-      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;
-      }
-      j++;
-  }
-  
-  if (k==0)
-    args[i++] = "/ENTRY:main";
-  
-  if (s==0){
-    args[i++] = "/subsystem:\"WINDOWSCE,5.02\"";
-  }
-
-  argpath_conv(&argv[1], &args[i]);
-
-  dumpargs(args);
-
-  return run(args);
-}
deleted file mode 100644
--- a/build/wince/tools/vs8ppc2003arm/arm-wince-res.c
+++ /dev/null
@@ -1,19 +0,0 @@
-#include "toolspath.h"
-
-int
-main(int argc, char **argv)
-{
-  int iRetVal;
-  char* args[1000];
-  int i = 0;
-  int j = 0;
-  int k = 0;
-  int s = 0;
-  args[i++] = RC_PATH;
-
-  argpath_conv(&argv[1], &args[i]);
-
-  dumpargs(args);
-
-  return run(args);
-}
deleted file mode 100755
--- a/build/wince/tools/vs8ppc2003arm/build_tools.bat
+++ /dev/null
@@ -1,18 +0,0 @@
-REM rm arm-wince-as.exe
-REM rm arm-wince-gcc.exe
-REM rm arm-wince-lib.exe
-REM rm arm-wince-link.exe
-
-rm *.obj
-rm *.ilk
-rm *.pdb
-
-cl arm-wince-as.c 
-cl arm-wince-gcc.c
-cl arm-wince-lib.c
-cl arm-wince-link.c 
-cl arm-wince-res.c
-   
-rm *.obj
-rm *.ilk
-rm *.pdb
deleted file mode 100644
--- a/build/wince/tools/vs8ppc2003arm/toolspath.h
+++ /dev/null
@@ -1,278 +0,0 @@
-#include <windows.h>
-#include <stdio.h>
-#include <process.h>
-
-#ifndef TOPSRCDIR
-#include "../topsrcdir.h"
-#endif
-
-#define WCE_BIN   "c:\\Program Files\\Microsoft Visual Studio 8\\VC\\ce\\bin\\x86_arm\\"
-#define WCE_CRT   "c:\\Program Files\\Microsoft Visual Studio 8\\VC\\ce\\lib\\armv4i"
-#define WCE_INC   "c:\\Program Files\\Windows Mobile 6 SDK\\PocketPC\\Include\\Armv4i"
-#define WCE_LIB   "c:\\Program Files\\Windows Mobile 6 SDK\\PocketPC\\Lib\\Armv4i"
-
-//#define WCE_RC_BIN "c:\\Program Files\\Microsoft Visual Studio 8\\VC\\bin\\"
-#define WCE_RC_BIN "c:\\Program Files\\Microsoft SDKs\\Windows\\v6.0\\bin\\"
-
-#define SHUNT_LIB TOPSRCDIR "/build/wince/shunt/build/vs8/"
-#define SHUNT_INC TOPSRCDIR "/build/wince/shunt/include/"
-
-#define ASM_PATH  WCE_BIN "armasm.exe"
-#define CL_PATH   WCE_BIN "cl.exe"
-#define LIB_PATH  WCE_BIN "lib.exe"
-#define LINK_PATH WCE_BIN "link.exe"
-#define RC_PATH   WCE_RC_BIN "rc.exe"
-
-#define MAX_NOLEAK_BUFFERS 1000
-char noleak_buffers[MAX_NOLEAK_BUFFERS][1024];
-static int next_buffer = 0;
-
-int argpath_conv(char **args_in, char **args_out)
-{
-  int i = 0;
-
-  while (args_in[i])
-  {
-    char *offset;
-
-    args_out[i] = args_in[i];
-
-    if (args_in[i])
-    {
-      // First, look for the case of "-Fo/c/xxxxxxx" and "/Fo/c/xxxxx"
-      if ( (args_out[i][0] == '-' || args_out[i][0] == '/') &&
-           (args_out[i][1] == 'F') && (args_out[i][2] == 'o') &&
-           (args_out[i][3] == '/') && (strlen(args_out[i]) > 5) ) {
-
-        //printf("ARGS_IN: -FoXXXX is %s\n",args_in[i]);
-
-        strcpy(noleak_buffers[next_buffer], args_in[i]);
-
-        noleak_buffers[next_buffer][0] = '/';
-        noleak_buffers[next_buffer][3] = noleak_buffers[next_buffer][4];
-        noleak_buffers[next_buffer][4] = ':';
-
-        args_out[i] = noleak_buffers[next_buffer];
-
-        //printf("ARGS_OUT: -FoXXXX is %s\n",args_out[i]);
-
-        next_buffer++;
-      }
-      else if ((args_out[i][0] == '/') && (args_out[i][2] == '/'))
-      {
-        // Assume this is a pathname, and adjust accordingly
-        //printf("ARGS_IN: PATHNAME ASSUMED: %s\n", args_in[i]);
-
-        strcpy(noleak_buffers[next_buffer], args_in[i]);
-
-        noleak_buffers[next_buffer][0] = noleak_buffers[next_buffer][1];
-        noleak_buffers[next_buffer][1] = ':';
-
-        args_out[i] = noleak_buffers[next_buffer];
-        //printf("ARGS_OUT: PATHNAME MODIFIED TO BE: %s\n", args_out[i]);
-
-        next_buffer++;
-      }
-      else if ((args_out[i][0] == '\\') && (args_out[i][2] == '\\'))
-      {
-        // Assume this is a pathname, and adjust accordingly
-        //printf("ARGS_IN: PATHNAME ASSUMED: %s\n", args_in[i]);
-
-        strcpy(noleak_buffers[next_buffer], args_in[i]);
-
-        noleak_buffers[next_buffer][0] = noleak_buffers[next_buffer][1];
-        noleak_buffers[next_buffer][1] = ':';
-
-        args_out[i] = noleak_buffers[next_buffer];
-        //printf("ARGS_OUT: PATHNAME MODIFIED TO BE: %s\n", args_out[i]);
-
-        next_buffer++;
-      }
-      else if ((args_out[i][0] == '\\') && (args_out[i][1] == '\\') &&
-               (args_out[i][3] == '\\') && (args_out[i][4] == '\\'))
-      {
-        // Assume this is a pathname, and adjust accordingly
-        //printf("ARGS_IN: PATHNAME ASSUMED: %s\n", args_in[i]);
-
-        noleak_buffers[next_buffer][0] = args_in[i][2];
-        noleak_buffers[next_buffer][1] = ':';
-        noleak_buffers[next_buffer][2] = '\0';
-
-        strcpy(noleak_buffers[next_buffer], &args_in[i][3]);
-
-        args_out[i] = noleak_buffers[next_buffer];
-        //printf("ARGS_OUT: PATHNAME MODIFIED TO BE: %s\n", args_out[i]);
-
-        next_buffer++;
-      }
-      else if ( strstr(args_out[i], "OUT:") || strstr(args_out[i], "DEF:") )
-      {
-        // Deal with -OUT:/c/....
-        //
-        // NOTE: THERE IS A BUG IN THIS IMPLEMENTATION IF
-        //       THERE IS A SPACE IN THE TOPSRCDIR PATH.
-        //
-        // Should really check for spaces, then double-quote
-        // the path if any space is found.
-        // -- wolfe@lobo.us  25-Aug-08
-        if ((args_out[i][5] == '/') && (args_out[i][7] == '/'))
-        {
-          // Assume this is a pathname, and adjust accordingly
-          //printf("ARGS_IN: PATHNAME ASSUMED: %s\n", args_in[i]);
-
-          strcpy(noleak_buffers[next_buffer], args_in[i]);
-
-          noleak_buffers[next_buffer][5] = noleak_buffers[next_buffer][6];
-          noleak_buffers[next_buffer][6] = ':';
-
-          args_out[i] = noleak_buffers[next_buffer];
-          //printf("ARGS_OUT: PATHNAME MODIFIED TO BE: %s\n", args_out[i]);
-        }
-        // Deal with -OUT:"/c/...."
-        else if ((args_out[i][6] == '/') && (args_out[i][8] == '/'))
-        {
-          // Assume this is a pathname, and adjust accordingly
-          //printf("ARGS_IN: PATHNAME ASSUMED: %s\n", args_in[i]);
-
-          strcpy(noleak_buffers[next_buffer], args_in[i]);
-
-          noleak_buffers[next_buffer][6] = noleak_buffers[next_buffer][7];
-          noleak_buffers[next_buffer][7] = ':';
-
-          args_out[i] = noleak_buffers[next_buffer];
-          //printf("ARGS_OUT: PATHNAME MODIFIED TO BE: %s\n", args_out[i]);
-        }
-
-        next_buffer++;
-      }
-      else
-      {
-        char *offset = strstr(args_out[i], "/cygdrive/");
-
-        if (offset) {
-
-          strcpy(offset, offset+9);
-          offset[0] = offset[1];
-          offset[1] = ':';
-          offset[2] = '/';
-        }
-
-        if ( (args_out[i][0] == '-' || args_out[i][0] == '/') &&
-             (args_out[i][1] == 'D'))
-        {
-
-          offset = strstr(args_out[i]+2, "=");
-          if (offset)
-          {
-            char* equalsChar = offset;
-
-            if (equalsChar[1] == '"')
-            {
-              *equalsChar = '\0';
-
-              strcpy(noleak_buffers[next_buffer], args_out[i]);
-
-              *equalsChar = '=';
-
-              strcat(noleak_buffers[next_buffer], "=\\\"");
-              strcat(noleak_buffers[next_buffer], equalsChar+1);
-              strcat(noleak_buffers[next_buffer], "\\\"");
-
-              args_out[i] = noleak_buffers[next_buffer];
-
-              next_buffer++;
-            }
-          }
-        }
-      }
-
-      if (next_buffer > MAX_NOLEAK_BUFFERS) {
-        printf("OOPS - next_buffer > MAX_NOLEAK_BUFFERS\n");
-        exit(-1);
-      }
-    }
-    i++;
-  }
-  args_out[i] = NULL;
-  return i;
-}
-
-void dumpargs(char** args)
-{
- int i = 0;
-
- if (args[0] == NULL)
-   printf(":: first element is null!\n");
-
- while(args[i])
-   printf("%s ", args[i++]);
-
- printf("\n");
- fflush(stdout);
- fflush(stderr);
-}
-
-
-DWORD run(char** args)
-{
-
- DWORD exitCode;
- STARTUPINFO si;
- PROCESS_INFORMATION pi;
-
- char theArgs[1024*16];
-
- int totalLen = 0;
- int i, j;
-
-
- // Clear any link env variable that might get us tangled up
- _putenv("LINK=");
- _putenv("LIBPATH=");
- _putenv("CC=");
-
- _putenv("INCLUDE=" WCE_INC);
- _putenv("LIB=" WCE_LIB);
-
- for (j=1; args[j]; j++)
- {
-   int len = strlen(args[j]);
-   strcat(&theArgs[totalLen], args[j]);
-   totalLen += len;
-
-   strcat(&theArgs[totalLen], " ");
-   totalLen++;
- }
-
- i = strlen(args[0]);
- for (j=0; j<i; j++)
- {
-   if (args[0][j] == '/')
-     args[0][j] = '\\';
- }
-
- ZeroMemory( &si, sizeof(si) );
- si.cb = sizeof(si);
- ZeroMemory( &pi, sizeof(pi));
-
- CreateProcess(args[0],
-               theArgs,
-               NULL,
-               NULL,
-               0,
-               0,
-               NULL,
-               NULL,
-               &si,              // Pointer to STARTUPINFO structure.
-               &pi);
-
-
- // Wait until child process exits.
- WaitForSingleObject( pi.hProcess, INFINITE );
- GetExitCodeProcess(pi.hProcess, &exitCode);
- // Close process and thread handles.
- CloseHandle( pi.hProcess );
- CloseHandle( pi.hThread );
-
- return exitCode;
-}
--- a/config/autoconf.mk.in
+++ b/config/autoconf.mk.in
@@ -610,17 +610,17 @@ MOZ_PYTHON_VER_DOTTED = @MOZ_PYTHON_VER_
 MOZ_PYTHON_VER = @MOZ_PYTHON_VER@
 
 # Codesighs tools option, enables win32 mapfiles.
 MOZ_MAPINFO	= @MOZ_MAPINFO@
 
 MOZ_PHOENIX	= @MOZ_PHOENIX@
 MOZ_XULRUNNER	= @MOZ_XULRUNNER@
 WINCE		= @WINCE@
-WINCE_SDK      = @WINCE_SDK@
+WINCE_SDK_DIR      = @WINCE_SDK_DIR@
 
 MOZ_DISTRIBUTION_ID = @MOZ_DISTRIBUTION_ID@
 
 NS_OSSO 	= @NS_OSSO@
 MOZ_PLATFORM_HILDON = @MOZ_PLATFORM_HILDON@
 
 LIBHILDONMIME_CFLAGS	= @LIBHILDONMIME_CFLAGS@
 LIBHILDONMIME_LIBS	= @LIBHILDONMIME_LIBS@
--- a/configure.in
+++ b/configure.in
@@ -229,39 +229,42 @@ dnl ====================================
 
 if test "$COMPILE_ENVIRONMENT"; then
 
 dnl Do some special WinCE toolchain stuff
 case "$target" in
 *wince)
 
     MOZ_ARG_WITH_STRING(wince-sdk,
-    [  --with-wince-sdk=WINCE_SDK
+    [  --with-wince-sdk=WINCE_SDK_DIR
                         The path to the windows mobile sdk],
-    WINCE_SDK=$withval)
+    WINCE_SDK_DIR=$withval)
 
     export WINCE=1
-    mk_add_options WINCE=1
 
     echo -----------------------------------------------------------------------------
     echo Building Windows CE Shunt Library and Tool Chain
     echo Using SDK in:
-    echo $WINCE_SDK
+    echo $WINCE_SDK_DIR
 
     ac_exeext=.exe
 
-    
-    rm -f $srcdir/build/wince/shunt/include/windows.h
-
-    echo -n "#define TOPSRCDIR \"" > $srcdir/build/wince/tools/topsrcdir.h
-    echo `cd "$_topsrcdir" && pwd -W | tr '\n' '\"'` >> $srcdir/build/wince/tools/topsrcdir.h
-    make -C $srcdir/build/wince/tools
-    
-    echo "#include \"$WINCE_SDK/windows.h\"" > $srcdir/build/wince/shunt/include/windows.h
-    echo "#define GetProcAddress GetProcAddressA" >> $srcdir/build/wince/shunt/include/windows.h
+    _pwdw=`pwd -W`
+    _pwd=`pwd`
+    make WINCE_SDK_DIR="$WINCE_SDK_DIR" TOPSRCDIR="$srcdir" OBJDIR="$_pwdw" -C $srcdir/build/wince/tools
+
+    CC="$_pwd/dist/sdk/bin/arm-wince-gcc"
+    CXX="$_pwd/dist/sdk/bin/arm-wince-gcc"
+    CPP="$_pwd/dist/sdk/bin/arm-wince-gcc"
+    LD="$_pwd/dist/sdk/bin/arm-wince-link"
+    AR="$_pwd/dist/sdk/bin/arm-wince-lib"
+    AS="$_pwd/dist/sdk/bin/arm-wince-as"
+    RC="$_pwd/dist/sdk/bin/arm-wince-res"
+
+
     echo -----------------------------------------------------------------------------
 
     ;;
 esac
 
 if test -n "$CROSS_COMPILE" && test "$target" != "$host"; then
     echo "cross compiling from $host to $target"
     cross_compiling=yes
@@ -7891,17 +7894,17 @@ AC_SUBST(USE_DEPENDENT_LIBS)
 AC_SUBST(MOZ_BUILD_ROOT)
 AC_SUBST(MOZ_OS2_TOOLS)
 AC_SUBST(MOZ_OS2_USE_DECLSPEC)
 
 AC_SUBST(MOZ_POST_DSO_LIB_COMMAND)
 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
 AC_SUBST(MOZ_TIMELINE)
 AC_SUBST(WINCE)
-AC_SUBST(WINCE_SDK)
+AC_SUBST(WINCE_SDK_DIR)
 AC_SUBST(TARGET_DEVICE)
 
 AC_SUBST(MOZ_APP_NAME)
 AC_SUBST(MOZ_APP_DISPLAYNAME)
 AC_SUBST(MOZ_APP_VERSION)
 AC_SUBST(FIREFOX_VERSION)
 
 AC_SUBST(MOZ_PKG_SPECIAL)