Bug 862986 - Part 2a: Migrate PROGRAM from Makefile.in to moz.build. r=gps
authorBrian O'Keefe <bokeefe@alum.wpi.edu>
Wed, 01 May 2013 14:05:40 -0400
changeset 142375 557f1d26fb712722030373ff369d4dba8477260e
parent 142374 0726f9659154017357406dd03bf577ab0e2872b7
child 142376 65129bb743252da8a65d3100aae1b8fe9b370b4f
push id2579
push userakeybl@mozilla.com
push dateMon, 24 Jun 2013 18:52:47 +0000
treeherdermozilla-beta@b69b7de8a05a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgps
bugs862986
milestone23.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 862986 - Part 2a: Migrate PROGRAM from Makefile.in to moz.build. r=gps
b2g/app/Makefile.in
b2g/app/moz.build
b2g/gaia/Makefile.in
b2g/gaia/moz.build
browser/app/Makefile.in
browser/app/moz.build
browser/metro/shell/commandexecutehandler/Makefile.in
browser/metro/shell/commandexecutehandler/moz.build
browser/metro/shell/linktool/Makefile.in
browser/metro/shell/linktool/moz.build
browser/metro/shell/testing/Makefile.in
browser/metro/shell/testing/moz.build
build/win32/Makefile.in
build/win32/moz.build
dom/plugins/ipc/hangui/Makefile.in
dom/plugins/ipc/hangui/moz.build
embedding/tests/winEmbed/Makefile.in
embedding/tests/winEmbed/moz.build
intl/unicharutil/tools/Makefile.in
intl/unicharutil/tools/moz.build
ipc/app/Makefile.in
ipc/app/moz.build
ipc/ipdl/test/cxx/app/Makefile.in
ipc/ipdl/test/cxx/app/moz.build
js/src/gdb/Makefile.in
js/src/gdb/moz.build
js/src/jsapi-tests/Makefile.in
js/src/jsapi-tests/moz.build
js/src/shell/Makefile.in
js/src/shell/moz.build
js/xpconnect/shell/Makefile.in
js/xpconnect/shell/moz.build
mobile/android/app/Makefile.in
mobile/android/app/moz.build
modules/libmar/tool/Makefile.in
modules/libmar/tool/moz.build
netwerk/streamconv/test/Makefile.in
netwerk/streamconv/test/moz.build
python/mozbuild/mozbuild/backend/recursivemake.py
python/mozbuild/mozbuild/frontend/data.py
python/mozbuild/mozbuild/frontend/emitter.py
python/mozbuild/mozbuild/frontend/sandbox_symbols.py
python/mozbuild/mozbuild/test/frontend/data/program/moz.build
python/mozbuild/mozbuild/test/frontend/test_emitter.py
rdf/tests/rdfcat/Makefile.in
rdf/tests/rdfcat/moz.build
rdf/tests/rdfpoll/Makefile.in
rdf/tests/rdfpoll/moz.build
rdf/tests/triplescat/Makefile.in
rdf/tests/triplescat/moz.build
testing/mochitest/ssltunnel/Makefile.in
testing/mochitest/ssltunnel/moz.build
testing/tools/screenshot/Makefile.in
testing/tools/screenshot/moz.build
toolkit/components/maintenanceservice/Makefile.in
toolkit/components/maintenanceservice/moz.build
toolkit/crashreporter/client/Makefile.in
toolkit/crashreporter/client/moz.build
toolkit/mozapps/update/updater/Makefile.in
toolkit/mozapps/update/updater/moz.build
tools/jprof/Makefile.in
tools/jprof/moz.build
tools/trace-malloc/Makefile.in
tools/trace-malloc/moz.build
webapprt/gtk2/Makefile.in
webapprt/gtk2/moz.build
webapprt/mac/Makefile.in
webapprt/mac/moz.build
webapprt/win/Makefile.in
webapprt/win/moz.build
widget/xremoteclient/Makefile.in
widget/xremoteclient/moz.build
xulrunner/app/Makefile.in
xulrunner/app/moz.build
xulrunner/stub/Makefile.in
xulrunner/stub/moz.build
xulrunner/tools/redit/Makefile.in
xulrunner/tools/redit/moz.build
--- a/b2g/app/Makefile.in
+++ b/b2g/app/Makefile.in
@@ -13,21 +13,16 @@ include $(topsrcdir)/config/makefiles/rc
 
 PREF_JS_EXPORTS = $(srcdir)/b2g.js
 
 ifdef ENABLE_MARIONETTE
 DEFINES += -DENABLE_MARIONETTE=1
 endif
 
 ifndef LIBXUL_SDK
-ifneq ($(GAIADIR),)
-PROGRAM=$(MOZ_APP_NAME)-bin$(BIN_SUFFIX)
-else
-PROGRAM=$(MOZ_APP_NAME)$(BIN_SUFFIX)
-endif
 
 CPPSRCS = nsBrowserApp.cpp
 
 ifeq (gonk,$(MOZ_WIDGET_TOOLKIT))
 CPPSRCS += BootAnimation.cpp
 LIBS += \
   -lui \
   -lhardware_legacy \
--- a/b2g/app/moz.build
+++ b/b2g/app/moz.build
@@ -1,6 +1,11 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
+if not CONFIG['LIBXUL_SDK']:
+    if CONFIG['GAIADIR']:
+        PROGRAM = CONFIG['MOZ_APP_NAME'] + "-bin"
+    else:
+        PROGRAM = CONFIG['MOZ_APP_NAME']
--- a/b2g/gaia/Makefile.in
+++ b/b2g/gaia/Makefile.in
@@ -6,18 +6,16 @@ DEPTH     = @DEPTH@
 topsrcdir = @top_srcdir@
 srcdir    = @srcdir@
 VPATH     = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 GAIA_PATH := gaia/profile
 
