Back out Bug 1138063 due to build failures a=Ratty CLOSED TREE
authorPhilip Chee <philip.chee@gmail.com>
Sun, 12 Apr 2015 00:20:28 +0800
changeset 22408 8e84e1b51ec88a0cea88f3a19a92cca0f95dbfe5
parent 22407 05a5f777433db696c78fee78962388ccdda909d9
child 22409 64c2c682adb639969cca83dd9731cc76a946b909
push idunknown
push userunknown
push dateunknown
reviewersRatty
bugs1138063
Back out Bug 1138063 due to build failures a=Ratty CLOSED TREE
calendar/base/Makefile.in
calendar/base/backend/libical/build/Makefile.in
calendar/base/moz.build
calendar/base/src/Makefile.in
calendar/base/src/moz.build
calendar/import-export/Makefile.in
calendar/import-export/moz.build
calendar/libical/src/libical/Makefile.in
calendar/lightning/Makefile.in
calendar/lightning/locales/Makefile.in
calendar/lightning/moz.build
calendar/locales/Makefile.in
calendar/providers/caldav/Makefile.in
calendar/providers/caldav/moz.build
calendar/providers/gdata/Makefile.in
calendar/providers/gdata/locales/Makefile.in
calendar/providers/wcap/Makefile.in
calendar/providers/wcap/moz.build
calendar/resources/Makefile.in
calendar/test/mozmill/Makefile.in
calendar/timezones/Makefile.in
calendar/timezones/locales/Makefile.in
chat/locales/Makefile.in
editor/ui/locales/Makefile.in
im/Makefile.in
im/app/Makefile.in
im/app/profile/Makefile.in
im/app/profile/extensions/Makefile.in
im/app/profile/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}/Makefile.in
im/app/profile/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}/moz.build
im/app/profile/moz.build
im/branding/halloween/Makefile.in
im/branding/halloween/locales/Makefile.in
im/branding/nightly/Makefile.in
im/branding/nightly/locales/Makefile.in
im/installer/Makefile.in
im/installer/windows/Makefile.in
im/locales/Makefile.in
im/themes/Makefile.in
im/themes/moz.build
ldap/xpcom/src/Makefile.in
ldap/xpcom/src/moz.build
mail/Makefile.in
mail/app/Makefile.in
mail/app/profile/Makefile.in
mail/app/profile/extensions/Makefile.in
mail/app/profile/moz.build
mail/branding/aurora/locales/Makefile.in
mail/branding/nightly/locales/Makefile.in
mail/components/devtools/extension/Makefile.in
mail/installer/Makefile.in
mail/installer/windows/Makefile.in
mail/locales/Makefile.in
mail/test/mozmill/Makefile.in
mail/test/mozmill/moz.build
mail/themes/Makefile.in
mail/themes/linux/Makefile.in
mail/themes/linux/moz.build
mail/themes/osx/Makefile.in
mail/themes/osx/moz.build
mail/themes/windows/Makefile.in
mail/themes/windows/moz.build
mailnews/Makefile.in
mailnews/base/ispdata/Makefile.in
mailnews/base/ispdata/moz.build
mailnews/base/search/src/Makefile.in
mailnews/base/search/src/moz.build
mailnews/extensions/dsn/Makefile.in
mailnews/extensions/dsn/moz.build
mailnews/extensions/mailviews/content/Makefile.in
mailnews/extensions/mailviews/content/moz.build
mailnews/extensions/mdn/Makefile.in
mailnews/extensions/mdn/moz.build
mailnews/extensions/newsblog/Makefile.in
mailnews/extensions/newsblog/moz.build
mailnews/extensions/smime/Makefile.in
mailnews/extensions/smime/moz.build
mailnews/import/build/Makefile.in
mailnews/import/build/moz.build
mailnews/mapi/mapiDll/Makefile.in
mailnews/mapi/mapihook/build/Makefile.in
mailnews/mapi/mapihook/src/Makefile.in
mailnews/moz.build
other-licenses/branding/instantbird/Makefile.in
other-licenses/branding/instantbird/locales/Makefile.in
other-licenses/branding/thunderbird/locales/Makefile.in
suite/Makefile.in
suite/app/Makefile.in
suite/branding/nightly/Makefile.in
suite/branding/nightly/moz.build
suite/browser/moz.build
suite/browser/test/Makefile.in
suite/browser/test/browser/browser.ini
suite/browser/test/chrome/chrome.ini
suite/browser/test/mochitest/mochitest.ini
suite/browser/test/moz.build
suite/build/Makefile.in
suite/common/dataman/tests/Makefile.in
suite/common/dataman/tests/browser.ini
suite/common/dataman/tests/moz.build
suite/common/downloads/tests/Makefile.in
suite/common/downloads/tests/browser/browser.ini
suite/common/downloads/tests/chrome/chrome.ini
suite/common/downloads/tests/moz.build
suite/common/moz.build
suite/common/places/tests/Makefile.in
suite/common/places/tests/browser/browser.ini
suite/common/places/tests/chrome/chrome.ini
suite/common/places/tests/moz.build
suite/common/tests/browser/Makefile.in
suite/common/tests/browser/browser.ini
suite/common/tests/browser/moz.build
suite/common/tests/chrome/Makefile.in
suite/common/tests/chrome/chrome.ini
suite/common/tests/chrome/moz.build
suite/common/tests/moz.build
suite/common/tests/preferences/Makefile.in
suite/common/tests/preferences/browser.ini
suite/common/tests/preferences/moz.build
suite/debugQA/Makefile.in
suite/debugQA/locales/Makefile.in
suite/installer/Makefile.in
suite/installer/windows/Makefile.in
suite/locales/Makefile.in
suite/locales/moz.build
suite/themes/classic/Makefile.in
suite/themes/classic/moz.build
suite/themes/modern/Makefile.in
suite/themes/modern/moz.build
--- a/calendar/base/Makefile.in
+++ b/calendar/base/Makefile.in
@@ -1,6 +1,38 @@
 # 
 # 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/.
 
+DEPTH		= @DEPTH@
+topsrcdir	= @top_srcdir@
+srcdir		= @srcdir@
+VPATH		= @srcdir@
+
+include $(DEPTH)/config/autoconf.mk
+
 USE_EXTENSION_MANIFEST = 1
+
+WINDOW_ICONS = calendar-alarm-dialog \
+               calendar-event-dialog \
+               calendar-event-summary-dialog \
+               calendar-task-dialog \
+               calendar-task-summary-dialog \
+               $(NULL)
+
+include $(topsrcdir)/config/rules.mk
+
+# Window icons are not needed on mac
+ifneq (,$(filter windows gtk gtk2,$(MOZ_WIDGET_TOOLKIT)))
+
+# Set up the icon suffix to differ between windows and linux
+ifneq (,$(filter windows,$(MOZ_WIDGET_TOOLKIT)))
+ICON_SUFFIX = .ico
+else
+ICON_SUFFIX = .png
+endif
+
+# Copy the window icons into the correct directory
+libs:: $(addprefix themes/windows/icons/, $(addsuffix $(ICON_SUFFIX), $(WINDOW_ICONS)))
+	$(INSTALL) $^ $(FINAL_TARGET)/chrome/icons/default
+
+endif
--- a/calendar/base/backend/libical/build/Makefile.in
+++ b/calendar/base/backend/libical/build/Makefile.in
@@ -4,11 +4,10 @@
 
 NO_COMPONENTS_MANIFEST = 1
 
 # Ensure that we don't embed a manifest referencing the CRT
 EMBED_MANIFEST_AT =
 
 DEFINES += -DSHARED_LIBRARY=$(SHARED_LIBRARY)
 
-BACKEND_MANIFESTS = libical-manifest
-BACKEND_MANIFESTS_PATH = $(FINAL_TARGET)/components
-PP_TARGETS += BACKEND_MANIFESTS
+libs::
+	$(call py_action,preprocessor,$(DEFINES) $(srcdir)/libical-manifest -o $(FINAL_TARGET)/components/libical-manifest)
--- a/calendar/base/moz.build
+++ b/calendar/base/moz.build
@@ -14,37 +14,16 @@ JAR_MANIFESTS += ['jar.mn']
 
 if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
     DEFINES['THEME'] = 'windows'
 elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
     DEFINES['THEME'] = 'osx'
 else:
     DEFINES['THEME'] = 'linux'
 
-# Window icons are not needed on mac
-if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('windows', 'gtk', 'gtk2'):
-    icon_path = 'themes/windows/icons/'
-    window_icons = [
-        'calendar-alarm-dialog',
-        'calendar-event-dialog',
-        'calendar-event-summary-dialog',
-        'calendar-task-dialog',
-        'calendar-task-summary-dialog',
-    ]
-
-    # Set up the icon suffix to differ between windows and linux
-    if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
-        icon_suffix = '.ico'
-    else:
-        icon_suffix = '.png'
-
-    FINAL_TARGET_FILES.chrome.icons.default += [
-        '%s%s%s' % (icon_path, icon, icon_suffix) for icon in window_icons
-    ]
-
 with Files('content/**'):
     BUG_COMPONENT = ('Calendar', 'Calendar Views')
 
 with Files('content/preferences/**'):
     BUG_COMPONENT = ('Calendar', 'Preferences')
 
 with Files('content/dialogs/**'):
     BUG_COMPONENT = ('Calendar', 'Dialogs')
new file mode 100644
--- /dev/null
+++ b/calendar/base/src/Makefile.in
@@ -0,0 +1,48 @@
+#
+# 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/.
+
+DEPTH   = @DEPTH@
+topsrcdir = @top_srcdir@
+srcdir    = @srcdir@
+VPATH   = @srcdir@
+
+include $(DEPTH)/config/autoconf.mk
+
+EXTRA_SCRIPTS = \
+    calAlarm.js \
+    calAlarmService.js \
+    calAlarmMonitor.js \
+    calAttachment.js \
+    calAttendee.js \
+    calCalendarManager.js \
+    calCachedCalendar.js \
+    calDateTimeFormatter.js \
+    calDeletedItems.js \
+    calEvent.js \
+    calFilter.js \
+    calIcsParser.js \
+    calIcsSerializer.js \
+    calItemBase.js \
+    calItipItem.js \
+    calProtocolHandler.js \
+    calRecurrenceDate.js \
+    calRecurrenceInfo.js \
+    calRelation.js \
+    calStartupService.js \
+    calTimezone.js \
+    calTodo.js \
+    calUtils.js \
+    calWeekInfoService.js \
+    calTransactionManager.js \
+    calFreeBusyService.js \
+    calCalendarSearchService.js \
+    $(NULL)
+
+# Use NSINSTALL to make the directory, as there's no mtime to preserve.
+libs:: $(EXTRA_SCRIPTS)
+	if test ! -d $(FINAL_TARGET)/calendar-js; then $(NSINSTALL) -D $(FINAL_TARGET)/calendar-js; fi
+	$(INSTALL) $^ $(FINAL_TARGET)/calendar-js
+
+include $(topsrcdir)/config/rules.mk
--- a/calendar/base/src/moz.build
+++ b/calendar/base/src/moz.build
@@ -15,44 +15,14 @@ EXTRA_COMPONENTS += [
     'calItemModule.js',
     'calItemModule.manifest',
     'calSleepMonitor.js',
     'calSleepMonitor.manifest',
     'calTimezoneService.js',
     'calTimezoneService.manifest',
 ]
 
-FINAL_TARGET_FILES['calendar-js'] += [
-    'calAlarm.js',
-    'calAlarmMonitor.js',
-    'calAlarmService.js',
-    'calAttachment.js',
-    'calAttendee.js',
-    'calCachedCalendar.js',
-    'calCalendarManager.js',
-    'calCalendarSearchService.js',
-    'calDateTimeFormatter.js',
-    'calDeletedItems.js',
-    'calEvent.js',
-    'calFilter.js',
-    'calFreeBusyService.js',
-    'calIcsParser.js',
-    'calIcsSerializer.js',
-    'calItemBase.js',
-    'calItipItem.js',
-    'calProtocolHandler.js',
-    'calRecurrenceDate.js',
-    'calRecurrenceInfo.js',
-    'calRelation.js',
-    'calStartupService.js',
-    'calTimezone.js',
-    'calTodo.js',
-    'calTransactionManager.js',
-    'calUtils.js',
-    'calWeekInfoService.js',
-]
-
 with Files('**'):
     BUG_COMPONENT = ('Calendar', 'Internal Components')
 
 with Files('calAlarm*'):
     BUG_COMPONENT = ('Calendar', 'Alarms')
 
--- a/calendar/import-export/Makefile.in
+++ b/calendar/import-export/Makefile.in
@@ -1,5 +1,27 @@
 # 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/.
 
+DEPTH   = @DEPTH@
+topsrcdir = @top_srcdir@
+srcdir    = @srcdir@
+VPATH   = @srcdir@
+
+include $(DEPTH)/config/autoconf.mk
+
 USE_EXTENSION_MANIFEST = 1
+EXTRA_SCRIPTS = \
+    calHtmlExport.js \
+    calIcsImportExport.js \
+    calListFormatter.js \
+    calMonthGridPrinter.js \
+    calOutlookCSVImportExport.js \
+    calWeekPrinter.js \
+    $(NULL)
+
+# Use NSINSTALL to make the directory, as there's no mtime to preserve.
+libs:: $(EXTRA_SCRIPTS)
+	if test ! -d $(FINAL_TARGET)/calendar-js; then $(NSINSTALL) -D $(FINAL_TARGET)/calendar-js; fi
+	$(INSTALL) $^ $(FINAL_TARGET)/calendar-js
+
+include $(topsrcdir)/config/rules.mk
--- a/calendar/import-export/moz.build
+++ b/calendar/import-export/moz.build
@@ -5,22 +5,13 @@
 
 EXTRA_COMPONENTS += [
     'calImportExportModule.js',
     'calImportExportModule.manifest',
 ]
 
 JAR_MANIFESTS += ['jar.mn']
 
-FINAL_TARGET_FILES['calendar-js'] += [
-    'calHtmlExport.js',
-    'calIcsImportExport.js',
-    'calListFormatter.js',
-    'calMonthGridPrinter.js',
-    'calOutlookCSVImportExport.js',
-    'calWeekPrinter.js',
-]
-
 with Files('**'):
     BUG_COMPONENT = ('Calendar', 'Import and Export')
 
 with Files('*Print*'):
     BUG_COMPONENT = ('Calendar', 'Printing')
--- a/calendar/libical/src/libical/Makefile.in
+++ b/calendar/libical/src/libical/Makefile.in
@@ -30,16 +30,24 @@
 # 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= @DEPTH@
+
+topsrcdir	= @top_srcdir@
+srcdir		= @srcdir@
+VPATH		= @srcdir@
+
+include $(DEPTH)/config/autoconf.mk
+
 DEFINES += -DHAVE_CONFIG_H
 DEFINES += -DHAVE_SNPRINTF
 
 ifneq (,$(filter BeOS Darwin OpenVMS NetBSD FreeBSD,$(OS_ARCH)))
 DEFINES	+= -D__USE_BSD=1
 endif
 
 INSTALL_TARGETS += ical
--- a/calendar/lightning/Makefile.in
+++ b/calendar/lightning/Makefile.in
@@ -79,26 +79,30 @@ include $(topsrcdir)/config/config.mk
 # tinderboxen to disable that.
 ifndef DISABLE_LIGHTNING_INSTALL
 # install Lightning as a global extension in dist/bin/extensions/
 XPI_INSTALL_EXTENSION = $(XPI_EM_ID)
 endif
 
 DEFINES += -DTHUNDERBIRD_VERSION=$(THUNDERBIRD_VERSION) \
            -DTHUNDERBIRD_MAXVERSION=$(THUNDERBIRD_MAXVERSION) \
+           -DAB_CD=$(AB_CD) \
            -DSEAMONKEY_VERSION=$(SEAMONKEY_VERSION) \
            -DSEAMONKEY_MAXVERSION=$(SEAMONKEY_MAXVERSION) \
            -DLIGHTNING_VERSION=$(LIGHTNING_VERSION) \
            -DTARGET_PLATFORM=$(OS_TARGET)_$(TARGET_XPCOM_ABI) \
            -DXPI_EM_ID="$(XPI_EM_ID)" \
            $(NULL)
 
 GRE_BUILDID = $(shell $(PYTHON) $(MOZILLA_SRCDIR)/config/printconfigsetting.py $(LIBXUL_DIST)/bin/application.ini App BuildID)
 DEFINES += -DGRE_BUILDID=$(GRE_BUILDID)
 
+libs::
+	$(NSINSTALL) -m 0644 $(srcdir)/../timezones/zones.json $(FINAL_TARGET)/timezones
+
 include $(topsrcdir)/config/rules.mk
 include $(srcdir)/lightning-packager.mk
 include $(srcdir)/lightning-tests.mk
 
 # For Lightning, we also need to preprocess the l10n prefs
 repack-process-extrafiles: lightning-extrafiles
 lightning-extrafiles: LOCALE_BASEDIR=$(call EXPAND_LOCALE_SRCDIR,calendar/locales)
 lightning-extrafiles:
--- a/calendar/lightning/locales/Makefile.in
+++ b/calendar/lightning/locales/Makefile.in
@@ -4,11 +4,12 @@
 
 # Setting this to calendar/locales sets up LOCALE_SRCDIR to the correct locale
 # directory
 relativesrcdir = calendar/locales
 
 USE_EXTENSION_MANIFEST = 1
 MOZ_CHROME_FILE_FORMAT=jar
 
-DEFINES += -DTHEME=$(THEME) \
+DEFINES += -DAB_CD=$(AB_CD) \
+           -DTHEME=$(THEME) \
            -DLOCALE_SRCDIR=$(LOCALE_SRCDIR) \
            $(NULL)
--- a/calendar/lightning/moz.build
+++ b/calendar/lightning/moz.build
@@ -26,20 +26,16 @@ elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'co
     DEFINES['THEME'] = 'osx'
 else:
     DEFINES['THEME'] = 'linux'
 
 JS_PREFERENCE_FILES += [
     'content/lightning.js',
 ]
 
-FINAL_TARGET_FILES.timezones += [
-    '../timezones/zones.json',
-]
-
 with Files('**'):
     BUG_COMPONENT = ('Calendar', 'Lightning Only')
 
 with Files('content/suite-*'):
     BUG_COMPONENT = ('Calendar', 'Lightning: SeaMonkey Integration')
 
 with Files('build/**'):
     BUG_COMPONENT = ('Calendar', 'Build Config')
--- a/calendar/locales/Makefile.in
+++ b/calendar/locales/Makefile.in
@@ -1,7 +1,9 @@
 # vim:set ts=8 sw=8 sts=8 noet:
 # 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/.
 
 MOZ_CHROME_FILE_FORMAT=jar
 USE_EXTENSION_MANIFEST = 1
+
+DEFINES += -DAB_CD=$(AB_CD)
new file mode 100644
--- /dev/null
+++ b/calendar/providers/caldav/Makefile.in
@@ -0,0 +1,18 @@
+# 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/.
+
+DEPTH		= @DEPTH@
+topsrcdir	= @top_srcdir@
+srcdir		= @srcdir@
+VPATH		= @srcdir@
+
+include $(DEPTH)/config/autoconf.mk
+
+EXTRA_SCRIPTS = calDavRequestHandlers.js
+
+libs:: $(EXTRA_SCRIPTS)
+	if test ! -d $(FINAL_TARGET)/calendar-js; then $(NSINSTALL) -D $(FINAL_TARGET)/calendar-js; fi
+	$(INSTALL) $^ $(FINAL_TARGET)/calendar-js
+
+include $(topsrcdir)/config/rules.mk
--- a/calendar/providers/caldav/moz.build
+++ b/calendar/providers/caldav/moz.build
@@ -5,14 +5,10 @@
 
 DIRS += ['public']
 
 EXTRA_COMPONENTS += [
     'calDavCalendar.js',
     'calDavCalendar.manifest',
 ]
 
-FINAL_TARGET_FILES['calendar-js'] += [
-    'calDavRequestHandlers.js',
-]
-
 with Files('**'):
     BUG_COMPONENT = ('Calendar', 'Provider: CalDAV')
--- a/calendar/providers/gdata/Makefile.in
+++ b/calendar/providers/gdata/Makefile.in
@@ -12,17 +12,18 @@ ifndef DISABLE_LIGHTNING_INSTALL
 XPI_INSTALL_EXTENSION = $(XPI_EM_ID)
 endif
 
 THUNDERBIRD_VERSION := $(shell cat $(topsrcdir)/mail/config/version.txt)
 SEAMONKEY_VERSION := $(shell cat $(topsrcdir)/suite/config/version.txt)
 LIGHTNING_VERSION := $(shell $(PYTHON) $(topsrcdir)/calendar/lightning/build/makeversion.py $(word 1,$(MOZ_PKG_VERSION) $(THUNDERBIRD_VERSION)))
 GDATA_VERSION = $(shell $(PYTHON) $(srcdir)/makeversion.py $(LIGHTNING_VERSION))
 
-DEFINES += -DLIGHTNING_VERSION=$(LIGHTNING_VERSION) \
+DEFINES += -DAB_CD=$(AB_CD) \
+           -DLIGHTNING_VERSION=$(LIGHTNING_VERSION) \
            -DSEAMONKEY_VERSION=$(SEAMONKEY_VERSION) \
            -DTHUNDERBIRD_VERSION=$(THUNDERBIRD_VERSION) \
            -DCOMM_BUILD=$(COMM_BUILD) \
            -DGDATA_VERSION=$(GDATA_VERSION) \
            $(NULL)
 
 ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
 # If the macbundle dist dir was already created, sync the gdata provider here to avoid
--- a/calendar/providers/gdata/locales/Makefile.in
+++ b/calendar/providers/gdata/locales/Makefile.in
@@ -1,11 +1,22 @@
 # 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/.
 
+DEPTH = @DEPTH@
+topsrcdir = @top_srcdir@
+srcdir = @srcdir@
+VPATH = @srcdir@
+
 # Setting this to calendar/locales sets up LOCALE_SRCDIR to the correct locale
 # directory
 relativesrcdir = calendar/locales
 
 USE_EXTENSION_MANIFEST = 1
 
-DEFINES += -DLOCALE_SRCDIR=$(LOCALE_SRCDIR)
+include $(DEPTH)/config/autoconf.mk
+
+DEFINES += -DAB_CD=$(AB_CD) \
+           -DLOCALE_SRCDIR=$(LOCALE_SRCDIR) \
+           $(NULL)
+
+include $(topsrcdir)/config/rules.mk
new file mode 100644
--- /dev/null
+++ b/calendar/providers/wcap/Makefile.in
@@ -0,0 +1,25 @@
+# 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/.
+
+DEPTH           = @DEPTH@
+topsrcdir       = @top_srcdir@
+srcdir          = @srcdir@
+VPATH           = @srcdir@
+
+include $(DEPTH)/config/autoconf.mk
+
+EXTRA_SCRIPTS = \
+                calWcapUtils.js \
+                calWcapRequest.js \
+                calWcapErrors.js \
+                calWcapSession.js \
+                calWcapCalendarItems.js \
+                calWcapCalendar.js \
+                $(NULL)
+
+libs:: $(EXTRA_SCRIPTS)
+	if test ! -d $(FINAL_TARGET)/calendar-js; then $(NSINSTALL) -D $(FINAL_TARGET)/calendar-js; fi
+	$(INSTALL) $^ $(FINAL_TARGET)/calendar-js
+
+include $(topsrcdir)/config/rules.mk
--- a/calendar/providers/wcap/moz.build
+++ b/calendar/providers/wcap/moz.build
@@ -5,19 +5,10 @@
 
 DIRS += ['public']
 
 EXTRA_COMPONENTS += [
     'calWcapCalendarModule.js',
     'calWcapCalendarModule.manifest',
 ]
 
-FINAL_TARGET_FILES['calendar-js'] += [
-    'calWcapCalendar.js',
-    'calWcapCalendarItems.js',
-    'calWcapErrors.js',
-    'calWcapRequest.js',
-    'calWcapSession.js',
-    'calWcapUtils.js',
-]
-
 with Files('**'):
     BUG_COMPONENT = ('Calendar', 'Provider: WCAP')
--- a/calendar/resources/Makefile.in
+++ b/calendar/resources/Makefile.in
@@ -1,5 +1,14 @@
 # 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/.
 
+DEPTH		= @DEPTH@
+topsrcdir	= @top_srcdir@
+srcdir		= @srcdir@
+VPATH		= @srcdir@
+
+include $(DEPTH)/config/autoconf.mk
+
 USE_EXTENSION_MANIFEST = 1
+
+include $(topsrcdir)/config/rules.mk
--- a/calendar/test/mozmill/Makefile.in
+++ b/calendar/test/mozmill/Makefile.in
@@ -1,12 +1,19 @@
 # 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/.
 
+DEPTH		= @DEPTH@
+topsrcdir	= @top_srcdir@
+srcdir		= @srcdir@
+VPATH		= @srcdir@
+
+include $(DEPTH)/config/autoconf.mk
+
 MOZMILLDIR=$(DEPTH)/_tests/mozmill
 ifeq ($(OS_ARCH),WINNT)
 VIRTUALENV_BIN = $(MOZMILLDIR)/../mozmill-virtualenv/Scripts
 else
 VIRTUALENV_BIN = $(MOZMILLDIR)/../mozmill-virtualenv/bin
 endif
 MOZMILLPYTHON = $(abspath $(VIRTUALENV_BIN)/python$(BIN_SUFFIX))
 
--- a/calendar/timezones/Makefile.in
+++ b/calendar/timezones/Makefile.in
@@ -6,17 +6,19 @@ USE_EXTENSION_MANIFEST = 1
 DIST_FILES = install.rdf
 XPI_PKGNAME = calendar-timezones-$(TIMEZONES_VERSION)
 
 THUNDERBIRD_VERSION := $(shell cat $(topsrcdir)/mail/config/version.txt)
 SEAMONKEY_VERSION := $(shell cat $(topsrcdir)/suite/config/version.txt)
 CALENDAR_VERSION := $(shell $(PYTHON) $(topsrcdir)/calendar/lightning/build/makeversion.py $(word 1,$(MOZ_PKG_VERSION) $(THUNDERBIRD_VERSION)))
 TIMEZONES_VERSION := $(shell $(PYTHON) $(srcdir)/version.py)
 
-DEFINES += -DTHUNDERBIRD_VERSION=$(THUNDERBIRD_VERSION) \
+DEFINES += -DAB_CD=$(AB_CD) \
+           -DTHUNDERBIRD_VERSION=$(THUNDERBIRD_VERSION) \
            -DSEAMONKEY_VERSION=$(SEAMONKEY_VERSION) \
            -DCALENDAR_VERSION=$(CALENDAR_VERSION) \
            -DTIMEZONES_VERSION=$(TIMEZONES_VERSION) \
            $(NULL)
 
 libs-%:
 	$(MAKE) -C locales libs AB_CD=$* XPI_NAME=calendar-timezones USE_EXTENSION_MANIFEST=1
 
+include $(topsrcdir)/config/rules.mk
--- a/calendar/timezones/locales/Makefile.in
+++ b/calendar/timezones/locales/Makefile.in
@@ -1,11 +1,22 @@
 # 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/.
 
+DEPTH = @DEPTH@
+topsrcdir = @top_srcdir@
+srcdir = @srcdir@
+VPATH = @srcdir@
+
 # Setting this to calendar/locales sets up LOCALE_SRCDIR to the correct locale
 # directory
 relativesrcdir = calendar/locales
 
 USE_EXTENSION_MANIFEST = 1
 
-DEFINES += -DLOCALE_SRCDIR=$(LOCALE_SRCDIR)
+include $(DEPTH)/config/autoconf.mk
+
+DEFINES += -DAB_CD=$(AB_CD) \
+           -DLOCALE_SRCDIR=$(LOCALE_SRCDIR) \
+           $(NULL)
+
+include $(topsrcdir)/config/rules.mk
new file mode 100644
--- /dev/null
+++ b/chat/locales/Makefile.in
@@ -0,0 +1,15 @@
+# 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/.
+
+DEPTH		= @DEPTH@
+topsrcdir	= @top_srcdir@
+srcdir		= @srcdir@
+VPATH		= @srcdir@
+relativesrcdir	= @relativesrcdir@
+
+include $(DEPTH)/config/autoconf.mk
+
+DEFINES += -DAB_CD=$(AB_CD)
+
+include $(topsrcdir)/config/rules.mk
new file mode 100644
--- /dev/null
+++ b/editor/ui/locales/Makefile.in
@@ -0,0 +1,15 @@
+# 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/.
+
+DEPTH          = @DEPTH@
+topsrcdir      = @top_srcdir@
+srcdir         = @srcdir@
+VPATH          = @srcdir@
+relativesrcdir = @relativesrcdir@
+
+include $(DEPTH)/config/autoconf.mk
+
+DEFINES += -DAB_CD=$(AB_CD)
+
+include $(topsrcdir)/config/rules.mk
--- a/im/Makefile.in
+++ b/im/Makefile.in
@@ -1,13 +1,20 @@
 #
 # 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/.
 