-PROGRAM = $(MOZ_APP_NAME)$(BIN_SUFFIX)
-
 ifeq ($(OS_ARCH),WINNT)
 CPPSRCS = run-b2g.cpp
 DEFINES += \
   -DB2G_NAME=L\"$(MOZ_APP_NAME)-bin$(BIN_SUFFIX)\" \
   -DGAIA_PATH=L\"$(subst /,\\\\,$(GAIA_PATH))\" \
   $(NULL)
 GAIA_MAKE=make
 else # Non-windows machines use the same wrapper program
--- a/b2g/gaia/moz.build
+++ b/b2g/gaia/moz.build
@@ -1,6 +1,8 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
+PROGRAM = CONFIG['MOZ_APP_NAME']
+
--- a/browser/app/Makefile.in
+++ b/browser/app/Makefile.in
@@ -38,18 +38,16 @@ endif
 
 ifdef LIBXUL_SDK #{
 PREF_JS_EXPORTS += $(srcdir)/profile/channel-prefs.js
 DEFINES += -DLIBXUL_SDK
 endif #} LIBXUL_SDK
 
 # Build a binary bootstrapping with XRE_main
 
-PROGRAM = $(MOZ_APP_NAME)$(BIN_SUFFIX)
-
 CPPSRCS = nsBrowserApp.cpp
 
 LOCAL_INCLUDES += \
   -I$(topsrcdir)/toolkit/xre \
   -I$(topsrcdir)/xpcom/base \
   -I$(topsrcdir)/xpcom/build \
   -I$(DEPTH)/build \
   $(NULL)
--- a/browser/app/moz.build
+++ b/browser/app/moz.build
@@ -1,7 +1,10 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 DIRS += ['profile/extensions']
+
+PROGRAM = CONFIG['MOZ_APP_NAME']
+
--- a/browser/metro/shell/commandexecutehandler/Makefile.in
+++ b/browser/metro/shell/commandexecutehandler/Makefile.in
@@ -11,17 +11,16 @@ include $(DEPTH)/config/autoconf.mk
 
 NO_PROFILE_GUIDED_OPTIMIZE = 1
 
 include $(topsrcdir)/config/config.mk
 
 # We want this exe in dist/bin
 DIST_SUBDIR =
 
-PROGRAM = CommandExecuteHandler$(BIN_SUFFIX)
 DIST_PROGRAM = CommandExecuteHandler$(BIN_SUFFIX)
 
 # Don't link against mozglue.dll
 MOZ_GLUE_LDFLAGS =
 MOZ_GLUE_PROGRAM_LDFLAGS =
 
 CPPSRCS	= \
 	CommandExecuteHandler.cpp \
--- a/browser/metro/shell/commandexecutehandler/moz.build
+++ b/browser/metro/shell/commandexecutehandler/moz.build
@@ -1,6 +1,7 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
+PROGRAM = 'CommandExecuteHandler'
--- a/browser/metro/shell/linktool/Makefile.in
+++ b/browser/metro/shell/linktool/Makefile.in
@@ -10,18 +10,16 @@ VPATH      = @srcdir@
 include $(DEPTH)/config/autoconf.mk
 
 NO_PROFILE_GUIDED_OPTIMIZE = 1
 
 include $(topsrcdir)/config/config.mk
 
 DIST_SUBDIR = metro/install
 
-PROGRAM = linktool$(BIN_SUFFIX)
-
 CPPSRCS    = linktool.cpp
 
 OS_LIBS = \
 	kernel32.lib \
 	user32.lib \
 	ole32.lib \
 	shlwapi.lib \
 	shell32.lib \
--- a/browser/metro/shell/linktool/moz.build
+++ b/browser/metro/shell/linktool/moz.build
@@ -1,6 +1,8 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
+PROGRAM = 'linktool'
+
--- a/browser/metro/shell/testing/Makefile.in
+++ b/browser/metro/shell/testing/Makefile.in
@@ -18,18 +18,16 @@ MOZ_GLUE_PROGRAM_LDFLAGS =
 
 NO_PROFILE_GUIDED_OPTIMIZE = 1
 
 include $(topsrcdir)/config/config.mk
 
 # We want this exe in dist/bin
 DIST_SUBDIR =
 
-PROGRAM = metrotestharness$(BIN_SUFFIX)
-
 CPPSRCS	= \
 	metrotestharness.cpp \
 	$(NULL)
 
 OS_LIBS = \
 	kernel32.lib \
 	user32.lib \
 	ole32.lib \
--- a/browser/metro/shell/testing/moz.build
+++ b/browser/metro/shell/testing/moz.build
@@ -1,6 +1,8 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
+PROGRAM = 'metrotestharness'
+
--- a/build/win32/Makefile.in
+++ b/build/win32/Makefile.in
@@ -8,17 +8,16 @@ srcdir    = @srcdir@
 VPATH     = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 NO_PROFILE_GUIDED_OPTIMIZE = 1
 
 ifdef ENABLE_TESTS
 
-PROGRAM = crashinject$(BIN_SUFFIX)
 USE_STATIC_LIBS = 1
 CPPSRCS = crashinject.cpp
 
 endif # ENABLE_TESTS
 
 MOZ_GLUE_LDFLAGS =
 
 include $(topsrcdir)/config/rules.mk
--- a/build/win32/moz.build
+++ b/build/win32/moz.build
@@ -4,8 +4,10 @@
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 if CONFIG['_MSC_VER'] and CONFIG['OS_TEST'] != 'x86_64':
     TEST_DIRS += ['vmwarerecordinghelper']
 
 TEST_DIRS += ['crashinjectdll']
 
+if CONFIG['ENABLE_TESTS']:
+    PROGRAM = 'crashinject'
--- a/dom/plugins/ipc/hangui/Makefile.in
+++ b/dom/plugins/ipc/hangui/Makefile.in
@@ -10,18 +10,16 @@ FAIL_ON_WARNINGS := 1
 
 include $(DEPTH)/config/autoconf.mk
 
 CPPSRCS = \
   MiniShmChild.cpp \
   PluginHangUIChild.cpp \
   $(NULL)
 