+DEPTH		= @DEPTH@
+topsrcdir	= @top_srcdir@
+srcdir		= @srcdir@
+VPATH		= @srcdir@
+
+include $(topsrcdir)/config/config.mk
+
 include $(topsrcdir)/config/rules.mk
 
 ifdef MAKENSISU
 # For Windows build the uninstaller during the application build since the
 # uninstaller is included with the application for mar file generation.
 libs::
 	$(MAKE) -C installer/windows uninstaller
 endif
--- a/im/app/Makefile.in
+++ b/im/app/Makefile.in
@@ -15,16 +15,17 @@ DEFINES += -DMOZ_SOURCE_STAMP="$(MOZ_SOU
 endif
 
 SOURCE_REPO := $(shell hg -R $(topsrcdir) showconfig paths.default 2>/dev/null | sed -e "s/^ssh:/http:/")
 ifdef SOURCE_REPO
 DEFINES += -DMOZ_SOURCE_REPO="$(SOURCE_REPO)"
 endif
 
 DEFINES += \
+  -DAB_CD=$(AB_CD) \
   -DINSTANTBIRD_ICO=\"$(DIST)/branding/instantbird.ico\" \
   -DGRE_MILESTONE=$(GRE_MILESTONE) \
   -DGRE_BUILDID=$(GRE_BUILDID) \
    $(NULL)
 
 ifdef LIBXUL_SDK
 include $(topsrcdir)/config/rules.mk
 else
new file mode 100644
--- /dev/null
+++ b/im/app/profile/Makefile.in
@@ -0,0 +1,21 @@
+#
+# 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/.
+
+DEPTH		= @DEPTH@
+topsrcdir	= @top_srcdir@
+srcdir		= @srcdir@
+VPATH		= @srcdir@
+
+include $(DEPTH)/config/autoconf.mk
+
+include $(topsrcdir)/config/rules.mk
+
+FILES := \
+	mimeTypes.rdf \
+	localstore.rdf \
+	$(NULL)
+
+libs:: $(FILES)
+	$(SYSINSTALL) $(IFLAGS1) $^ $(DIST)/bin/defaults/profile
new file mode 100644
--- /dev/null
+++ b/im/app/profile/extensions/Makefile.in
@@ -0,0 +1,12 @@
+# 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/.
+
+DEPTH		= @DEPTH@
+topsrcdir	= @top_srcdir@
+srcdir		= @srcdir@
+VPATH		= @srcdir@
+
+include $(DEPTH)/config/autoconf.mk
+
+include $(topsrcdir)/config/rules.mk
--- a/im/app/profile/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}/Makefile.in
+++ b/im/app/profile/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}/Makefile.in
@@ -1,8 +1,26 @@
 #
 # 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/.
 
-THEME_FILES := install.rdf.in
-THEME_FILES_PATH := $(FINAL_TARGET)/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}
-PP_TARGETS := THEME_FILES
+DEPTH		= @DEPTH@
+topsrcdir	= @top_srcdir@
+srcdir		= @srcdir@
+VPATH		= @srcdir@
+
+include $(DEPTH)/config/autoconf.mk
+include $(topsrcdir)/config/rules.mk
+
+FILES := \
+	install.rdf \
+	chrome.manifest \
+	preview.png \
+	$(NULL)
+
+install.rdf: install.rdf.in
+	$(call py_action,preprocessor,$(DEFINES) $(ACDEFINES) $< -o $@)
+
+libs:: $(FILES)
+	$(INSTALL) $(foreach f,$^,"$f") $(DIST)/bin/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}
+
+GARBAGE += install.rdf
--- a/im/app/profile/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}/moz.build
+++ b/im/app/profile/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}/moz.build
@@ -1,11 +1,6 @@
 # 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/.
 
 DEFINES['INSTANTBIRD_VERSION'] = CONFIG['INSTANTBIRD_VERSION']
-
-FINAL_TARGET_FILES.extensions['{972ce4c6-7e08-4474-a285-3208198ce6fd}'] += [
-    'chrome.manifest',
-    'preview.png',
-]
--- a/im/app/profile/moz.build
+++ b/im/app/profile/moz.build
@@ -2,13 +2,8 @@
 # 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 += ['extensions']
 
 if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('gtk2', 'mac', 'cocoa'):
     DEFINES['HAVE_SHELL_SERVICE'] = 1
-
-FINAL_TARGET_FILES.defaults.profile += [
-    'localstore.rdf',
-    'mimeTypes.rdf',
-]
--- a/im/branding/halloween/Makefile.in
+++ b/im/branding/halloween/Makefile.in
@@ -1,14 +1,21 @@
 # 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/.
 
 # Branding Makefile for nightlies/unofficial branding
 
+DEPTH = @DEPTH@
+topsrcdir = @top_srcdir@
+srcdir = @srcdir@
+VPATH = @srcdir@
+
+include $(DEPTH)/config/autoconf.mk
+
 include $(topsrcdir)/config/rules.mk
 
 export::
 	$(NSINSTALL) -D $(DIST)/branding
 ifeq ($(OS_ARCH),WINNT)
 	cp $(srcdir)/instantbird.ico   $(DIST)/branding/instantbird.ico
 	cp $(srcdir)/instantbird.ico   $(DIST)/branding/app.ico
 	cp $(srcdir)/branding.nsi      $(DIST)/branding/branding.nsi
new file mode 100644
--- /dev/null
+++ b/im/branding/halloween/locales/Makefile.in
@@ -0,0 +1,15 @@
+# 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/.
+
+DEPTH          = @DEPTH@
+topsrcdir      = @top_srcdir@
+srcdir         = @srcdir@
+VPATH          = @srcdir@
+relativesrcdir = @relativesrcdir@
+
+include $(DEPTH)/config/autoconf.mk
+
+DEFINES += -DAB_CD=$(AB_CD)
+
+include $(topsrcdir)/config/rules.mk
--- a/im/branding/nightly/Makefile.in
+++ b/im/branding/nightly/Makefile.in
@@ -1,14 +1,21 @@
 # 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/.
 
 # Branding Makefile for nightlies/unofficial branding
 
+DEPTH = @DEPTH@
+topsrcdir = @top_srcdir@
+srcdir = @srcdir@
+VPATH = @srcdir@
+
+include $(DEPTH)/config/autoconf.mk
+
 include $(topsrcdir)/config/rules.mk
 
 export::
 	$(NSINSTALL) -D $(DIST)/branding
 ifeq ($(OS_ARCH),WINNT)
 	cp $(srcdir)/instantbird.ico   $(DIST)/branding/instantbird.ico
 	cp $(srcdir)/instantbird.ico   $(DIST)/branding/app.ico
 	cp $(srcdir)/branding.nsi      $(DIST)/branding/branding.nsi
new file mode 100644
--- /dev/null
+++ b/im/branding/nightly/locales/Makefile.in
@@ -0,0 +1,15 @@
+# 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/.
+
+DEPTH          = @DEPTH@
+topsrcdir      = @top_srcdir@
+srcdir         = @srcdir@
+VPATH          = @srcdir@
+relativesrcdir = @relativesrcdir@
+
+include $(DEPTH)/config/autoconf.mk
+
+DEFINES += -DAB_CD=$(AB_CD)
+
+include $(topsrcdir)/config/rules.mk
--- a/im/installer/Makefile.in
+++ b/im/installer/Makefile.in
@@ -1,12 +1,19 @@
 # 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/.
 
+DEPTH		= @DEPTH@
+topsrcdir	= @top_srcdir@
+srcdir		= @srcdir@
+VPATH		= @srcdir@
+
+include $(DEPTH)/config/autoconf.mk
+
 STANDALONE_MAKEFILE := 1
 
 include $(topsrcdir)/config/rules.mk
 
 MOZ_PKG_REMOVALS = $(srcdir)/removed-files.in
 
 MOZ_PKG_MANIFEST_P = $(srcdir)/package-manifest.in
 # Some files have been already bundled with xulrunner
@@ -16,17 +23,17 @@ endif
 
 MOZ_NONLOCALIZED_PKG_LIST = \
 	xpcom \
 	im \
 	$(NULL)
 
 MOZ_LOCALIZED_PKG_LIST = $(AB_CD)
 
-DEFINES += -DMOZ_APP_NAME=$(MOZ_APP_NAME) -DPREF_DIR=$(PREF_DIR)
+DEFINES += -DAB_CD=$(AB_CD) -DMOZ_APP_NAME=$(MOZ_APP_NAME) -DPREF_DIR=$(PREF_DIR)
 
 ifdef MOZ_DEBUG
 DEFINES += -DMOZ_DEBUG=1
 endif
 
 ifdef MOZ_ENABLE_GNOME_COMPONENT
 DEFINES += -DMOZ_ENABLE_GNOME_COMPONENT=1
 endif
--- a/im/installer/windows/Makefile.in
+++ b/im/installer/windows/Makefile.in
@@ -1,12 +1,19 @@
 # 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/.
 
+DEPTH		= @DEPTH@
+topsrcdir	= @top_srcdir@
+srcdir		= @srcdir@
+VPATH		= @srcdir@
+
+include $(DEPTH)/config/autoconf.mk
+
 include $(MOZILLA_SRCDIR)/toolkit/mozapps/installer/package-name.mk
 
 PKG_INST_PATH =
 CONFIG_DIR = instgen
 SFX_MODULE = $(topsrcdir)/other-licenses/7zstub/instantbird/7zSD.sfx
 DEFINES += -DMOZ_APP_VERSION=$(MOZ_APP_VERSION)
 PRE_RELEASE_SUFFIX := $(shell $(PYTHON) $(topsrcdir)/mozilla/config/printprereleasesuffix.py $(MOZ_APP_VERSION))
 DEFINES += -DPRE_RELEASE_SUFFIX="$(PRE_RELEASE_SUFFIX)"
@@ -25,16 +32,17 @@ INSTALLER_FILES = \
 BRANDING_FILES = \
 	branding.nsi \
 	wizHeader.bmp \
 	wizHeaderRTL.bmp \
 	wizWatermark.bmp \
 	$(NULL)
 
 DEFINES += \
+	-DAB_CD=$(AB_CD) \
 	-DMOZ_APP_NAME=$(MOZ_APP_NAME) \
 	-DMOZ_APP_DISPLAYNAME=${MOZ_APP_DISPLAYNAME} \
 	-DMOZILLA_VERSION=${MOZILLA_VERSION} \
 	$(NULL)
 
 include $(topsrcdir)/config/config.mk
 
 OVERRIDE_DEFAULT_GOAL := installer
--- a/im/locales/Makefile.in
+++ b/im/locales/Makefile.in
@@ -1,12 +1,20 @@
 # 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/.
 
+DEPTH           = @DEPTH@
+topsrcdir       = @top_srcdir@
+srcdir          = @srcdir@
+VPATH           = @srcdir@
+relativesrcdir  = @relativesrcdir@
+
+include $(DEPTH)/config/autoconf.mk
+
 include $(topsrcdir)/config/config.mk
 
 vpath %.xml @srcdir@/en-US/searchplugins
 vpath %.xml $(LOCALE_SRCDIR)/searchplugins
 
 _ABS_SRCDIR := $(abspath $(topsrcdir))
 
 ifndef MOZ_BRANDING_DIRECTORY
new file mode 100644
--- /dev/null
+++ b/im/themes/Makefile.in
@@ -0,0 +1,16 @@
+# 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/.
+
+DEPTH		= @DEPTH@
+topsrcdir	= @top_srcdir@
+srcdir		= @srcdir@
+VPATH		= @srcdir@
+
+include $(DEPTH)/config/autoconf.mk
+
+ICON_FILES := icon.png
+ICON_DEST = $(FINAL_TARGET)/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}
+INSTALL_TARGETS += ICON
+
+include $(topsrcdir)/config/rules.mk
--- a/im/themes/moz.build
+++ b/im/themes/moz.build
@@ -1,10 +1,6 @@
 # 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/.
 
 JAR_MANIFESTS += ['jar.mn']
-
-FINAL_TARGET_Files.extensions['{972ce4c6-7e08-4474-a285-3208198ce6fd}'] += [
-    'icon.png',
-]
new file mode 100644
--- /dev/null
+++ b/ldap/xpcom/src/Makefile.in
@@ -0,0 +1,20 @@
+# 
+# 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/.
+
+DEPTH		= @DEPTH@
+topsrcdir	= @top_srcdir@
+srcdir		= @srcdir@
+VPATH		= @srcdir@
+
+include $(DEPTH)/config/autoconf.mk
+
+ifdef MOZ_PREF_EXTENSIONS
+DEFINES += -DMOZ_PREF_EXTENSIONS
+endif
+
+include $(topsrcdir)/config/rules.mk
+
+LOCAL_INCLUDES	= $(LDAP_CFLAGS)
+
--- a/ldap/xpcom/src/moz.build
+++ b/ldap/xpcom/src/moz.build
@@ -15,17 +15,16 @@ SOURCES += [
     'nsLDAPSecurityGlue.cpp',
     'nsLDAPServer.cpp',
     'nsLDAPService.cpp',
     'nsLDAPURL.cpp',
 ]
 
 if CONFIG['MOZ_PREF_EXTENSIONS']:
     SOURCES += ['nsLDAPSyncQuery.cpp']