-PROGRAM = plugin-hang-ui$(BIN_SUFFIX)
-
 OS_LIBS = $(call EXPAND_LIBNAME,comctl32)
 
 RCINCLUDE = HangUIDlg.rc
 
 include $(topsrcdir)/config/config.mk
 
 DEFINES += \
   -DNS_NO_XPCOM \
--- a/dom/plugins/ipc/hangui/moz.build
+++ b/dom/plugins/ipc/hangui/moz.build
@@ -1,6 +1,8 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
+PROGRAM = 'plugin-hang-ui'
+
--- a/embedding/tests/winEmbed/Makefile.in
+++ b/embedding/tests/winEmbed/Makefile.in
@@ -31,17 +31,16 @@ DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 XPI_NAME	= winembed
 
-PROGRAM		= winEmbed$(BIN_SUFFIX)
 RESFILE		= winEmbed.res
 
 CPPSRCS		= \
 		winEmbed.cpp \
 		WebBrowserChrome.cpp \
 		WindowCreator.cpp \
 		$(NULL)
 
--- a/embedding/tests/winEmbed/moz.build
+++ b/embedding/tests/winEmbed/moz.build
@@ -1,8 +1,10 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 MODULE = 'winEmbed'
 
+PROGRAM = 'winEmbed'
+
--- a/intl/unicharutil/tools/Makefile.in
+++ b/intl/unicharutil/tools/Makefile.in
@@ -5,18 +5,16 @@
 
 DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
-PROGRAM		= ucgendat
-
 CSRCS		= ucgendat.c
 
 # XXX need configure test
 EX_LIBS		= $(shell $(GLIB_CONFIG) --libs)
 
 include $(topsrcdir)/config/rules.mk
 
 # XXX replace with proper configure test for glib
--- a/intl/unicharutil/tools/moz.build
+++ b/intl/unicharutil/tools/moz.build
@@ -1,8 +1,10 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 MODULE = 'ucgendat'
 
+PROGRAM = 'ucgendat'
+
--- a/ipc/app/Makefile.in
+++ b/ipc/app/Makefile.in
@@ -4,18 +4,16 @@
 
 DEPTH     = @DEPTH@
 topsrcdir = @top_srcdir@
 srcdir    = @srcdir@
 VPATH     = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
-PROGRAM = $(MOZ_CHILD_PROCESS_NAME)
-
 ifneq ($(dir $(PROGRAM)),./)
   GENERATED_DIRS = $(dir $(PROGRAM))
 endif
 
 CPPSRCS = \
   MozillaRuntimeMain.cpp \
   $(NULL)
 
--- a/ipc/app/moz.build
+++ b/ipc/app/moz.build
@@ -1,8 +1,10 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 MODULE = 'ipc'
 
+PROGRAM = CONFIG['MOZ_CHILD_PROCESS_NAME']
+
--- a/ipc/ipdl/test/cxx/app/Makefile.in
+++ b/ipc/ipdl/test/cxx/app/Makefile.in
@@ -4,18 +4,16 @@
 
 DEPTH = @DEPTH@
 topsrcdir = @top_srcdir@
 srcdir = @srcdir@
 VPATH = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
-PROGRAM = $(MODULE)$(BIN_SUFFIX)
-
 NSDISTMODE = copy
 
 LOCAL_INCLUDES += -I$(topsrcdir)/toolkit/xre
 LOCAL_INCLUDES += -I$(topsrcdir)/xpcom/base
 
 CPPSRCS = \
   TestIPDL.cpp \
   $(NULL)
--- a/ipc/ipdl/test/cxx/app/moz.build
+++ b/ipc/ipdl/test/cxx/app/moz.build
@@ -1,8 +1,10 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 MODULE = 'ipdlunittest'
 
+PROGRAM = 'ipdlunittest'
+
--- a/js/src/gdb/Makefile.in
+++ b/js/src/gdb/Makefile.in
@@ -6,17 +6,16 @@
 
 DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@ @srcdir@/tests
 
 include $(DEPTH)/config/autoconf.mk
 
-PROGRAM = gdb-tests$(BIN_SUFFIX)
 CPPSRCS =					\
   gdb-tests.cpp					\
   test-jsid.cpp					\
   test-JSString.cpp				\
   test-JSObject.cpp				\
   test-jsval.cpp				\
   test-prettyprinters.cpp			\
   test-Root.cpp					\
--- a/js/src/gdb/moz.build
+++ b/js/src/gdb/moz.build
@@ -1,6 +1,8 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
+PROGRAM = 'gdb-tests'
+
--- a/js/src/jsapi-tests/Makefile.in
+++ b/js/src/jsapi-tests/Makefile.in
@@ -6,18 +6,16 @@
 
 DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
-PROGRAM         = jsapi-tests$(BIN_SUFFIX)
-
 CPPSRCS = \
   tests.cpp \
   selfTest.cpp \
   testAddPropertyPropcache.cpp \
   testArrayBuffer.cpp \
   testArgumentsObject.cpp \
   testBindCallable.cpp \
   testBug604087.cpp \
--- a/js/src/jsapi-tests/moz.build
+++ b/js/src/jsapi-tests/moz.build
@@ -1,6 +1,8 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
+PROGRAM = 'jsapi-tests'
+
--- a/js/src/shell/Makefile.in
+++ b/js/src/shell/Makefile.in
@@ -6,17 +6,16 @@
 
 DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
-PROGRAM         = $(JS_SHELL_NAME)$(BIN_SUFFIX)
 CPPSRCS		= \
   js.cpp \
   jsoptparse.cpp \
   jsheaptools.cpp \
   $(NULL)
 
 ifdef _MSC_VER
 # unnecessary PGO for js shell.  But gcc cannot turn off pgo because it is
--- a/js/src/shell/moz.build
+++ b/js/src/shell/moz.build
@@ -1,6 +1,8 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
+PROGRAM = CONFIG['JS_SHELL_NAME']
+
--- a/js/xpconnect/shell/Makefile.in
+++ b/js/xpconnect/shell/Makefile.in
@@ -5,17 +5,16 @@
 
 DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
-PROGRAM		= xpcshell$(BIN_SUFFIX)
 SDK_BINARY	= $(PROGRAM)
 
 CPPSRCS		= xpcshell.cpp
 
 LOCAL_INCLUDES += \
   -I$(topsrcdir)/toolkit/xre \
   $(NULL)
 
--- a/js/xpconnect/shell/moz.build
+++ b/js/xpconnect/shell/moz.build
@@ -1,8 +1,10 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 MODULE = 'xpcshell'
 
+PROGRAM = 'xpcshell'
+
--- a/mobile/android/app/Makefile.in
+++ b/mobile/android/app/Makefile.in
@@ -11,17 +11,16 @@ include $(DEPTH)/config/autoconf.mk
 
 dist_dest = $(DIST)/$(APP_NAME).app
 
 PREF_JS_EXPORTS = $(srcdir)/mobile.js
 DIST_FILES = recommended-addons.json
 
 ifndef LIBXUL_SDK
 ifneq (Android,$(OS_TARGET))
-PROGRAM=$(MOZ_APP_NAME)$(BIN_SUFFIX)
 
 LOCAL_INCLUDES += -I$(topsrcdir)/toolkit/xre
 LOCAL_INCLUDES += -I$(topsrcdir)/xpcom/base
 LOCAL_INCLUDES += -I$(topsrcdir)/xpcom/build
 LOCAL_INCLUDES += -I$(DEPTH)/build
 
 DEFINES += -DXPCOM_GLUE
 STL_FLAGS=
--- a/mobile/android/app/moz.build
+++ b/mobile/android/app/moz.build
@@ -1,6 +1,9 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
+if not CONFIG['LIBXUL_SDK']:
+    if CONFIG['OS_TARGET'] != 'Android':
+        PROGRAM = CONFIG['MOZ_APP_NAME']
--- a/modules/libmar/tool/Makefile.in
+++ b/modules/libmar/tool/Makefile.in
@@ -15,20 +15,16 @@ ifeq ($(OS_ARCH),WINNT)
 USE_STATIC_LIBS = 1
 endif
 
 # The mar executable is output into dist/host/bin since it is something that
 # would only be used by our build system and should not itself be included in a
 # Mozilla distribution.
 HOST_PROGRAM = mar$(HOST_BIN_SUFFIX)
 
-ifdef MOZ_ENABLE_SIGNMAR
-PROGRAM = signmar$(BIN_SUFFIX)
-endif
-
 # Don't link the against libmozglue because we don't need it.
 MOZ_GLUE_LDFLAGS =
 MOZ_GLUE_PROGRAM_LDFLAGS =
 
 DEFINES += \
   -DMAR_CHANNEL_ID='"$(MAR_CHANNEL_ID)"' \
   -DMOZ_APP_VERSION='"$(MOZ_APP_VERSION)"' \
   $(NULL)
--- a/modules/libmar/tool/moz.build
+++ b/modules/libmar/tool/moz.build
@@ -1,8 +1,10 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 MODULE = 'mar'
 
+if CONFIG['MOZ_ENABLE_SIGNMAR']:
+    PROGRAM = 'signmar'
--- a/netwerk/streamconv/test/Makefile.in
+++ b/netwerk/streamconv/test/Makefile.in
@@ -6,18 +6,16 @@
 DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 FAIL_ON_WARNINGS := 1
 
 include $(DEPTH)/config/autoconf.mk
 
-PROGRAM		= TestStreamConv$(BIN_SUFFIX)
-
 CPPSRCS		= \
 		Converters.cpp \
 		TestStreamConv.cpp \
 		$(NULL)
 
 LIBS		= \
 		$(DIST)/lib/$(LIB_PREFIX)xpcomglue_s.$(LIB_SUFFIX) \
 		$(XPCOM_LIBS) \
--- a/netwerk/streamconv/test/moz.build
+++ b/netwerk/streamconv/test/moz.build
@@ -1,8 +1,10 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 MODULE = 'TestStreamConv'
 