-    DEFINES['MOZ_PREF_EXTENSIONS'] = True
 
 EXTRA_COMPONENTS += [
     'ldapComponents.manifest',
     'nsLDAPProtocolHandler.js',
 ]
 
 USE_LIBS += [
     'ldapsdks',
@@ -42,9 +41,8 @@ if CONFIG['MOZ_INCOMPLETE_EXTERNAL_LINKA
 # is discarded when it comes first.
     USE_LIBS += [
         'js',
     ]
 else:
     Library('mozldap')
     FINAL_LIBRARY = 'xul'
 
-CXXFLAGS += [CONFIG['LDAP_CFLAGS']]
--- a/mail/Makefile.in
+++ b/mail/Makefile.in
@@ -1,13 +1,18 @@
 #
 # 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/.
 
+DEPTH		= @DEPTH@
+topsrcdir	= @top_srcdir@
+srcdir		= @srcdir@
+VPATH		= @srcdir@
+
 include $(topsrcdir)/config/config.mk
 
 ifdef ENABLE_TESTS
 
 check-sync-dirs::
 	@$(PYTHON) $(topsrcdir)/mail/check-sync-dirs.py \
 	   $(topsrcdir)/build $(MOZILLA_SRCDIR)/build
 	@$(PYTHON) $(topsrcdir)/mail/check-sync-dirs.py \
--- a/mail/app/Makefile.in
+++ b/mail/app/Makefile.in
@@ -13,16 +13,17 @@ DEFINES += -DMOZ_SOURCE_STAMP="$(MOZ_SOU
 endif
 
 SOURCE_REPO := $(shell hg -R $(topsrcdir) showconfig paths.default 2>/dev/null | sed -e "s/^ssh:/http:/")
 ifdef SOURCE_REPO
 DEFINES += -DMOZ_SOURCE_REPO="$(SOURCE_REPO)"
 endif
 
 DEFINES += \
+  -DAB_CD=$(AB_CD) \
   -DTHUNDERBIRD_ICO='"$(DIST)/branding/thunderbird.ico"' \
   -DGRE_MILESTONE=$(GRE_MILESTONE) \
   -DGRE_BUILDID=$(GRE_BUILDID) \
    $(NULL)
 
 ifdef LIBXUL_SDK
 include $(topsrcdir)/config/rules.mk
 else
new file mode 100644
--- /dev/null
+++ b/mail/app/profile/Makefile.in
@@ -0,0 +1,21 @@
+#
+# 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/.
+
+DEPTH		= @DEPTH@
+topsrcdir	= @top_srcdir@
+srcdir		= @srcdir@
+VPATH		= @srcdir@
+
+include $(DEPTH)/config/autoconf.mk
+
+include $(topsrcdir)/config/rules.mk
+
+FILES := \
+	mimeTypes.rdf \
+	localstore.rdf \
+	$(NULL)
+
+libs:: $(FILES)
+	$(SYSINSTALL) $(IFLAGS1) $^ $(DIST)/bin/defaults/profile
--- a/mail/app/profile/extensions/Makefile.in
+++ b/mail/app/profile/extensions/Makefile.in
@@ -1,15 +1,22 @@
 #
 # 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/.
 
+DEPTH		= @DEPTH@
+topsrcdir	= @top_srcdir@
+srcdir		= @srcdir@
+VPATH		= @srcdir@
+
 DISTROEXT = $(abspath $(DIST))/bin/distribution/extensions
 
+include $(DEPTH)/config/autoconf.mk
+
 include $(topsrcdir)/config/rules.mk
 
 # If adding extra extensions here, check that EXTRA_ARGS defined below won't
 # affect them unintentionally.
 EXTENSIONS = \
   $(NULL)
 
 # We are in release mode, we don't want to ship the debug file.
--- a/mail/app/profile/moz.build
+++ b/mail/app/profile/moz.build
@@ -1,11 +1,7 @@
 # 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 += ['extensions']
 
-FINAL_TARGET_FILES.defaults.profile += [
-    'localstore.rdf',
-    'mimeTypes.rdf',
-]
new file mode 100644
--- /dev/null
+++ b/mail/branding/aurora/locales/Makefile.in
@@ -0,0 +1,15 @@
+# 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/.
+
+DEPTH          = @DEPTH@
+topsrcdir      = @top_srcdir@
+srcdir         = @srcdir@
+VPATH          = @srcdir@
+relativesrcdir = @relativesrcdir@
+
+include $(DEPTH)/config/autoconf.mk
+
+DEFINES += -DAB_CD=$(AB_CD)
+
+include $(topsrcdir)/config/rules.mk
new file mode 100644
--- /dev/null
+++ b/mail/branding/nightly/locales/Makefile.in
@@ -0,0 +1,15 @@
+# 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/.
+
+DEPTH          = @DEPTH@
+topsrcdir      = @top_srcdir@
+srcdir         = @srcdir@
+VPATH          = @srcdir@
+relativesrcdir = @relativesrcdir@
+
+include $(DEPTH)/config/autoconf.mk
+
+DEFINES += -DAB_CD=$(AB_CD)
+
+include $(topsrcdir)/config/rules.mk
--- a/mail/components/devtools/extension/Makefile.in
+++ b/mail/components/devtools/extension/Makefile.in
@@ -2,9 +2,15 @@
 # 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/.
 
 USE_EXTENSION_MANIFEST = 1
 XPI_PKGNAME = dbgserver-$(MOZILLA_VERSION).$(AB_CD)
 DIST_FILES = install.rdf bootstrap.js
 relativesrcdir = mail/locales
 
-DEFINES += -DLOCALE_SRCDIR=$(LOCALE_SRCDIR)
+include $(DEPTH)/config/autoconf.mk
+
+DEFINES += -DAB_CD=$(AB_CD) \
+           -DLOCALE_SRCDIR=$(LOCALE_SRCDIR) \
+           $(NULL)
+
+include $(topsrcdir)/config/rules.mk
--- a/mail/installer/Makefile.in
+++ b/mail/installer/Makefile.in
@@ -1,12 +1,19 @@
 # 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/.
 
+DEPTH		= @DEPTH@
+topsrcdir	= @top_srcdir@
+srcdir		= @srcdir@
+VPATH		= @srcdir@
+
+include $(DEPTH)/config/autoconf.mk
+
 STANDALONE_MAKEFILE := 1
 
 include $(topsrcdir)/config/rules.mk
 
 MOZ_PKG_REMOVALS = $(srcdir)/removed-files.in
 
 MOZ_PKG_MANIFEST_P = $(srcdir)/package-manifest.in
 # Some files have been already bundled with xulrunner
@@ -18,17 +25,17 @@ MOZ_NONLOCALIZED_PKG_LIST = \
 	xpcom \
 	mail \
 	newsblog \
 	offline \
 	$(NULL)
 
 MOZ_LOCALIZED_PKG_LIST = $(AB_CD)
 
-DEFINES += -DMOZ_APP_NAME=$(MOZ_APP_NAME) -DPREF_DIR=$(PREF_DIR)
+DEFINES += -DAB_CD=$(AB_CD) -DMOZ_APP_NAME=$(MOZ_APP_NAME) -DPREF_DIR=$(PREF_DIR)
 
 ifdef MOZ_DEBUG
 DEFINES += -DMOZ_DEBUG=1
 endif
 
 ifdef MOZ_ENABLE_GNOME_COMPONENT
 DEFINES += -DMOZ_ENABLE_GNOME_COMPONENT=1
 endif
--- a/mail/installer/windows/Makefile.in
+++ b/mail/installer/windows/Makefile.in
@@ -1,12 +1,19 @@
 # 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/.
 
+DEPTH		= @DEPTH@
+topsrcdir	= @top_srcdir@
+srcdir		= @srcdir@
+VPATH		= @srcdir@
+
+include $(DEPTH)/config/autoconf.mk
+
 include $(MOZILLA_SRCDIR)/toolkit/mozapps/installer/package-name.mk
 
 CONFIG_DIR = instgen
 SFX_MODULE = $(topsrcdir)/other-licenses/7zstub/thunderbird/7zSD.sfx
 
 DEFINES += -DMOZ_APP_VERSION=$(MOZ_APP_VERSION)
 PRE_RELEASE_SUFFIX := ""
 DEFINES += -DPRE_RELEASE_SUFFIX="$(PRE_RELEASE_SUFFIX)"
@@ -32,16 +39,17 @@ endif
 BRANDING_FILES = \
 	branding.nsi \
 	wizHeader.bmp \
 	wizHeaderRTL.bmp \
 	wizWatermark.bmp \
 	$(NULL)
 
 DEFINES += \
+	-DAB_CD=$(AB_CD) \
 	-DMOZ_APP_NAME=$(MOZ_APP_NAME) \
 	-DMOZ_APP_DISPLAYNAME='${MOZ_APP_DISPLAYNAME}' \
 	-DMOZILLA_VERSION=${MOZILLA_VERSION} \
 	$(NULL)
 
 include $(topsrcdir)/config/config.mk
 
 ifdef LOCALE_MERGEDIR
--- a/mail/locales/Makefile.in
+++ b/mail/locales/Makefile.in
@@ -1,12 +1,20 @@
 # 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/.
 
+DEPTH           = @DEPTH@
+topsrcdir       = @top_srcdir@
+srcdir          = @srcdir@
+VPATH           = @srcdir@
+relativesrcdir  = @relativesrcdir@
+
+include $(DEPTH)/config/autoconf.mk
+
 include $(topsrcdir)/config/config.mk
 
 vpath %.xml @srcdir@/en-US/searchplugins
 vpath %.xml $(LOCALE_SRCDIR)/searchplugins
 
 _ABS_SRCDIR := $(abspath $(topsrcdir))
 
 SUBMAKEFILES += \
--- a/mail/test/mozmill/Makefile.in
+++ b/mail/test/mozmill/Makefile.in
@@ -1,28 +1,41 @@
 #
 # 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/.
 
+DEPTH		= @DEPTH@
+topsrcdir	= @top_srcdir@
+srcdir		= @srcdir@
+VPATH		= @srcdir@
+relativesrcdir = @relativesrcdir@
+
+include $(DEPTH)/config/autoconf.mk
+
 include $(topsrcdir)/config/rules.mk
 
 # We're installing to _tests/mozmill
 _DEST_DIR = $(DEPTH)/_tests/mozmill
 
 $(_DEST_DIR):
 	$(NSINSTALL) -D $@
 
+# Copy the mailnews and mail resources that we require.
+libs:: $(_DEST_DIR)
+	$(INSTALL) $(topsrcdir)/mailnews/test/resources/* $(_DEST_DIR)/resources
+	$(INSTALL) $(topsrcdir)/mailnews/test/fakeserver/* $(_DEST_DIR)/resources
+	$(INSTALL) $(topsrcdir)/mail/base/test/unit/resources/* $(_DEST_DIR)/resources
 
 # Copy MozMill and its dependencies over, and set up a virtualenv. The
 # virtualenv directory is outside because we don't want to bundle it up during
 # stage-package.
 VIRTUALENV_DIR = $(_DEST_DIR)/../mozmill-virtualenv
 mozmill-virtualenv: NSDISTMODE=copy
-mozmill-virtualenv: $(_DEST_DIR)
+mozmill-virtualenv:
 	$(INSTALL) $(topsrcdir)/mail/test/resources $(_DEST_DIR)
 	$(INSTALL) $(topsrcdir)/mozilla/python/virtualenv $(_DEST_DIR)/resources/
 	rm -rf $(VIRTUALENV_DIR) && \
 	mkdir $(VIRTUALENV_DIR) && \
 	unset MACOSX_DEPLOYMENT_TARGET && \
 	$(PYTHON) $(_DEST_DIR)/resources/installmozmill.py $(VIRTUALENV_DIR) $(MOZILLA_DIR)/testing/mozbase
 
 libs:: mozmill-virtualenv
--- a/mail/test/mozmill/moz.build
+++ b/mail/test/mozmill/moz.build
@@ -3,15 +3,8 @@
 # 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/.
 
 TEST_HARNESS_FILES.mozmill += [
     'mozmilltests.list',
     'runtest.py',
     'runtestlist.py',
 ]
-
-TEST_HARNESS_FILES.mozmill.resources += [
-    '/mail/base/test/unit/resources/**',
-    '/mailnews/test/fakeserver/**',
-    '/mailnews/test/resources/**',
-]
-
--- a/mail/themes/Makefile.in
+++ b/mail/themes/Makefile.in
@@ -1,5 +1,14 @@
 # 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/.
 
+DEPTH		= @DEPTH@
+topsrcdir	= @top_srcdir@
+srcdir		= @srcdir@
+VPATH		= @srcdir@
+
+include $(topsrcdir)/config/config.mk
+
 DIST_FILES = install.rdf
+
+include $(topsrcdir)/config/rules.mk
new file mode 100644
--- /dev/null
+++ b/mail/themes/linux/Makefile.in
@@ -0,0 +1,23 @@
+# 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/.
+
+DEPTH		= @DEPTH@
+topsrcdir	= @top_srcdir@
+srcdir		= @srcdir@
+VPATH		= @srcdir@
+
+include $(DEPTH)/config/autoconf.mk
+
+include $(topsrcdir)/config/rules.mk
+
+CLASSIC_EXTENSION_DIR = {972ce4c6-7e08-4474-a285-3208198ce6fd}
+
+FILES := \
+  ../shared/mail/icon.png \
+  ../shared/mail/icon64.png \
+  mail/chrome.manifest \
+  $(NULL)
+
+libs:: $(FILES)
+	$(INSTALL) $(foreach f,$^,"$f") $(DIST)/bin/extensions/$(CLASSIC_EXTENSION_DIR)
--- a/mail/themes/linux/moz.build
+++ b/mail/themes/linux/moz.build
@@ -1,12 +1,6 @@
 # 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/.
 
 JAR_MANIFESTS += ['jar.mn']
-
-FINAL_TARGET_FILES.extensions['{972ce4c6-7e08-4474-a285-3208198ce6fd}'] += [
-    '../shared/mail/icon.png',
-    '../shared/mail/icon64.png',
-    'mail/chrome.manifest',
-]
new file mode 100644
--- /dev/null
+++ b/mail/themes/osx/Makefile.in
@@ -0,0 +1,23 @@
+# 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/.
+
+DEPTH		= @DEPTH@
+topsrcdir	= @top_srcdir@
+srcdir		= @srcdir@
+VPATH		= @srcdir@
+
+include $(DEPTH)/config/autoconf.mk
+
+include $(topsrcdir)/config/rules.mk
+
+CLASSIC_EXTENSION_DIR = {972ce4c6-7e08-4474-a285-3208198ce6fd}
+
+FILES := \
+  ../shared/mail/icon.png \
+  ../shared/mail/icon64.png \
+  mail/chrome.manifest \
+  $(NULL)
+
+libs:: $(FILES)
+	$(INSTALL) $(foreach f,$^,"$f") $(DIST)/bin/extensions/$(CLASSIC_EXTENSION_DIR)
--- a/mail/themes/osx/moz.build
+++ b/mail/themes/osx/moz.build
@@ -1,12 +1,6 @@
 # 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/.
 
 JAR_MANIFESTS += ['jar.mn']
-
-FINAL_TARGET_FILES.extensions['{972ce4c6-7e08-4474-a285-3208198ce6fd}'] += [
-    '../shared/mail/icon.png',
-    '../shared/mail/icon64.png',
-    'mail/chrome.manifest',
-]
new file mode 100644
--- /dev/null
+++ b/mail/themes/windows/Makefile.in
@@ -0,0 +1,23 @@
+# 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/.
+
+DEPTH		= @DEPTH@
+topsrcdir	= @top_srcdir@
+srcdir		= @srcdir@
+VPATH		= @srcdir@
+
+include $(DEPTH)/config/autoconf.mk
+
+include $(topsrcdir)/config/rules.mk
+
+CLASSIC_EXTENSION_DIR = {972ce4c6-7e08-4474-a285-3208198ce6fd}
+
+FILES := \
+  ../shared/mail/icon.png \
+  ../shared/mail/icon64.png \
+  mail/chrome.manifest \
+  $(NULL)
+
+libs:: $(FILES)
+	$(INSTALL) $(foreach f,$^,"$f") $(DIST)/bin/extensions/$(CLASSIC_EXTENSION_DIR)
--- a/mail/themes/windows/moz.build
+++ b/mail/themes/windows/moz.build
@@ -1,12 +1,6 @@
 # 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/.
 
 JAR_MANIFESTS += ['jar.mn']
-
-FINAL_TARGET_FILES.extensions['{972ce4c6-7e08-4474-a285-3208198ce6fd}'] += [
-    '../shared/mail/icon.png',
-    '../shared/mail/icon64.png',
-    'mail/chrome.manifest',
-]
new file mode 100644
--- /dev/null
+++ b/mailnews/Makefile.in
@@ -0,0 +1,12 @@
+#
+# 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/.
+
+include $(topsrcdir)/config/rules.mk
+
+ifdef ENABLE_TESTS
+libs::
+	$(INSTALL) $(wildcard $(srcdir)/test/resources/*.js) $(DEPTH)/_tests/xpcshell/mailnews/resources
+	$(INSTALL) $(wildcard $(srcdir)/test/data/*) $(DEPTH)/_tests/xpcshell/mailnews/data
+endif
new file mode 100644
--- /dev/null
+++ b/mailnews/base/ispdata/Makefile.in
@@ -0,0 +1,35 @@
+#
+# 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/.
+
+DEPTH		= @DEPTH@
+topsrcdir	= @top_srcdir@
+srcdir		= @srcdir@
+VPATH		= @srcdir@
+
+include $(DEPTH)/config/autoconf.mk
+
+EXPORT_DIR      = $(DIST)/bin/isp
+
+EXPORT_RESOURCE_FILES =  \
+		$(NULL)
+
+ifdef MOZ_MOVEMAIL
+ifdef MOZ_THUNDERBIRD
+ifneq (cocoa,$(MOZ_WIDGET_TOOLKIT))
+EXPORT_RESOURCE_FILES += movemail.rdf
+endif
+else
+EXPORT_RESOURCE_FILES += movemail.rdf
+endif
+endif
+
+include $(topsrcdir)/config/rules.mk
+
+GARBAGE		+= $(addprefix $(EXPORT_DIR)/, $(EXPORT_RESOURCE_FILES)) 
+
+ifneq ($(EXPORT_RESOURCE_FILES),$(NULL))
+libs:: $(EXPORT_RESOURCE_FILES)
+	$(INSTALL) $^ $(EXPORT_DIR)
+endif
--- a/mailnews/base/ispdata/moz.build
+++ b/mailnews/base/ispdata/moz.build
@@ -1,8 +1,4 @@
 # 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/.
-
-# Disable movemail for Thunderbird on OSX
-if CONFIG['MOZ_MOVEMAIL'] and not (CONFIG['MOZ_THUNDERBIRD'] and CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa'):
-    FINAL_TARGET_FILES.isp += ['movemail.rdf']
new file mode 100644
--- /dev/null
+++ b/mailnews/base/search/src/Makefile.in
@@ -0,0 +1,29 @@
+#
+# 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/.
+
+DEPTH		= @DEPTH@
+topsrcdir	= @top_srcdir@
+srcdir		= @srcdir@
+VPATH		= @srcdir@
+
+include $(DEPTH)/config/autoconf.mk
+
+EXPORT_DIR	= $(DIST)/bin/isp
+
+
+EXPORT_RESOURCE_FILES	= \
+				  Bogofilter.sfd \
+				  DSPAM.sfd \
+				  POPFile.sfd \
+				  SpamAssassin.sfd \
+				  SpamPal.sfd \
+			        $(NULL)
+
+include $(topsrcdir)/config/rules.mk
+
+GARBAGE += $(addprefix $(EXPORT_DIR)/, $(EXPORT_RESOURCE_FILES)) 
+
+libs:: $(EXPORT_RESOURCE_FILES)
+	 $(INSTALL) $^ $(EXPORT_DIR)
--- a/mailnews/base/search/src/moz.build
+++ b/mailnews/base/search/src/moz.build
@@ -19,15 +19,8 @@ SOURCES += [
 
 EXTRA_COMPONENTS += [
     'nsMsgTraitService.js',
     'nsMsgTraitService.manifest',
 ]
 
 FINAL_LIBRARY = 'mail'
 
-FINAL_TARGET_FILES.isp += [
-    'Bogofilter.sfd',
-    'DSPAM.sfd',
-    'POPFile.sfd',
-    'SpamAssassin.sfd',
-    'SpamPal.sfd',
-]
new file mode 100644
--- /dev/null
+++ b/mailnews/extensions/dsn/Makefile.in
@@ -0,0 +1,16 @@
+#
+# 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/.
+
+DEPTH		= @DEPTH@
+topsrcdir	= @top_srcdir@
+srcdir		= @srcdir@
+VPATH		= @srcdir@
+
+include $(DEPTH)/config/autoconf.mk
+
+include $(topsrcdir)/config/rules.mk
+
+libs::
+	$(INSTALL) $(srcdir)/content/dsn.js $(DIST)/bin/defaults/pref
--- a/mailnews/extensions/dsn/moz.build
+++ b/mailnews/extensions/dsn/moz.build
@@ -4,12 +4,8 @@
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 EXTRA_COMPONENTS += [
     'src/dsn-service.js',
     'src/dsn-service.manifest',
 ]
 
 JAR_MANIFESTS += ['jar.mn']
-
-JS_PREFERENCE_FILES += [
-    'content/dsn.js',
-]
\ No newline at end of file
new file mode 100644
--- /dev/null
+++ b/mailnews/extensions/mailviews/content/Makefile.in
@@ -0,0 +1,24 @@
+#
+# 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/.
+
+DEPTH = @DEPTH@
+topsrcdir	= @top_srcdir@
+VPATH		= @srcdir@
+srcdir		= @srcdir@
+
+include $(DEPTH)/config/autoconf.mk
+
+EXPORT_DIR	= $(DIST)/bin/defaults/messenger
+
+EXPORT_RESOURCE_FILES	= \
+			mailViews.dat \
+			$(NULL)
+
+include $(topsrcdir)/config/rules.mk
+
+GARBAGE		+= $(addprefix $(EXPORT_DIR)/, $(EXPORT_RESOURCE_FILES))
+
+libs:: $(EXPORT_RESOURCE_FILES)
+	$(INSTALL) $^ $(EXPORT_DIR)
--- a/mailnews/extensions/mailviews/content/moz.build
+++ b/mailnews/extensions/mailviews/content/moz.build
@@ -1,8 +1,5 @@
 # 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/.
 
-FINAL_TARGET_FILES.defaults.messenger += [
-    'mailViews.dat',
-]
new file mode 100644
--- /dev/null
+++ b/mailnews/extensions/mdn/Makefile.in
@@ -0,0 +1,16 @@
+#
+# 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/.
+
+DEPTH		= @DEPTH@
+topsrcdir	= @top_srcdir@
+srcdir		= @srcdir@
+VPATH		= @srcdir@
+
+include $(DEPTH)/config/autoconf.mk
+
+include $(topsrcdir)/config/rules.mk
+
+libs::
+	$(INSTALL) $(srcdir)/content/mdn.js $(DIST)/bin/defaults/pref
--- a/mailnews/extensions/mdn/moz.build
+++ b/mailnews/extensions/mdn/moz.build
@@ -2,12 +2,8 @@
 # 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 += ['src']
 TEST_DIRS += ['test']
 
 JAR_MANIFESTS += ['jar.mn']
-
-JS_PREFERENCE_FILES += [
-    'content/mdn.js',
-]
new file mode 100644
--- /dev/null
+++ b/mailnews/extensions/newsblog/Makefile.in
@@ -0,0 +1,29 @@
+#
+# 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/.
+ # 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		= @DEPTH@
+topsrcdir	= @top_srcdir@
+srcdir		= @srcdir@
+VPATH		= @srcdir@
+
+include $(DEPTH)/config/autoconf.mk
+
+EXPORT_DIR	= $(DIST)/bin/isp
+
+GARBAGE += $(EXPORT_DIR)/rss.rdf 
+
+libs:: rss.rdf
+	$(INSTALL) $^ $(EXPORT_DIR)
+
+include $(topsrcdir)/config/rules.mk
--- a/mailnews/extensions/newsblog/moz.build
+++ b/mailnews/extensions/newsblog/moz.build
@@ -7,12 +7,8 @@ EXTRA_COMPONENTS += [
     'js/newsblog.js',
     'js/newsblog.manifest',
 ]
 
 EXTRA_JS_MODULES += [
     'content/FeedUtils.jsm',
 ]
 JAR_MANIFESTS += ['jar.mn']
-
-FINAL_TARGET_FILES.isp += [
-    'rss.rdf',
-]
new file mode 100644
--- /dev/null
+++ b/mailnews/extensions/smime/Makefile.in
@@ -0,0 +1,16 @@
+#
+# 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/.
+
+DEPTH		= @DEPTH@
+topsrcdir	= @top_srcdir@
+srcdir		= @srcdir@
+VPATH		= @srcdir@
+
+include $(DEPTH)/config/autoconf.mk
+
+include $(topsrcdir)/config/rules.mk
+
+libs::
+	$(INSTALL) $(srcdir)/content/smime.js $(DIST)/bin/defaults/pref
--- a/mailnews/extensions/smime/moz.build
+++ b/mailnews/extensions/smime/moz.build
@@ -4,12 +4,8 @@
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 DIRS += [
     'public',
     'src',
 ]
 
 JAR_MANIFESTS += ['jar.mn']
-
-JS_PREFERENCE_FILES += [
-    'content/smime.js',
-]
new file mode 100644
--- /dev/null
+++ b/mailnews/import/build/Makefile.in
@@ -0,0 +1,17 @@
+#
+# 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/.
+
+DEPTH		= @DEPTH@
+topsrcdir	= @top_srcdir@
+srcdir		= @srcdir@
+VPATH		= @srcdir@
+
+include $(DEPTH)/config/autoconf.mk
+
+ifdef MOZ_INCOMPLETE_EXTERNAL_LINKAGE
+SHARED_LIBRARY_LIBS = ../../base/util/$(LIB_PREFIX)msgbsutl_s.$(LIB_SUFFIX)
+endif
+
+include $(topsrcdir)/config/rules.mk
--- a/mailnews/import/build/moz.build
+++ b/mailnews/import/build/moz.build
@@ -9,17 +9,16 @@ SOURCES += [
 
 USE_LIBS += [
     'nspr',
 ]
 
 if CONFIG['MOZ_INCOMPLETE_EXTERNAL_LINKAGE']:
     XPCOMBinaryComponent('import')
     USE_LIBS += [
-        'msgbsutl_s',
         'rdfutil_external_s',
         'unicharutil_external_s',
         'xpcomglue_s',
         'xul',
     ]
 else:
     Library('import')
     FINAL_LIBRARY = 'xul'
--- a/mailnews/mapi/mapiDll/Makefile.in
+++ b/mailnews/mapi/mapiDll/Makefile.in
@@ -1,6 +1,15 @@
 #
 # 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/.
 
+DEPTH		= @DEPTH@
+topsrcdir	= @top_srcdir@
+srcdir		= @srcdir@
+VPATH		= @srcdir@
+
+include $(DEPTH)/config/autoconf.mk
+
 EMBED_MANIFEST_AT = 2
+
+include $(topsrcdir)/config/rules.mk
--- a/mailnews/mapi/mapihook/build/Makefile.in
+++ b/mailnews/mapi/mapihook/build/Makefile.in
@@ -1,13 +1,20 @@
 #
 # 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/.
 
+DEPTH		= @DEPTH@
+topsrcdir	= @top_srcdir@
+srcdir		= @srcdir@
+VPATH		= @srcdir@
+
+include $(DEPTH)/config/autoconf.mk
+
 MIDL_GENERATED_FILES = msgMapi.h msgMapi_p.c msgMapi_i.c dlldata.c
 
 INSTALL_TARGETS += msgmapi
 msgmapi_FILES := msgMapi.h
 msgmapi_DEST = $(DIST)/include
 msgmapi_TARGET := export
 
 SRCDIR_CSRCS	= $(addprefix $(srcdir)/,$(CSRCS))
--- a/mailnews/mapi/mapihook/src/Makefile.in
+++ b/mailnews/mapi/mapihook/src/Makefile.in
@@ -1,6 +1,15 @@
 #
 # 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/.
 
+DEPTH		= @DEPTH@
+topsrcdir	= @top_srcdir@
+srcdir		= @srcdir@
+VPATH		= @srcdir@
+
+include $(DEPTH)/config/autoconf.mk
+
 CSRCS += ../build/msgMapi_i.c
+
+include $(topsrcdir)/config/rules.mk
--- a/mailnews/moz.build
+++ b/mailnews/moz.build
@@ -59,33 +59,25 @@ DIRS += [
 ]
 
 DEFINES['OS_ARCH'] = CONFIG['OS_ARCH']
 DEFINES['MOZ_WIDGET_TOOLKIT'] = CONFIG['MOZ_WIDGET_TOOLKIT']
 
 JAR_MANIFESTS += ['jar.mn']
 
 TESTING_JS_MODULES.mailnews += [
-    'test/fakeserver/auth.js',
-    'test/fakeserver/imapd.js',
-    'test/fakeserver/maild.js',
-    'test/fakeserver/nntpd.js',
-    'test/fakeserver/pop3d.js',
-    'test/fakeserver/smtpd.js',
-    'test/resources/IMAPpump.js',
-    'test/resources/localAccountUtils.js',
-    'test/resources/mailTestUtils.js',
-    'test/resources/MockFactory.js',
-    'test/resources/PromiseTestUtils.jsm',
-]
-
-TEST_HARNESS_FILES.xpcshell.mailnews.data += [
-    '/mailnews/test/data/**',
-]
-
-TEST_HARNESS_FILES.xpcshell.mailnews.resources += [
-    '/mailnews/test/resources/**',
+	'test/fakeserver/auth.js',
+	'test/fakeserver/imapd.js',
+	'test/fakeserver/maild.js',
+	'test/fakeserver/nntpd.js',
+	'test/fakeserver/pop3d.js',
+	'test/fakeserver/smtpd.js',
+	'test/resources/IMAPpump.js',
+	'test/resources/localAccountUtils.js',
+	'test/resources/mailTestUtils.js',
+	'test/resources/MockFactory.js',
+	'test/resources/PromiseTestUtils.jsm',
 ]
 
 JS_PREFERENCE_FILES += [
     'mailnews.js',
 ]
 
--- a/other-licenses/branding/instantbird/Makefile.in
+++ b/other-licenses/branding/instantbird/Makefile.in
@@ -1,14 +1,21 @@
 # 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/.
 
 # Branding Makefile for nightlies/unofficial branding
 
+DEPTH = @DEPTH@
+topsrcdir = @top_srcdir@
+srcdir = @srcdir@
+VPATH = @srcdir@
+
+include $(DEPTH)/config/autoconf.mk
+
 include $(topsrcdir)/config/rules.mk
 
 export::
 	$(NSINSTALL) -D $(DIST)/branding
 ifeq ($(OS_ARCH),WINNT)
 	cp $(srcdir)/instantbird.ico   $(DIST)/branding/instantbird.ico
 	cp $(srcdir)/instantbird.ico   $(DIST)/branding/app.ico
 	cp $(srcdir)/branding.nsi      $(DIST)/branding/branding.nsi
new file mode 100644
--- /dev/null
+++ b/other-licenses/branding/instantbird/locales/Makefile.in
@@ -0,0 +1,15 @@
+# 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/.
+
+DEPTH          = @DEPTH@
+topsrcdir      = @top_srcdir@
+srcdir         = @srcdir@
+VPATH          = @srcdir@
+relativesrcdir = @relativesrcdir@
+
+include $(DEPTH)/config/autoconf.mk
+
+DEFINES += -DAB_CD=$(AB_CD)
+
+include $(topsrcdir)/config/rules.mk
new file mode 100644
--- /dev/null
+++ b/other-licenses/branding/thunderbird/locales/Makefile.in
@@ -0,0 +1,47 @@
+# ***** 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 the Mozilla Browser code.
+#
+# The Initial Developer of the Original Code is
+# Benjamin Smedberg <benjamin@smedbergs.us>
+# Portions created by the Initial Developer are Copyright (C) 2004
+# the Initial Developer. 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          = @DEPTH@
+topsrcdir      = @top_srcdir@
+srcdir         = @srcdir@
+VPATH          = @srcdir@
+relativesrcdir = @relativesrcdir@
+
+include $(DEPTH)/config/autoconf.mk
+
+DEFINES += -DAB_CD=$(AB_CD)
+
+include $(topsrcdir)/config/rules.mk
--- a/suite/Makefile.in
+++ b/suite/Makefile.in
@@ -1,13 +1,20 @@
 #
 # 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/.
 
+DEPTH		= @DEPTH@
+topsrcdir	= @top_srcdir@
+srcdir		= @srcdir@
+VPATH		= @srcdir@
+
+include $(DEPTH)/config/autoconf.mk
+
 include $(topsrcdir)/config/rules.mk
 
 ifdef MAKENSISU
 # For Windows build the uninstaller during the application build since the
 # uninstaller is included with the application for mar file generation.
 libs::
 	$(MAKE) -C installer/windows uninstaller
 endif
--- a/suite/app/Makefile.in
+++ b/suite/app/Makefile.in
@@ -1,12 +1,19 @@
 # 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/.
 
+DEPTH		= @DEPTH@
+topsrcdir	= @top_srcdir@
+srcdir		= @srcdir@
+VPATH		= @srcdir@
+
+include $(DEPTH)/config/autoconf.mk
+
 AB_CD = $(MOZ_UI_LOCALE) 
 
 DEFINES += \
 	-DSEAMONKEY_ICO=\"$(DIST)/branding/seamonkey.ico\" \
 	-DHTML_FILE_ICO=\"$(DIST)/branding/html-file.ico\" \
 	$(NULL)
 
 ifdef LIBXUL_SDK
--- a/suite/branding/nightly/Makefile.in
+++ b/suite/branding/nightly/Makefile.in
@@ -1,15 +1,84 @@
 #
 # 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/.
 
+DEPTH		= @DEPTH@
+topsrcdir	= @top_srcdir@
+srcdir		= @srcdir@
+VPATH		= @srcdir@
+
+include $(DEPTH)/config/autoconf.mk
+
 # Note: mac icons are handled in /suite/app during the final application
 # packaging
+ifneq (,$(filter windows gtk gtk2,$(MOZ_WIDGET_TOOLKIT)))
+ifneq (,$(filter windows,$(MOZ_WIDGET_TOOLKIT)))
+ICON_SUFFIX=.ico
+else
+ICON_SUFFIX=.png
+endif
+
+ifeq ($(MOZ_WIDGET_TOOLKIT),gtk2)
+ICON_DIR=gtk
+else
+ICON_DIR=$(MOZ_WIDGET_TOOLKIT)
+endif
+
+DESKTOP_ICONS = \
+	abcardWindow \
+	ablistWindow \
+	addressbookWindow \
+	bookmarkproperties \
+	downloadManager \
+	editorWindow \
+	findBookmarkWindow \
+	findHistoryWindow \
+	history-window \
+	JSConsoleWindow \
+	main-window \
+	messengerWindow \
+	msgcomposeWindow \
+	places \
+	$(NULL) 
+
+ifeq (windows,$(MOZ_WIDGET_TOOLKIT))
+# Windows icons
+DESKTOP_ICONS += \
+	gif-file \
+	html-file \
+	misc-file \
+	image-file \
+	jpeg-file \
+	script-file \
+	xml-file \
+	xul-file \
+	$(NULL)
+endif
+
+ifeq ($(ICON_DIR),gtk)
+libs:: icons/gtk/seamonkey.png
+	$(INSTALL) $(IFLAGS1) $^ $(DIST)/bin/chrome/icons/default
+
+GARBAGE	+= $(DIST)/bin/chrome/icons/default/seamonkey.png
+
+DESKTOP_ICONS += default
+DESKTOP_ICONS_SMALL = $(patsubst %,%16,$(DESKTOP_ICONS))
+DESKTOP_ICONS_LARGE = $(patsubst %,%48,$(DESKTOP_ICONS))
+endif
+
+DESKTOP_ICON_FILES = $(addsuffix $(ICON_SUFFIX), $(DESKTOP_ICONS) $(DESKTOP_ICONS_SMALL) $(DESKTOP_ICONS_LARGE))
+
+libs:: $(addprefix icons/$(ICON_DIR)/,$(DESKTOP_ICON_FILES))
+	$(INSTALL) $(IFLAGS1) $^ $(DIST)/bin/chrome/icons/default
+
+GARBAGE	+= $(addprefix $(DIST)/bin/chrome/icons/default/,$(DESKTOP_ICON_FILES))
+endif
 
 include $(topsrcdir)/config/rules.mk
 
 export::
 	$(NSINSTALL) -D $(DIST)/branding
 ifeq ($(OS_ARCH),WINNT)
 	cp $(srcdir)/icons/windows/seamonkey.ico      $(DIST)/branding/seamonkey.ico
 	cp $(srcdir)/icons/windows/html-file.ico      $(DIST)/branding/html-file.ico
--- a/suite/branding/nightly/moz.build
+++ b/suite/branding/nightly/moz.build
@@ -1,70 +1,6 @@
 # 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/.
 
 JAR_MANIFESTS += ['jar.mn']
-
-# Note: mac icons are handled in /suite/app during the final application
-# packaging
-if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('windows', 'gtk', 'gtk2'):
-    if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
-        icon_suffix = '.ico'
-    else:
-        icon_suffix = '.png'
-
-    if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gtk2':
-        icon_dir = 'gtk'
-    else:
-        icon_dir = CONFIG['MOZ_WIDGET_TOOLKIT']
-
-    desktop_icons = [
-        'abcardWindow',
-        'ablistWindow',
-        'addressbookWindow',
-        'bookmarkproperties',
-        'downloadManager',
-        'editorWindow',
-        'findBookmarkWindow',
-        'findHistoryWindow',
-        'history-window',
-        'JSConsoleWindow',
-        'main-window',
-        'messengerWindow',
-        'msgcomposeWindow',
-        'places',
-    ]
-
-    if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
-        # Windows icons
-        desktop_icons += [
-            'gif-file',
-            'html-file',
-            'misc-file',
-            'image-file',
-            'jpeg-file',
-            'script-file',
-            'xml-file',
-            'xul-file',
-        ]
-
-    desktop_icons_small = []
-    desktop_icons_large = []
-
-    if ICON_DIR == 'gtk':
-        FINAL_TARGET_FILES.chrome.icons.default += [
-            'icons/gtk/seamonkey.png'
-        ]
-
-        desktop_icons += [
-            'default'
-        ]
-
-        desktop_icons_small = [ '%s16' % i for i in desktop_icons ]
-        desktop_icons_large = [ '%s48' % i for i in desktop_icons ]
-
-    FINAL_TARGET_FILES.chrome.icons.default += [
-        'icons/%s/%s%s' % (icon_dir, i, icon_suffix) for i in sorted(
-            desktop_icons + desktop_icons_small + desktop_icons_large
-        ),
-    ]
--- a/suite/browser/moz.build
+++ b/suite/browser/moz.build
@@ -1,16 +1,14 @@
 # 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/.
 
-BROWSER_CHROME_MANIFESTS += ['test/browser/browser.ini']
-MOCHITEST_CHROME_MANIFESTS += ['test/chrome/chrome.ini']
-MOCHITEST_MANIFESTS += ['test/mochitest/mochitest.ini']
+TEST_DIRS += ['test']
 
 EXTRA_COMPONENTS += [
     'nsBrowserContentHandler.js',
     'nsTypeAheadFind.js',
     'SuiteBrowser.manifest',
 ]
 
 JAR_MANIFESTS += ['jar.mn']
new file mode 100644
--- /dev/null
+++ b/suite/browser/test/Makefile.in
@@ -0,0 +1,104 @@
+# 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/.
+
+DEPTH		= @DEPTH@
+topsrcdir	= @top_srcdir@
+srcdir		= @srcdir@
+VPATH		= @srcdir@
+relativesrcdir  = @relativesrcdir@
+
+include $(DEPTH)/config/autoconf.mk
+include $(topsrcdir)/config/rules.mk
+
+_TEST_FILES =	test_feed_discovery.html \
+		feed_discovery.html \
+		test_bug395533.html \
+		bug395533-data.txt \
+		test_bug364677.html \
+		bug364677-data.xml \
+		bug364677-data.xml^headers^ \
+		test_registerHandler.html \
+		valid-feed.xml \
+		valid-unsniffable-feed.xml \
+		$(NULL)
+
+# test_contextmenu.html is disabled on Linux due to bug 513558
+ifneq (gtk2,$(MOZ_WIDGET_TOOLKIT))
+_TEST_FILES += \
+		test_contextmenu.html \
+		subtst_contextmenu.html \
+		ctxmenu-image.png \
+		audio.ogg \
+		video.ogg \
+		$(NULL)
+endif
+
+_BROWSER_FILES = \
+                 head.js \
+                 browser_bug329212.js \
+                 browser_bug409624.js \
+                 browser_bug413915.js \
+                 browser_bug427559.js \
+                 browser_bug435325.js \
+                 browser_bug519216.js \
+                 browser_bug561636.js \
+                 browser_bug562649.js \
+                 browser_bug581947.js \
+                 browser_bug585511.js \
+                 browser_bug595507.js \
+                 browser_bug623155.js \
+                 browser_fayt.js \
+                 browser_page_style_menu.js \
+                 blockPluginVulnerableNoUpdate.xml \
+                 blockPluginVulnerableUpdatable.xml \
+                 blockNoPlugins.xml \
+                 blockPluginHard.xml \
+                 browser_pluginCrashCommentAndURL.js \
+                 page_style_sample.html \
+                 browser_pageInfo.js \
+                 feed_tab.html \
+                 browser_pluginnotification.js \
+                 browser_pluginplaypreview.js \
+                 pluginCrashCommentAndURL.html \
+                 plugin_alternate_content.html \
+                 plugin_bug743421.html \
+                 plugin_bug749455.html \
+                 plugin_clickToPlayAllow.html \
+                 plugin_clickToPlayDeny.html \
+                 plugin_hidden_to_visible.html \
+                 plugin_unknown.html \
+                 plugin_test.html \
+                 plugin_test2.html \
+                 plugin_test3.html \
+                 plugin_two_types.html \
+                 plugin_both.html \
+                 plugin_both2.html \
+                 browser_popupNotification.js \
+                 browser_scope.js \
+                 browser_alltabslistener.js \
+                 alltabslistener.html \
+                 browser_relatedTabs.js \
+                 browser_selectTabAtIndex.js \
+                 title_test.svg \
+                 redirect_bug623155.sjs \
+                 browser_privatebrowsing_protocolhandler.js \
+                 browser_privatebrowsing_protocolhandler_page.html \
+    $(NULL)
+
+ifneq (cocoa,$(MOZ_WIDGET_TOOLKIT))
+_BROWSER_FILES += browser_bug462289.js
+endif
+
+_CHROME_FILES = \
+                 test_maxSniffing.html \
+    $(NULL)
+
+libs:: $(addprefix mochitest/, $(_TEST_FILES))
+	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
+
+libs:: $(addprefix browser/, $(_BROWSER_FILES))
+	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/browser/$(relativesrcdir)
+
+libs:: $(addprefix chrome/, $(_CHROME_FILES))
+	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/chrome/$(relativesrcdir)
deleted file mode 100644
--- a/suite/browser/test/browser/browser.ini
+++ /dev/null
@@ -1,54 +0,0 @@
-[DEFAULT]
-support-files =
-  head.js
-  blockPluginVulnerableNoUpdate.xml
-  blockPluginVulnerableUpdatable.xml
-  blockNoPlugins.xml
-  blockPluginHard.xml
-  page_style_sample.html
-  feed_tab.html
-  pluginCrashCommentAndURL.html
-  plugin_alternate_content.html
-  plugin_bug743421.html
-  plugin_bug749455.html
-  plugin_clickToPlayAllow.html
-  plugin_clickToPlayDeny.html
-  plugin_hidden_to_visible.html
-  plugin_unknown.html
-  plugin_test.html
-  plugin_test2.html
-  plugin_test3.html
-  plugin_two_types.html
-  plugin_both.html
-  plugin_both2.html
-  alltabslistener.html
-  title_test.svg
-  redirect_bug623155.sjs
-
-[browser_alltabslistener.js]
-[browser_bug329212.js]
-[browser_bug409624.js]
-[browser_bug413915.js]
-[browser_bug427559.js]
-[browser_bug435325.js]
-[browser_bug462289.js]
-skip-if = toolkit == 'cocoa'
-[browser_bug519216.js]
-[browser_bug561636.js]
-[browser_bug562649.js]
-[browser_bug581947.js]
-[browser_bug585511.js]
-[browser_bug595507.js]
-[browser_bug623155.js]
-[browser_fayt.js]
-[browser_pageInfo.js]
-[browser_page_style_menu.js]
-[browser_pluginCrashCommentAndURL.js]
-[browser_pluginnotification.js]
-[browser_pluginplaypreview.js]
-[browser_popupNotification.js]
-[browser_privatebrowsing_protocolhandler.js]
-support-files = browser_privatebrowsing_protocolhandler_page.html
-[browser_relatedTabs.js]
-[browser_scope.js]
-[browser_selectTabAtIndex.js]
deleted file mode 100644
--- a/suite/browser/test/chrome/chrome.ini
+++ /dev/null
@@ -1,1 +0,0 @@
-[test_maxSniffing.html]
deleted file mode 100644
--- a/suite/browser/test/mochitest/mochitest.ini
+++ /dev/null
@@ -1,11 +0,0 @@
-[test_bug364677.html]
-support_files = bug364677-data.xml bug364677-data.xml^headers^
-[test_bug395533.html]
-support_files = bug395533-data.txt
-[test_feed_discovery.html]
-support_files = feed_discovery.html
-[test_registerHandler.html ]
-support_files = valid-feed.xml valid-unsniffable-feed.xml
-[test_contextmenu.html]
-support_files = subtst_contextmenu.html ctxmenu-image.png audio.ogg video.ogg
-skip-if = toolkit == 'gtk2' || toolkit == 'gtk3' # disabled on Linux due to bug 513558
new file mode 100644
--- /dev/null
+++ b/suite/browser/test/moz.build
@@ -0,0 +1,4 @@
+# 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/.
--- a/suite/build/Makefile.in
+++ b/suite/build/Makefile.in
@@ -1,6 +1,15 @@
 # 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/.
 
+DEPTH		= @DEPTH@
+topsrcdir	= @top_srcdir@
+srcdir		= @srcdir@
+VPATH		= @srcdir@
+
+include $(DEPTH)/config/autoconf.mk
+
+include $(topsrcdir)/config/rules.mk
+
 # Ensure that we don't embed a manifest referencing the CRT.
 EMBED_MANIFEST_AT =
new file mode 100644
--- /dev/null
+++ b/suite/common/dataman/tests/Makefile.in
@@ -0,0 +1,22 @@
+# 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/.
+
+DEPTH		= @DEPTH@
+topsrcdir	= @top_srcdir@
+srcdir		= @srcdir@
+VPATH		= @srcdir@
+relativesrcdir = @relativesrcdir@
+
+include $(topsrcdir)/config/rules.mk
+
+_BROWSER_FILES = \
+    browser_dataman_basics.js \
+    dataman_storage.appcache \
+    dataman_storage.appcache^headers^ \
+    dataman_storage.html \
+    browser_dataman_callviews.js \
+    $(NULL)
+
+libs:: $(_BROWSER_FILES)
+	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/browser/$(relativesrcdir)
deleted file mode 100644
--- a/suite/common/dataman/tests/browser.ini
+++ /dev/null
@@ -1,8 +0,0 @@
-[DEFAULT]
-support-files = 
-  dataman_storage.appcache
-  dataman_storage.appcache^headers^
-  dataman_storage.html
-
-[browser_dataman_basics.js]
-[browser_dataman_callviews.js]
new file mode 100644
--- /dev/null
+++ b/suite/common/dataman/tests/moz.build
@@ -0,0 +1,4 @@
+# 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/.
new file mode 100644
--- /dev/null
+++ b/suite/common/downloads/tests/Makefile.in
@@ -0,0 +1,43 @@
+# 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/.
+
+DEPTH		= @DEPTH@
+topsrcdir	= @top_srcdir@
+srcdir		= @srcdir@
+VPATH		= @srcdir@
+relativesrcdir = @relativesrcdir@
+
+include $(DEPTH)/config/autoconf.mk
+include $(topsrcdir)/config/rules.mk
+
+_CHROME_FILES = \
+    test_action_keys_respect_focus.xul \
+    test_basic_functionality.xul \
+    test_cleanup_search.xul \
+    test_clear_button_disabled.xul \
+    test_close_download_manager.xul \
+    test_delete_key_cancels.xul \
+    test_delete_key_removes.xul \
+    test_drag.xul \
+    test_enter_dblclick_opens.xul \
+    test_multi_select.xul \
+    test_multiword_search.xul \
+    test_open_properties.xul \
+    test_removeDownload_updates_ui.xul \
+    test_search_clearlist.xul \
+    test_search_keys.xul \
+    test_select_all.xul \
+    test_space_key_pauses_resumes.xul \
+    test_space_key_retries.xul \
+    test_ui_stays_open_on_alert_clickback.xul \
+    $(NULL)
+
+_BROWSER_FILES = browser_nsISuiteDownloadManagerUI.js \
+    $(NULL)
+
+libs:: $(addprefix chrome/, $(_CHROME_FILES))
+	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/chrome/$(relativesrcdir)
+
+libs:: $(addprefix browser/, $(_BROWSER_FILES))
+	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/browser/$(relativesrcdir)
deleted file mode 100644
--- a/suite/common/downloads/tests/browser/browser.ini
+++ /dev/null
@@ -1,1 +0,0 @@
-[browser_nsISuiteDownloadManagerUI.js]
deleted file mode 100644
--- a/suite/common/downloads/tests/chrome/chrome.ini
+++ /dev/null
@@ -1,19 +0,0 @@
-[test_action_keys_respect_focus.xul]
-[test_basic_functionality.xul]
-[test_cleanup_search.xul]
-[test_clear_button_disabled.xul]
-[test_close_download_manager.xul]
-[test_delete_key_cancels.xul]
-[test_delete_key_removes.xul]
-[test_drag.xul]
-[test_enter_dblclick_opens.xul]
-[test_multiword_search.xul]
-[test_multi_select.xul]
-[test_open_properties.xul]
-[test_removeDownload_updates_ui.xul]
-[test_search_clearlist.xul]
-[test_search_keys.xul]
-[test_select_all.xul]
-[test_space_key_pauses_resumes.xul]
-[test_space_key_retries.xul]
-[test_ui_stays_open_on_alert_clickback.xul]
\ No newline at end of file
new file mode 100644
--- /dev/null
+++ b/suite/common/downloads/tests/moz.build
@@ -0,0 +1,4 @@
+# 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/.
--- a/suite/common/moz.build
+++ b/suite/common/moz.build
@@ -3,33 +3,23 @@
 # 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 += [
     'public',
     'src',
 ]
 
-BROWSER_CHROME_MANIFESTS += [
-    'dataman/tests/browser.ini',
-    'downloads/tests/browser/browser.ini',
-    'places/tests/browser/browser.ini',
-    'tests/browser/browser.ini',
-    'tests/preferences/browser.ini',
+TEST_DIRS += [
+    'tests',
+    'dataman/tests',
+    'downloads/tests',
+    'places/tests',
 ]
 
-MOCHITEST_CHROME_MANIFESTS += [
-    'downloads/tests/chrome/chrome.ini',
-    'places/tests/chrome/chrome.ini',
-    'tests/chrome/chrome.ini',
-]
-
-XPCSHELL_TESTS_MANIFESTS += ['places/tests/unit/xpcshell.ini']
-
-
 JAR_MANIFESTS += ['jar.mn']
 
 # DEFINES for preprocessing
 # Use suite/common/app-license.html as input when generating 
 # chrome://content/communicator/license.html to override 
 # chrome://global/content/license.html (about:license)
 DEFINES['APP_LICENSE_BLOCK'] = '%s/app-license.html' % SRCDIR
 
new file mode 100644
--- /dev/null
+++ b/suite/common/places/tests/Makefile.in
@@ -0,0 +1,45 @@
+#
+# 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/.
+
+DEPTH		= @DEPTH@
+topsrcdir	= @top_srcdir@
+srcdir		= @srcdir@
+VPATH		= @srcdir@
+relativesrcdir = @relativesrcdir@
+
+include $(DEPTH)/config/autoconf.mk
+
+include $(topsrcdir)/config/rules.mk
+
+_CHROME_FILES = \
+    head.js \
+    test_treeview_date.xul \
+    test_bug485100-change-case-loses-tag.xul \
+    test_bug427633_no_newfolder_if_noip.xul \
+    test_0_multiple_left_pane.xul \
+    test_0_bug510634.xul \
+    test_bug549192.xul \
+    test_bug549491.xul \
+    $(NULL)
+
+_BROWSER_FILES = \
+    head.js \
+    browser_0_library_left_pane_migration.js \
+    browser_library_left_pane_fixnames.js \
+    browser_425884.js \
+    browser_423515.js \
+    browser_sort_in_library.js \
+    browser_library_open_leak.js \
+    browser_library_left_pane_commands.js \
+    browser_drag_bookmarks_on_toolbar.js \
+    browser_library_views_liveupdate.js \
+    browser_library_infoBox.js \
+    $(NULL)
+
+libs:: $(addprefix chrome/, $(_CHROME_FILES))
+	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/chrome/$(relativesrcdir)
+
+libs:: $(addprefix browser/, $(_BROWSER_FILES))
+	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/browser/$(relativesrcdir)
deleted file mode 100644
--- a/suite/common/places/tests/browser/browser.ini
+++ /dev/null
@@ -1,14 +0,0 @@
-[DEFAULT]
-support-files =
-  head.js
-
-[browser_0_library_left_pane_migration.js]
-[browser_423515.js]
-[browser_425884.js]
-[browser_drag_bookmarks_on_toolbar.js]
-[browser_library_infoBox.js]
-[browser_library_left_pane_commands.js]
-[browser_library_left_pane_fixnames.js]
-[browser_library_open_leak.js]
-[browser_library_views_liveupdate.js]
-[browser_sort_in_library.js]
deleted file mode 100644
--- a/suite/common/places/tests/chrome/chrome.ini
+++ /dev/null
@@ -1,11 +0,0 @@
-[DEFAULT]
-support-files =
-  head.js
-
-[test_0_bug510634.xul]
-[test_0_multiple_left_pane.xul]
-[test_bug427633_no_newfolder_if_noip.xul]
-[test_bug485100-change-case-loses-tag.xul]
-[test_bug549192.xul]
-[test_bug549491.xul]
-[test_treeview_date.xul]
new file mode 100644
--- /dev/null
+++ b/suite/common/places/tests/moz.build
@@ -0,0 +1,7 @@
+# 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/.
+
+XPCSHELL_TESTS_MANIFESTS += ['unit/xpcshell.ini']
+
new file mode 100644
--- /dev/null
+++ b/suite/common/tests/browser/Makefile.in
@@ -0,0 +1,90 @@
+#
+# 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/.
+
+DEPTH		= @DEPTH@
+topsrcdir	= @top_srcdir@
+srcdir		= @srcdir@
+VPATH		= @srcdir@
+relativesrcdir  = @relativesrcdir@
+
+include $(DEPTH)/config/autoconf.mk
+include $(topsrcdir)/config/rules.mk
+
+_BROWSER_FILES = \
+	head.js \
+	browser_form_restore_events.js \
+	browser_form_restore_events_sample.html \
+	browser_339445.js \
+	browser_339445_sample.html \
+	browser_345898.js \
+	browser_346337.js \
+	browser_346337_sample.html \
+	browser_350525.js \
+	browser_354894.js \
+	browser_367052.js \
+	browser_393716.js \
+	browser_394759_basic.js \
+	browser_394759_behavior.js \
+	browser_408470.js \
+	browser_408470_sample.html \
+	browser_423132.js \
+	browser_423132_sample.html \
+	browser_bug431826.js \
+	browser_447951.js \
+	browser_447951_sample.html \
+	browser_448741.js \
+	browser_454908.js \
+	browser_454908_sample.html \
+	browser_456342.js \
+	browser_456342_sample.xhtml \
+	browser_461634.js \
+	browser_463206.js \
+	browser_463206_sample.html \
+	browser_465215.js \
+	browser_465223.js \
+	browser_466937.js \
+	browser_466937_sample.html \
+	browser_477657.js \
+	browser_480893.js \
+	browser_483330.js \
+	browser_485482.js \
+	browser_485482_sample.html \
+	browser_490040.js \
+	browser_491168.js \
+	browser_493467.js \
+	browser_500328.js \
+	browser_514751.js \
+	browser_522545.js \
+	browser_524745.js \
+	browser_526613.js \
+	browser_528776.js \
+	browser_581937.js \
+	browser_586068-cascaded_restore.js \
+	browser_597315.js \
+	browser_597315_index.html \
+	browser_597315_a.html \
+	browser_597315_b.html \
+	browser_597315_c.html \
+	browser_597315_c1.html \
+	browser_597315_c2.html \
+	browser_607016.js \
+	browser_615394-SSWindowState_events.js \
+	browser_625257.js \
+	browser_636279.js \
+	browser_637020.js \
+	browser_637020_slow.sjs \
+	browser_665702-state_session.js \
+	browser_687710.js \
+	browser_687710_2.js \
+	browser_694378.js \
+	browser_isempty.js \
+	browser_markPageAsFollowedLink.js \
+	framedPage.html \
+	frameLeft.html \
+	frameRight.html \
+	$(NULL)
+
+libs:: $(_BROWSER_FILES)
+	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/browser/$(relativesrcdir)
deleted file mode 100644
--- a/suite/common/tests/browser/browser.ini
+++ /dev/null
@@ -1,75 +0,0 @@
-[DEFAULT]
-support-files =
-  head.js
-  framedPage.html
-  frameLeft.html
-  frameRight.html
-
-[browser_339445.js]
-support-files = browser_339445_sample.html
-[browser_345898.js]
-[browser_346337.js]
-support-files = browser_346337_sample.html
-[browser_350525.js]
-[browser_354894.js]
-[browser_367052.js]
-[browser_393716.js]
-[browser_394759_basic.js]
-[browser_394759_behavior.js]
-[browser_408470.js]
-support-files = browser_408470_sample.html
-[browser_423132.js]
-support-files = browser_423132_sample.html
-[browser_447951.js]
-support-files = browser_447951_sample.html
-[browser_448741.js]
-[browser_454908.js]
-support-files = browser_454908_sample.html
-[browser_456342.js]
-support-files = browser_456342_sample.xhtml
-[browser_461634.js]
-[browser_463206.js]
-support-files = browser_463206_sample.html
-[browser_465215.js]
-[browser_465223.js]
-[browser_466937.js]
-support-files = browser_466937_sample.html
-[browser_477657.js]
-[browser_480893.js]
-[browser_483330.js]
-[browser_485482.js]
-support-files = browser_485482_sample.html
-[browser_490040.js]
-[browser_491168.js]
-[browser_493467.js]
-[browser_500328.js]
-[browser_514751.js]
-[browser_522545.js]
-[browser_524745.js]
-[browser_526613.js]
-[browser_528776.js]
-[browser_581937.js]
-[browser_586068-cascaded_restore.js]
-[browser_597315.js]
-support-files = 
-    browser_597315_a.html
-    browser_597315_b.html
-    browser_597315_c.html
-    browser_597315_c1.html
-    browser_597315_c2.html
-    browser_597315_index.html
-[browser_607016.js]
-[browser_615394-SSWindowState_events.js]
-[browser_625257.js]
-[browser_636279.js]
-[browser_637020.js]
-support-files = browser_637020_slow.sjs
-[browser_665702-state_session.js]
-[browser_687710.js]
-[browser_687710_2.js]
-[browser_694378.js]
-[browser_bug431826.js]
-[browser_form_restore_events.js]
-support-files = browser_form_restore_events_sample.html
-[browser_isempty.js]
-[browser_markPageAsFollowedLink.js]
new file mode 100644
--- /dev/null
+++ b/suite/common/tests/browser/moz.build
@@ -0,0 +1,4 @@
+# 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/.
new file mode 100644
--- /dev/null
+++ b/suite/common/tests/chrome/Makefile.in
@@ -0,0 +1,20 @@
+#
+# 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/.
+
+DEPTH		= @DEPTH@
+topsrcdir	= @top_srcdir@
+srcdir		= @srcdir@
+VPATH		= @srcdir@
+relativesrcdir  = @relativesrcdir@
+
+include $(DEPTH)/config/autoconf.mk
+include $(topsrcdir)/config/rules.mk
+
+_TEST_FILES = 	test_idcheck.xul \
+		$(topsrcdir)/mailnews/test/resources/mailTestUtils.js \
+		$(NULL)
+
+libs:: $(_TEST_FILES)
+	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/chrome/$(relativesrcdir)
deleted file mode 100644
--- a/suite/common/tests/chrome/chrome.ini
+++ /dev/null
@@ -1,2 +0,0 @@
-[test_idcheck.xul]
-support-files = /mailnews/test/resources/mailTestUtils.js
new file mode 100644
--- /dev/null
+++ b/suite/common/tests/chrome/moz.build
@@ -0,0 +1,4 @@
+# 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/.
new file mode 100644
--- /dev/null
+++ b/suite/common/tests/moz.build
@@ -0,0 +1,11 @@
+# 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/.
+
+TEST_DIRS += [
+    'browser',
+    'chrome',
+    'preferences',
+]
+
new file mode 100644
--- /dev/null
+++ b/suite/common/tests/preferences/Makefile.in
@@ -0,0 +1,19 @@
+# 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/.
+
+DEPTH		= @DEPTH@
+topsrcdir	= @top_srcdir@
+srcdir		= @srcdir@
+VPATH		= @srcdir@
+relativesrcdir  = @relativesrcdir@
+
+include $(DEPTH)/config/autoconf.mk
+include $(topsrcdir)/config/rules.mk
+
+_BROWSER_FILES = \
+    browser_bug410900.js \
+    $(NULL)
+
+libs::	$(_BROWSER_FILES)
+	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/browser/$(relativesrcdir)
deleted file mode 100644
--- a/suite/common/tests/preferences/browser.ini
+++ /dev/null
@@ -1,1 +0,0 @@
-[browser_bug410900.js]
new file mode 100644
--- /dev/null
+++ b/suite/common/tests/preferences/moz.build
@@ -0,0 +1,4 @@
+# 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/.
--- a/suite/debugQA/Makefile.in
+++ b/suite/debugQA/Makefile.in
@@ -1,15 +1,25 @@
 #
 # 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/.
 
+
+DEPTH=@DEPTH@
+topsrcdir=@top_srcdir@
+srcdir=@srcdir@
+VPATH=@srcdir@
+
+include $(DEPTH)/config/autoconf.mk
+
 USE_EXTENSION_MANIFEST = 1
 INSTALL_EXTENSION_ID   = debugQA@mozilla.org
 XPI_PKGNAME            = debugQA-$(MOZ_APP_VERSION)
 
 DIST_FILES = install.rdf
 
 XULAPP_DEFINES = \
     -DMOZ_APP_VERSION=$(MOZ_APP_VERSION) \
     -DMOZ_APP_MAXVERSION=$(MOZ_APP_MAXVERSION) \
     $(NULL)
+
+include $(topsrcdir)/config/rules.mk
--- a/suite/debugQA/locales/Makefile.in
+++ b/suite/debugQA/locales/Makefile.in
@@ -1,13 +1,22 @@
 #
 # 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/.
 
+
+DEPTH=@DEPTH@
+topsrcdir=@top_srcdir@
+srcdir=@srcdir@
+VPATH=@srcdir@
+relativesrcdir=@relativesrcdir@
+
 USE_EXTENSION_MANIFEST = 1
 
 # include config.mk before we override the AB_CD var it sets
 include $(topsrcdir)/config/config.mk
 
 # override UI locale with en-US so that we don't need to provide L10n for this
 AB_CD = en-US
 DEFINES += -DAB_CD=$(AB_CD)
+
+include $(topsrcdir)/config/rules.mk
--- a/suite/installer/Makefile.in
+++ b/suite/installer/Makefile.in
@@ -1,12 +1,19 @@
 # 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/.
 
+DEPTH		= @DEPTH@
+topsrcdir	= @top_srcdir@
+srcdir		= @srcdir@
+VPATH		= @srcdir@
+
+include $(DEPTH)/config/autoconf.mk
+
 STANDALONE_MAKEFILE := 1
 
 include $(topsrcdir)/config/rules.mk
 
 MOZ_PKG_REMOVALS = $(srcdir)/removed-files.in
 
 MOZ_PKG_MANIFEST_P = $(srcdir)/package-manifest.in
 # Be fatal, except when building with XULRunner which already bundles some files.
@@ -19,17 +26,17 @@ MOZ_NONLOCALIZED_PKG_LIST = \
 	browser \
 	mail \
 	$(NULL)
 
 MOZ_LOCALIZED_PKG_LIST = \
 	$(AB_CD) \
 	$(NULL)
 
-DEFINES += -DMOZ_APP_NAME=$(MOZ_APP_NAME) -DPREF_DIR=$(PREF_DIR)
+DEFINES += -DAB_CD=$(AB_CD) -DMOZ_APP_NAME=$(MOZ_APP_NAME) -DPREF_DIR=$(PREF_DIR)
 
 DEFINES += -DJAREXT=
 
 ifdef ENABLE_TESTS
 DEFINES += -DENABLE_TESTS=1
 endif
 
 ifdef LIBXUL_SDK
--- a/suite/installer/windows/Makefile.in
+++ b/suite/installer/windows/Makefile.in
@@ -1,12 +1,19 @@
 # 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/.
 
+DEPTH		= @DEPTH@
+topsrcdir	= @top_srcdir@
+srcdir		= @srcdir@
+VPATH		= @srcdir@
+
+include $(DEPTH)/config/autoconf.mk
+
 include $(MOZILLA_SRCDIR)/toolkit/mozapps/installer/package-name.mk
 
 CONFIG_DIR = instgen
 SFX_MODULE = $(topsrcdir)/other-licenses/7zstub/seamonkey/7zSD.sfx
 
 INSTALLER_FILES = \
 	app.tag \
 	nsis/installer.nsi \
@@ -18,16 +25,17 @@ INSTALLER_FILES = \
 BRANDING_FILES = \
 	branding.nsi \
 	wizHeader.bmp \
 	wizHeaderRTL.bmp \
 	wizWatermark.bmp \
 	$(NULL)
 
 DEFINES += \
+	-DAB_CD=$(AB_CD) \
 	-DPKG_BASENAME="$(PKG_BASENAME)" \
 	-DPKG_INST_BASENAME="$(PKG_INST_BASENAME)" \
 	-DMOZ_APP_VERSION=$(MOZ_APP_VERSION) \
 	-DMOZ_APP_NAME=$(MOZ_APP_NAME) \
 	-DMOZ_APP_DISPLAYNAME=${MOZ_APP_DISPLAYNAME} \
 	-DMOZILLA_VERSION=${MOZILLA_VERSION} \
 	$(NULL)
 
--- a/suite/locales/Makefile.in
+++ b/suite/locales/Makefile.in
@@ -1,12 +1,20 @@
 # 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/.
 
+DEPTH          = @DEPTH@
+topsrcdir      = @top_srcdir@
+srcdir         = @srcdir@
+VPATH          = @srcdir@
+relativesrcdir = @relativesrcdir@
+
+include $(DEPTH)/config/autoconf.mk
+
 include $(topsrcdir)/config/config.mk
 
 _ABS_SRCDIR := $(abspath $(topsrcdir))
 
 vpath %.xml @srcdir@/en-US/searchplugins
 vpath %.xml $(LOCALE_SRCDIR)/searchplugins
 
 SUBMAKEFILES += \
@@ -68,16 +76,20 @@ include $(topsrcdir)/config/rules.mk
 
 include $(topsrcdir)/mozilla/toolkit/locales/l10n.mk
 
 $(STAGEDIST): $(DIST)/branding
 
 $(DIST)/branding:
 	$(NSINSTALL) -D $@
 
+PROFILE_FILES = \
+	mimeTypes.rdf \
+	$(NULL)
+
 PROFILE_CHROME = userChrome-example.css userContent-example.css
 
 NO_JA_JP_MAC_AB_CD := $(if $(filter ja-JP-mac, $(AB_CD)),ja,$(AB_CD))
 
 BOOKMARKS_INC_FILE = $(call MERGE_FILE,profile/bookmarks.inc)
 BOOKMARKS_XTRA_FILE = $(call MERGE_FILE,profile/bookmarks.extra)
 
 # the #include in the .in file requires all to be in the same dir, sadly.
@@ -103,16 +115,19 @@ PANELS_XTRA_FILE = $(call MERGE_FILE,pro
 	  -n 's/.*<RDF:Description about="\(.*\)">.*/        <RDF:li resource="\1"\/>/p' \
 	  profile/panels.extra > profile/panels-urn.inc
 	$(call py_action,preprocessor, \
 	  profile/panels.rdf.in -o $@)
 
 libs:: $(FINAL_TARGET)/defaults/profile/bookmarks.html ;
 libs:: $(FINAL_TARGET)/defaults/profile/panels.rdf ;
 
+libs:: $(addprefix generic/profile/,$(PROFILE_FILES))
+	$(SYSINSTALL) $(IFLAGS1) $^ $(FINAL_TARGET)/defaults/profile
+
 libs:: $(call MERGE_FILES,$(addprefix profile/chrome/,$(PROFILE_CHROME)))
 	$(SYSINSTALL) $(IFLAGS1) $^ $(FINAL_TARGET)/defaults/profile/chrome
 
 # Extend l10n.mk clobber-% target for our localised extensions
 clobber-%:
 	$(RM) -rf $(DIST)/xpi-stage/chatzilla-$* $(DIST)/xpi-stage/chatzilla-*.$*.xpi
 
 libs-%:
--- a/suite/locales/moz.build
+++ b/suite/locales/moz.build
@@ -1,12 +1,8 @@
 # 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/.
 
 JAR_MANIFESTS += ['jar.mn']
 
 DEFINES['MOZ_APP_MAXVERSION'] = CONFIG['MOZ_APP_MAXVERSION']
-
-FINAL_TARGET_FILES.defaults.profile += [
-    'generic/profile/mimeTypes.rdf',
-]
--- a/suite/themes/classic/Makefile.in
+++ b/suite/themes/classic/Makefile.in
@@ -1,7 +1,24 @@
 # 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/.
 
-THEME_FILES := install.rdf
-THEME_FILES_PATH := $(FINAL_TARGET)/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}
-PP_TARGETS += THEME_FILES
+DEPTH		= @DEPTH@
+topsrcdir	= @top_srcdir@
+srcdir		= @srcdir@
+VPATH		= @srcdir@
+
+include $(DEPTH)/config/autoconf.mk
+
+include $(topsrcdir)/config/rules.mk
+
+CLASSIC_EXTENSION_DIR = {972ce4c6-7e08-4474-a285-3208198ce6fd}
+
+FILES = \
+	$(srcdir)/chrome.manifest \
+	$(srcdir)/icon.png \
+	$(srcdir)/preview.png \
+	$(NULL)
+
+libs::
+	$(INSTALL) $(FILES) $(DIST)/bin/extensions/$(CLASSIC_EXTENSION_DIR)
+	$(call py_action,preprocessor,$(DEFINES) $(ACDEFINES) $(srcdir)/install.rdf -o $(DIST)/bin/extensions/$(CLASSIC_EXTENSION_DIR)/install.rdf)
--- a/suite/themes/classic/moz.build
+++ b/suite/themes/classic/moz.build
@@ -1,14 +1,8 @@
 # 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/.
 
 JAR_MANIFESTS += ['jar.mn']
 
 DEFINES['SEAMONKEY_VERSION'] = CONFIG['SEAMONKEY_VERSION']
-
-FINAL_TARGET_FILES.extensions['{972ce4c6-7e08-4474-a285-3208198ce6fd}'] += [
-    'chrome.manifest',
-    'icon.png',
-    'preview.png',
-]
--- a/suite/themes/modern/Makefile.in
+++ b/suite/themes/modern/Makefile.in
@@ -1,11 +1,27 @@
 #
 # 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/.
 
+DEPTH		= @DEPTH@
+topsrcdir	= @top_srcdir@
+srcdir		= @srcdir@
+VPATH		= @srcdir@
+
 USE_EXTENSION_MANIFEST = 1
 
+include $(topsrcdir)/config/config.mk
+
 DIST_FILES = \
 	install.rdf \
 	$(NULL)
 
+FILES = \
+	$(srcdir)/preview.png \
+	$(srcdir)/icon.png \
+	$(NULL)
+
+libs::
+	$(INSTALL) $(FILES) $(FINAL_TARGET)
+
+include $(topsrcdir)/config/rules.mk
--- a/suite/themes/modern/moz.build
+++ b/suite/themes/modern/moz.build
@@ -3,13 +3,8 @@
 # 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/.
 
 DIST_SUBDIR = 'extensions/modern@themes.mozilla.org'
 
 JAR_MANIFESTS += ['jar.mn']
 
 DEFINES['SEAMONKEY_VERSION'] = CONFIG['SEAMONKEY_VERSION']
-
-FINAL_TARGET_FILES += [
-    'icon.png',
-    'preview.png',
-]