+PROGRAM = 'TestStreamConv'
+
--- a/python/mozbuild/mozbuild/backend/recursivemake.py
+++ b/python/mozbuild/mozbuild/backend/recursivemake.py
@@ -11,16 +11,17 @@ import types
 
 from .base import BuildBackend
 from ..frontend.data import (
     ConfigFileSubstitution,
     DirectoryTraversal,
     SandboxDerived,
     VariablePassthru,
     Exports,
+    Program,
     XpcshellManifests,
 )
 from ..util import FileAvoidWrite
 
 
 STUB_MAKEFILE = '''
 # THIS FILE WAS AUTOMATICALLY GENERATED. DO NOT MODIFY BY HAND.
 
@@ -209,16 +210,19 @@ class RecursiveMakeBackend(BuildBackend)
                     for item in v:
                         backend_file.write('%s += %s\n' % (k, item))
 
                 else:
                     backend_file.write('%s := %s\n' % (k, v))
         elif isinstance(obj, Exports):
             self._process_exports(obj.exports, backend_file)
 
+        elif isinstance(obj, Program):
+            self._process_program(obj.program, backend_file)
+
         elif isinstance(obj, XpcshellManifests):
             self._process_xpcshell_manifests(obj.xpcshell_manifests, backend_file)
 
         self._backend_files[obj.srcdir] = backend_file
 
     def consume_finished(self):
         for srcdir in sorted(self._backend_files.keys()):
             bf = self._backend_files[srcdir]
@@ -320,10 +324,13 @@ class RecursiveMakeBackend(BuildBackend)
         if strings:
             backend_file.write('%s += %s\n' % (export_name, ' '.join(strings)))
 
         children = exports.get_children()
         for subdir in sorted(children):
             self._process_exports(children[subdir], backend_file,
                                   namespace=namespace + subdir)
 
+    def _process_program(self, program, backend_file):
+        backend_file.write('PROGRAM = %s\n' % program)
+
     def _process_xpcshell_manifests(self, manifest, backend_file, namespace=""):
         backend_file.write('XPCSHELL_TESTS += %s\n' % os.path.dirname(manifest))
--- a/python/mozbuild/mozbuild/frontend/data.py
+++ b/python/mozbuild/mozbuild/frontend/data.py
@@ -144,16 +144,34 @@ class Exports(SandboxDerived):
     HierarchicalStringList, which is created when parsing EXPORTS.
     """
     __slots__ = ('exports')
 
     def __init__(self, sandbox, exports):
         SandboxDerived.__init__(self, sandbox)
         self.exports = exports
 
+class Program(SandboxDerived):
+    """Sandbox container object for PROGRAM, which is a unicode string.
+
+    This class handles automatically appending BIN_SUFFIX to the PROGRAM value.
+    If BIN_SUFFIX is not defined, PROGRAM is unchanged.
+    Otherwise, if PROGRAM ends in BIN_SUFFIX, it is unchanged
+    Otherwise, BIN_SUFFIX is appended to PROGRAM
+    """
+    __slots__ = ('program')
+
+    def __init__(self, sandbox, program, bin_suffix):
+        SandboxDerived.__init__(self, sandbox)
+
+        bin_suffix = bin_suffix or ''
+        if not program.endswith(bin_suffix):
+            program += bin_suffix
+        self.program = program
+
 class XpcshellManifests(SandboxDerived):
     """Build object container for XPCSHELL_TESTS_MANIFESTS (was: XPCSHELL_TESTS).
 
     This object contains a list of xpcshell.ini manifest files.
     """
     __slots__ = ('xpcshell_manifests')
 
     def __init__(self, sandbox, manifests):
--- a/python/mozbuild/mozbuild/frontend/emitter.py
+++ b/python/mozbuild/mozbuild/frontend/emitter.py
@@ -4,19 +4,20 @@
 
 from __future__ import unicode_literals
 
 import os
 
 from .data import (
     ConfigFileSubstitution,
     DirectoryTraversal,
+    Exports,
+    Program,
+    ReaderSummary,
     VariablePassthru,
-    Exports,
-    ReaderSummary,
     XpcshellManifests,
 )
 
 from .reader import MozbuildSandbox
 
 
 class TreeMetadataEmitter(object):
     """Converts the executed mozbuild files into data structures.
@@ -87,16 +88,20 @@ class TreeMetadataEmitter(object):
 
         if passthru.variables:
             yield passthru
 
         exports = sandbox.get('EXPORTS')
         if exports:
             yield Exports(sandbox, exports)
 
+        program = sandbox.get('PROGRAM')
+        if program:
+            yield Program(sandbox, program, sandbox['CONFIG']['BIN_SUFFIX'])
+
         for manifest in sandbox.get('XPCSHELL_TESTS_MANIFESTS', []):
             yield XpcshellManifests(sandbox, manifest)
 
     def _emit_directory_traversal_from_sandbox(self, sandbox):
         o = DirectoryTraversal(sandbox)
         o.dirs = sandbox.get('DIRS', [])
         o.parallel_dirs = sandbox.get('PARALLEL_DIRS', [])
         o.tool_dirs = sandbox.get('TOOL_DIRS', [])
--- a/python/mozbuild/mozbuild/frontend/sandbox_symbols.py
+++ b/python/mozbuild/mozbuild/frontend/sandbox_symbols.py
@@ -162,16 +162,24 @@ VARIABLES = {
         subdirectory they should be exported to. For example, to export 'foo.h'
         to the top-level directory, and 'bar.h' to mozilla/dom/, append to
         EXPORTS like so:
 
         EXPORTS += ['foo.h']
         EXPORTS.mozilla.dom += ['bar.h']
         """),
 
+    'PROGRAM' : (unicode, "",
+        """Compiled executable name.
+
+        If the configuration token 'BIN_SUFFIX' is set, its value will be
+        automatically appended to PROGRAM. If PROGRAM already ends with
+        BIN_SUFFIX, PROGRAM will remain unchanged.
+        """),
+
     # IDL Generation.
     'XPIDL_SOURCES': (list, [],
         """XPCOM Interface Definition Files (xpidl).
 
         This is a list of files that define XPCOM interface definitions.
         Entries must be files that exist. Entries are almost certainly .idl
         files.
         """),
new file mode 100644
--- /dev/null
+++ b/python/mozbuild/mozbuild/test/frontend/data/program/moz.build
@@ -0,0 +1,4 @@
+# Any copyright is dedicated to the Public Domain.
+# http://creativecommons.org/publicdomain/zero/1.0/
+
+PROGRAM = 'test_program'
--- a/python/mozbuild/mozbuild/test/frontend/test_emitter.py
+++ b/python/mozbuild/mozbuild/test/frontend/test_emitter.py
@@ -10,32 +10,34 @@ import unittest
 from mozunit import main
 
 from mozbuild.frontend.data import (
     ConfigFileSubstitution,
     DirectoryTraversal,
     ReaderSummary,
     VariablePassthru,
     Exports,
+    Program,
     XpcshellManifests,
 )
 from mozbuild.frontend.emitter import TreeMetadataEmitter
 from mozbuild.frontend.reader import BuildReader
 
 from mozbuild.test.common import MockConfig
 
 
 data_path = os.path.abspath(os.path.dirname(__file__))
 data_path = os.path.join(data_path, 'data')
 
 
 class TestEmitterBasic(unittest.TestCase):
     def reader(self, name):
         config = MockConfig(os.path.join(data_path, name))
         config.substs['ENABLE_TESTS'] = '1'
+        config.substs['BIN_SUFFIX'] = '.prog'
 
         return BuildReader(config)
 
     def read_topsrcdir(self, reader):
         emitter = TreeMetadataEmitter(reader.config)
 
         objs = list(emitter.emit(reader.read_topsrcdir()))
         self.assertGreater(len(objs), 0)
@@ -165,16 +167,27 @@ class TestEmitterBasic(unittest.TestCase
         self.assertIn('private', nspr._children)
         private = nspr._children['private']
         self.assertEqual(private.get_strings(), ['pprio.h', 'pprthred.h'])
 
         self.assertIn('overwrite', exports._children)
         overwrite = exports._children['overwrite']
         self.assertEqual(overwrite.get_strings(), ['new.h'])
 
+    def test_program(self):
+        reader = self.reader('program')
+        objs = self.read_topsrcdir(reader)
+
+        self.assertEqual(len(objs), 2)
+        self.assertIsInstance(objs[0], DirectoryTraversal)
+        self.assertIsInstance(objs[1], Program)
+
+        program = objs[1].program
+        self.assertEqual(program, 'test_program.prog')
+
     def test_xpcshell_manifests(self):
         reader = self.reader('xpcshell_manifests')
         objs = self.read_topsrcdir(reader)
 
         inis = []
         for o in objs:
             if isinstance(o, XpcshellManifests):
                 inis.append(o.xpcshell_manifests)
--- a/rdf/tests/rdfcat/Makefile.in
+++ b/rdf/tests/rdfcat/Makefile.in
@@ -5,18 +5,16 @@
 
 DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
-PROGRAM		= rdfcat$(BIN_SUFFIX)
-
 CPPSRCS		= rdfcat.cpp
 
 LIBS		= \
 		$(DIST)/lib/$(LIB_PREFIX)xpcomglue_s.$(LIB_SUFFIX) \
 		$(LIBS_DIR) \
 		$(XPCOM_LIBS) \
 		$(NSPR_LIBS) \
 		$(NULL)
--- a/rdf/tests/rdfcat/moz.build
+++ b/rdf/tests/rdfcat/moz.build
@@ -1,6 +1,8 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
+PROGRAM = 'rdfcat'
+
--- a/rdf/tests/rdfpoll/Makefile.in
+++ b/rdf/tests/rdfpoll/Makefile.in
@@ -5,17 +5,16 @@
 
 DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
-PROGRAM		= rdfpoll$(BIN_SUFFIX)
 CPPSRCS		= rdfpoll.cpp
 
 
 LIBS		= \
 		$(DIST)/lib/$(LIB_PREFIX)xpcomglue_s.$(LIB_SUFFIX) \
 		$(LIBS_DIR) \
 		$(XPCOM_LIBS) \
 		$(NSPR_LIBS) \
--- a/rdf/tests/rdfpoll/moz.build
+++ b/rdf/tests/rdfpoll/moz.build
@@ -1,6 +1,8 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
+PROGRAM = 'rdfpoll'
+
--- a/rdf/tests/triplescat/Makefile.in
+++ b/rdf/tests/triplescat/Makefile.in
@@ -5,18 +5,16 @@
 
 DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
-PROGRAM		= triplescat$(BIN_SUFFIX)
-
 CPPSRCS		= triplescat.cpp
 
 LIBS		= \
 		$(DIST)/lib/$(LIB_PREFIX)xpcomglue_s.$(LIB_SUFFIX) \
 		$(LIBS_DIR) \
 		$(XPCOM_LIBS) \
 		$(NSPR_LIBS) \
 		$(NULL)
--- a/rdf/tests/triplescat/moz.build
+++ b/rdf/tests/triplescat/moz.build
@@ -1,6 +1,8 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
+PROGRAM = 'triplescat'
+
--- a/testing/mochitest/ssltunnel/Makefile.in
+++ b/testing/mochitest/ssltunnel/Makefile.in
@@ -9,18 +9,16 @@ srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 # This isn't XPCOM code, but it wants to use STL, so disable the STL
 # wrappers
 STL_FLAGS =
 
-PROGRAM = ssltunnel$(BIN_SUFFIX)
-
 CPPSRCS = ssltunnel.cpp
 
 LIBS = \
   $(NSPR_LIBS) \
   $(NSS_LIBS) \
   $(MOZALLOC_LIB) \
   $(NULL)
 
--- a/testing/mochitest/ssltunnel/moz.build
+++ b/testing/mochitest/ssltunnel/moz.build
@@ -1,6 +1,8 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
+PROGRAM = 'ssltunnel'
+
--- a/testing/tools/screenshot/Makefile.in
+++ b/testing/tools/screenshot/Makefile.in
@@ -7,27 +7,25 @@ topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 ifeq ($(MOZ_WIDGET_TOOLKIT),gtk2)
 ifdef MOZ_X11
 
-PROGRAM = screentopng
 CPPSRCS = gdk-screenshot.cpp
 LOCAL_INCLUDES = $(MOZ_GTK2_CFLAGS)
 OS_LIBS = $(MOZ_GTK2_LIBS) $(XSS_LIBS)
 
 endif # X11
 endif # GTK2
 
 ifeq ($(MOZ_WIDGET_TOOLKIT),windows)
 
-PROGRAM = screenshot$(BIN_SUFFIX)
 CPPSRCS = win32-screenshot.cpp
 OS_LIBS += $(call EXPAND_LIBNAME,gdiplus)
 MOZ_GLUE_PROGRAM_LDFLAGS =
 USE_STATIC_LIBS = 1
 
 ifdef GNU_CC
 WIN32_EXE_LDFLAGS = -municode
 endif
--- a/testing/tools/screenshot/moz.build
+++ b/testing/tools/screenshot/moz.build
@@ -1,6 +1,10 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
+if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gtk2' and CONFIG['MOZ_X11']:
+    PROGRAM = 'screentopng'
+elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
+    PROGRAM = 'screenshot'
--- a/toolkit/components/maintenanceservice/Makefile.in
+++ b/toolkit/components/maintenanceservice/Makefile.in
@@ -16,17 +16,16 @@ CPPSRCS = \
   certificatecheck.cpp \
   servicebase.cpp \
   registrycertificates.cpp \
   $(NULL)
 
 # For debugging purposes only
 #DEFINES += -DDISABLE_UPDATER_AUTHENTICODE_CHECK
 
-PROGRAM = maintenanceservice$(BIN_SUFFIX)
 DIST_PROGRAM = maintenanceservice$(BIN_SUFFIX)
 
 # Don't link the maintenanceservice against mozglue.dll. See bug 687139 and
 # bug 725876
 MOZ_GLUE_LDFLAGS =
 MOZ_GLUE_PROGRAM_LDFLAGS =
 
 LIBS += \
--- a/toolkit/components/maintenanceservice/moz.build
+++ b/toolkit/components/maintenanceservice/moz.build
@@ -1,6 +1,8 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
+PROGRAM = 'maintenanceservice'
+
--- a/toolkit/crashreporter/client/Makefile.in
+++ b/toolkit/crashreporter/client/Makefile.in
@@ -11,17 +11,16 @@ relativesrcdir = @relativesrcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 # Don't use the STL wrappers in the crashreporter clients; they don't
 # link with -lmozalloc, and it really doesn't matter here anyway.
 STL_FLAGS =
 
 ifneq ($(OS_TARGET),Android)
-PROGRAM = crashreporter$(BIN_SUFFIX)
 DIST_PROGRAM = crashreporter$(BIN_SUFFIX)
 
 # Don't link the updater against libmozglue.
 MOZ_GLUE_LDFLAGS =
 MOZ_GLUE_PROGRAM_LDFLAGS =
 endif
 
 LOCAL_INCLUDES = -I$(srcdir)/../google-breakpad/src
--- a/toolkit/crashreporter/client/moz.build
+++ b/toolkit/crashreporter/client/moz.build
@@ -1,11 +1,13 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 MODULE = 'crashreporter'
 
+if CONFIG['OS_TARGET'] != 'Android':
+    PROGRAM = 'crashreporter'
 # The xpcshell test case here verifies that the CA certificate list
 if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gtk2' and CONFIG['MOZ_PLATFORM_MAEMO']:
     XPCSHELL_TESTS_MANIFESTS += ['maemo-unit/xpcshell.ini']
--- a/toolkit/mozapps/update/updater/Makefile.in
+++ b/toolkit/mozapps/update/updater/Makefile.in
@@ -17,18 +17,16 @@ CPPSRCS = \
   $(NULL)
 
 ifeq ($(OS_ARCH),WINNT)
 CPPSRCS += \
   loaddlls.cpp \
   $(NULL)
 endif
 
-PROGRAM = updater$(BIN_SUFFIX)
-
 # Don't link the updater against libmozglue. See bug 687139
 MOZ_GLUE_LDFLAGS =
 MOZ_GLUE_PROGRAM_LDFLAGS =
 
 LOCAL_INCLUDES += \
   -I$(srcdir)/../common \
   $(NULL)
 
--- a/toolkit/mozapps/update/updater/moz.build
+++ b/toolkit/mozapps/update/updater/moz.build
@@ -1,6 +1,8 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
+PROGRAM = 'updater'
+
--- a/tools/jprof/Makefile.in
+++ b/tools/jprof/Makefile.in
@@ -6,18 +6,16 @@
 
 DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
-PROGRAM = jprof
-
 CPPSRCS = \
 	bfd.cpp    \
 	coff.cpp   \
 	elf.cpp	   \
 	leaky.cpp  \
 	strset.cpp \
 	intcnt.cpp \
 	$(NULL)
--- a/tools/jprof/moz.build
+++ b/tools/jprof/moz.build
@@ -1,7 +1,10 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 DIRS += ['stub']
+
+PROGRAM = 'jprof'
+
--- a/tools/trace-malloc/Makefile.in
+++ b/tools/trace-malloc/Makefile.in
@@ -25,17 +25,16 @@ SIMPLE_PROGRAMS	= \
 		$(SIMPLECSRCS:.c=$(BIN_SUFFIX)) \
 		$(SIMPLECPPSRCS:.cpp=$(BIN_SUFFIX)) \
 		$(NULL)
 
 EXTRACSRCS = tmreader.c
 EXTRACPPSRCS = adreader.cpp
 
 ifndef MOZ_PROFILE_GENERATE
-PROGRAM		= spacetrace$(BIN_SUFFIX)
 
 PROGCSRCS = \
   spacetrace.c \
   spacecategory.c \
   formdata.c \
   $(NULL)
 
 PROGOBJS = $(PROGCSRCS:.c=.$(OBJ_SUFFIX))
--- a/tools/trace-malloc/moz.build
+++ b/tools/trace-malloc/moz.build
@@ -1,6 +1,8 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
+if not CONFIG['MOZ_PROFILE_GENERATE']:
+    PROGRAM = 'spacetrace'
--- a/webapprt/gtk2/Makefile.in
+++ b/webapprt/gtk2/Makefile.in
@@ -6,18 +6,16 @@ DEPTH = @DEPTH@
 topsrcdir = @top_srcdir@
 srcdir = @srcdir@
 VPATH = @srcdir@
 FAIL_ON_WARNINGS := 1
 
 include $(DEPTH)/config/autoconf.mk
 
 # Build a binary bootstrapping with XRE_main
-PROGRAM = webapprt-stub
-
 CPPSRCS = webapprt.cpp
 
 LOCAL_INCLUDES += \
   -I$(topsrcdir)/toolkit/xre \
   -I$(topsrcdir)/xpcom/base \
   -I$(topsrcdir)/xpcom/build \
   -I$(DEPTH)/build \
   $(NULL)
--- a/webapprt/gtk2/moz.build
+++ b/webapprt/gtk2/moz.build
@@ -1,6 +1,8 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
+PROGRAM = 'webapprt-stub'
+
--- a/webapprt/mac/Makefile.in
+++ b/webapprt/mac/Makefile.in
@@ -8,18 +8,16 @@ srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 # This switches $(INSTALL) to copy mode, like $(SYSINSTALL), so things that
 # shouldn't get 755 perms need $(IFLAGS1) for either way of calling nsinstall.
 NSDISTMODE = copy
 
-PROGRAM = webapprt-stub$(BIN_SUFFIX)
-
 CMMSRCS = webapprt.mm
 
 # Don't create a dependency on mozglue, which is impossible (difficult?)
 # to dynamically link into our executable, as we copy it to arbitrary locations.
 MOZ_GLUE_LDFLAGS =
 MOZ_GLUE_PROGRAM_LDFLAGS =
 
 LOCAL_INCLUDES += -I$(topsrcdir)/toolkit/xre
--- a/webapprt/mac/moz.build
+++ b/webapprt/mac/moz.build
@@ -1,6 +1,8 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
+PROGRAM = 'webapprt-stub'
+
--- a/webapprt/win/Makefile.in
+++ b/webapprt/win/Makefile.in
@@ -5,18 +5,16 @@
 DEPTH     = @DEPTH@
 topsrcdir = @top_srcdir@
 srcdir    = @srcdir@
 VPATH     = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 # Build a binary bootstrapping with XRE_main
-PROGRAM   = webapprt-stub$(BIN_SUFFIX)
-
 CPPSRCS   = webapprt.cpp
 
 # Statically link against the CRT
 USE_STATIC_LIBS = 1
 # Don't create a dependency on mozglue, which is impossible (difficult?)
 # to dynamically link into our executable, as we copy it to arbitrary locations.
 MOZ_GLUE_LDFLAGS =
 
--- a/webapprt/win/moz.build
+++ b/webapprt/win/moz.build
@@ -1,6 +1,8 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
+PROGRAM = 'webapprt-stub'
+
--- a/widget/xremoteclient/Makefile.in
+++ b/widget/xremoteclient/Makefile.in
@@ -23,18 +23,16 @@ LIBCPPSRCS = XRemoteClient.cpp
 
 OBJS = $(LIBCPPSRCS:.cpp=.$(OBJ_SUFFIX))
 
 EXTRA_DSO_LDOPTS = \
 		$(XLIBS) $(XLDFLAGS)  \
 		$(MOZ_COMPONENT_LIBS) \
 		$(NULL)
 
-PROGRAM         = mozilla-xremote-client$(BIN_SUFFIX)
-
 PROGCPPSRCS = \
   mozilla-xremote-client.cpp \
   XRemoteClient.cpp \
   $(NULL)
 
 PROGOBJS = $(PROGCPPSRCS:.cpp=.$(OBJ_SUFFIX))
 
 CPPSRCS = $(filter-out $(LIBCPPSRCS),$(PROGCPPSRCS)) $(LIBCPPSRCS)
--- a/widget/xremoteclient/moz.build
+++ b/widget/xremoteclient/moz.build
@@ -1,8 +1,10 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 MODULE = 'xremoteclient'
 
+PROGRAM = 'mozilla-xremote-client'
+
--- a/xulrunner/app/Makefile.in
+++ b/xulrunner/app/Makefile.in
@@ -10,18 +10,16 @@ VPATH = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 PREF_JS_EXPORTS = $(srcdir)/xulrunner.js
 GARBAGE += $(addprefix $(DIST)/bin/defaults/pref/,xulrunner.js)
 
 DEFINES += -DAB_CD=$(AB_CD)
 
-PROGRAM = xulrunner$(BIN_SUFFIX)
-
 DEFINES += -DXULRUNNER_PROGNAME=\"xulrunner\"
 
 ifdef TARGET_XPCOM_ABI
 DEFINES += -DTARGET_XPCOM_ABI=\"$(TARGET_XPCOM_ABI)\"
 endif
 
 DEFINES += -DXPCOM_GLUE
 STL_FLAGS=
--- a/xulrunner/app/moz.build
+++ b/xulrunner/app/moz.build
@@ -1,7 +1,10 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 DIRS += ['profile']
+
+PROGRAM = 'xulrunner'
+
--- a/xulrunner/stub/Makefile.in
+++ b/xulrunner/stub/Makefile.in
@@ -11,22 +11,16 @@ include $(DEPTH)/config/autoconf.mk
 
 # Statically link against the RTL on windows
 USE_STATIC_LIBS = 1
 # Don't create a dependency on mozglue
 MOZ_GLUE_LDFLAGS =
 
 CPPSRCS   = nsXULStub.cpp
 
-# The value of XULRUNNER_STUB_NAME is generated by configure to allow XULRunner
-# apps to override it using the --with-xulrunner-stub-name=<appname> argument.
-# If this configure argument is not present then the default name is 'xulrunner'
-# for Mac OS X and 'xulrunner-stub' for all other platforms.
-PROGRAM   = $(XULRUNNER_STUB_NAME)$(BIN_SUFFIX)
-
 LOCAL_INCLUDES = \
   -I$(topsrcdir)/xpcom/build \
   -I$(topsrcdir)/xpcom/base \
   $(NULL)
 
 DEFINES  += -DXPCOM_GLUE
 STL_FLAGS=
 
--- a/xulrunner/stub/moz.build
+++ b/xulrunner/stub/moz.build
@@ -1,8 +1,14 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 MODULE = 'xulrunner'
 
+# The value of XULRUNNER_STUB_NAME is generated by configure to allow XULRunner
+# apps to override it using the --with-xulrunner-stub-name=<appname> argument.
+# If this configure argument is not present then the default name is 'xulrunner'
+# for Mac OS X and 'xulrunner-stub' for all other platforms.
+PROGRAM = CONFIG['XULRUNNER_STUB_NAME']
+
--- a/xulrunner/tools/redit/Makefile.in
+++ b/xulrunner/tools/redit/Makefile.in
@@ -6,17 +6,16 @@ DEPTH     = @DEPTH@
 topsrcdir = @top_srcdir@
 srcdir    = @srcdir@
 VPATH     = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 ifeq ($(OS_ARCH),WINNT)
 CPPSRCS    = redit.cpp
-PROGRAM    = redit$(BIN_SUFFIX)
 
 SDK_BINARY =  \
 	$(PROGRAM) \
 	$(NULL)
 
 DEFINES += -DWIN32_LEAN_AND_MEAN \
 					 -DUNICODE \
 					 -D_UNICODE \
--- a/xulrunner/tools/redit/moz.build
+++ b/xulrunner/tools/redit/moz.build
@@ -1,8 +1,10 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 MODULE = 'redit'
 
+if CONFIG['OS_ARCH'] == 'WINNT':
+    PROGRAM  = 'redit'