Bug 1138063 - Replace manual install rules (e.g. tests, FINAL_TARGET files) with moz.build equivalents r=jcranmer,fallen,florian a=IanN for CLOSED TREE
authorBrian O'Keefe <bokeefe@alum.wpi.edu>
Sun, 26 Jul 2015 18:07:22 +0100
changeset 22976 031248ef4037cf302a696667bddef9d8e2a0b85e
parent 22975 390e5df881b2dc6643364f8ff1e265030b3d5a1d
child 22977 ae95dbce7c4886e9ff6508be474d943c0b94cb40
push id1474
push usermbanner@mozilla.com
push dateMon, 21 Sep 2015 17:20:48 +0000
treeherdercomm-beta@3094bab4c31f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjcranmer, fallen, florian, IanN
bugs1138063
Bug 1138063 - Replace manual install rules (e.g. tests, FINAL_TARGET files) with moz.build equivalents r=jcranmer,fallen,florian a=IanN for CLOSED TREE
calendar/base/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/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/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/build/Makefile.in
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
deleted file mode 100644
--- a/calendar/base/Makefile.in
+++ /dev/null
@@ -1,36 +0,0 @@
-# 
-# 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
-
-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/moz.build
+++ b/calendar/base/moz.build
@@ -14,16 +14,37 @@ 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')
deleted file mode 100644
--- a/calendar/base/src/Makefile.in
+++ /dev/null
@@ -1,48 +0,0 @@
-#
-# 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,14 +15,44 @@ 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')
 
deleted file mode 100644
--- a/calendar/import-export/Makefile.in
+++ /dev/null
@@ -1,26 +0,0 @@
-# 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 = \
-    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,13 +5,22 @@
 
 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,24 +30,16 @@
 # 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
@@ -75,30 +75,26 @@ XPI_INSTALL_EXTENSION = $(XPI_EM_ID)
 else
 # For beta and release builds, install as a distribution extension in
 # dist/bin/distribution/extensions/
 INSTALL_EXTENSION_ID = $(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. Pull in the en-US
 # copy if the files doesn't exist.
 repack-process-extrafiles: lightning-extrafiles
 lightning-extrafiles: LTN_ABCD_L10NJS=$(call EXPAND_LOCALE_SRCDIR,calendar/locales)/lightning-l10n.js
--- a/calendar/lightning/locales/Makefile.in
+++ b/calendar/lightning/locales/Makefile.in
@@ -1,12 +1,11 @@
 # 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/.
 
 # Setting this to calendar/locales sets up LOCALE_SRCDIR to the correct locale
 # directory
 relativesrcdir = calendar/locales
 
-DEFINES += -DAB_CD=$(AB_CD) \
-           -DTHEME=$(THEME) \
+DEFINES += -DTHEME=$(THEME) \
            -DLOCALE_SRCDIR=$(LOCALE_SRCDIR) \
            $(NULL)
--- a/calendar/lightning/moz.build
+++ b/calendar/lightning/moz.build
@@ -34,16 +34,20 @@ 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')
deleted file mode 100644
--- a/calendar/locales/Makefile.in
+++ /dev/null
@@ -1,6 +0,0 @@
-# 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/.
-
-DEFINES += -DAB_CD=$(AB_CD)
deleted file mode 100644
--- a/calendar/providers/caldav/Makefile.in
+++ /dev/null
@@ -1,18 +0,0 @@
-# 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,10 +5,14 @@
 
 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
@@ -8,18 +8,17 @@ XPI_NO_UNIVERSAL = 1
 XPI_EM_ID = {a62ef8ec-5fdc-40c2-873c-223b8a6925cc}
 XPI_INSTALL_EXTENSION = $(XPI_EM_ID)
 
 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 += -DAB_CD=$(AB_CD) \
-           -DLIGHTNING_VERSION=$(LIGHTNING_VERSION) \
+DEFINES += -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,20 +1,9 @@
 # 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
 
-include $(DEPTH)/config/autoconf.mk
-
-DEFINES += -DAB_CD=$(AB_CD) \
-           -DLOCALE_SRCDIR=$(LOCALE_SRCDIR) \
-           $(NULL)
-
-include $(topsrcdir)/config/rules.mk
+DEFINES += -DLOCALE_SRCDIR=$(LOCALE_SRCDIR)
deleted file mode 100644
--- a/calendar/providers/wcap/Makefile.in
+++ /dev/null
@@ -1,25 +0,0 @@
-# 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,10 +5,19 @@
 
 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/test/mozmill/Makefile.in
+++ b/calendar/test/mozmill/Makefile.in
@@ -1,19 +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
-
 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
@@ -4,19 +4,17 @@
 
 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 += -DAB_CD=$(AB_CD) \
-           -DTHUNDERBIRD_VERSION=$(THUNDERBIRD_VERSION) \
+DEFINES += -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,20 +1,9 @@
 # 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
 
-include $(DEPTH)/config/autoconf.mk
-
-DEFINES += -DAB_CD=$(AB_CD) \
-           -DLOCALE_SRCDIR=$(LOCALE_SRCDIR) \
-           $(NULL)
-
-include $(topsrcdir)/config/rules.mk
+DEFINES += -DLOCALE_SRCDIR=$(LOCALE_SRCDIR)
deleted file mode 100644
--- a/chat/locales/Makefile.in
+++ /dev/null
@@ -1,15 +0,0 @@
-# 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
deleted file mode 100644
--- a/editor/ui/locales/Makefile.in
+++ /dev/null
@@ -1,15 +0,0 @@
-# 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,20 +1,13 @@
 #
 # 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,17 +15,16 @@ 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
deleted file mode 100644
--- a/im/app/profile/Makefile.in
+++ /dev/null
@@ -1,21 +0,0 @@
-#
-# 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
deleted file mode 100644
--- a/im/app/profile/extensions/Makefile.in
+++ /dev/null
@@ -1,12 +0,0 @@
-# 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,26 +1,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/.
 
-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
+THEME_FILES := install.rdf.in
+THEME_FILES_PATH := $(FINAL_TARGET)/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}
+PP_TARGETS := THEME_FILES
--- 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,6 +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/.
 
 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,8 +2,13 @@
 # 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,21 +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/.
 
 # 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
deleted file mode 100644
--- a/im/branding/halloween/locales/Makefile.in
+++ /dev/null
@@ -1,15 +0,0 @@
-# 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,21 +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/.
 
 # 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
deleted file mode 100644
--- a/im/branding/nightly/locales/Makefile.in
+++ /dev/null
@@ -1,15 +0,0 @@
-# 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,19 +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
-
 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
@@ -23,17 +16,17 @@ endif
 
 MOZ_NONLOCALIZED_PKG_LIST = \
 	xpcom \
 	im \
 	$(NULL)
 
 MOZ_LOCALIZED_PKG_LIST = $(AB_CD)
 
-DEFINES += -DAB_CD=$(AB_CD) -DMOZ_APP_NAME=$(MOZ_APP_NAME) -DPREF_DIR=$(PREF_DIR)
+DEFINES += -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,19 +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 $(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)"
@@ -32,17 +25,16 @@ 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,20 +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@
-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
deleted file mode 100644
--- a/im/themes/Makefile.in
+++ /dev/null
@@ -1,16 +0,0 @@
-# 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,6 +1,10 @@
 # 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',
+]
deleted file mode 100644
--- a/ldap/xpcom/src/Makefile.in
+++ /dev/null
@@ -1,18 +0,0 @@
-# 
-# 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
-
--- a/ldap/xpcom/src/moz.build
+++ b/ldap/xpcom/src/moz.build
@@ -15,16 +15,17 @@ 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',
--- a/mail/Makefile.in
+++ b/mail/Makefile.in
@@ -1,18 +1,13 @@
 #
 # 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,17 +13,16 @@ 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
deleted file mode 100644
--- a/mail/app/profile/Makefile.in
+++ /dev/null
@@ -1,21 +0,0 @@
-#
-# 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,22 +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@
-
 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,7 +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/.
 
 DIRS += ['extensions']
 
+FINAL_TARGET_FILES.defaults.profile += [
+    'localstore.rdf',
+    'mimeTypes.rdf',
+]
deleted file mode 100644
--- a/mail/branding/aurora/locales/Makefile.in
+++ /dev/null
@@ -1,15 +0,0 @@
-# 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
deleted file mode 100644
--- a/mail/branding/nightly/locales/Makefile.in
+++ /dev/null
@@ -1,15 +0,0 @@
-# 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
@@ -1,14 +1,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/.
 
 XPI_PKGNAME = dbgserver-$(MOZILLA_VERSION).$(AB_CD)
 relativesrcdir = mail/locales
 
-include $(DEPTH)/config/autoconf.mk
-
-DEFINES += -DAB_CD=$(AB_CD) \
-           -DLOCALE_SRCDIR=$(LOCALE_SRCDIR) \
-           $(NULL)
-
-include $(topsrcdir)/config/rules.mk
+DEFINES += -DLOCALE_SRCDIR=$(LOCALE_SRCDIR)
--- a/mail/installer/Makefile.in
+++ b/mail/installer/Makefile.in
@@ -1,19 +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
-
 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
@@ -25,17 +18,17 @@ MOZ_NONLOCALIZED_PKG_LIST = \
 	xpcom \
 	mail \
 	newsblog \
 	offline \
 	$(NULL)
 
 MOZ_LOCALIZED_PKG_LIST = $(AB_CD)
 
-DEFINES += -DAB_CD=$(AB_CD) -DMOZ_APP_NAME=$(MOZ_APP_NAME) -DPREF_DIR=$(PREF_DIR)
+DEFINES += -DMOZ_APP_NAME=$(MOZ_APP_NAME) -DPREF_DIR=$(PREF_DIR)
 
 ifdef NIGHTLY_BUILD
 DEFINES += -DNIGHTLY_BUILD=1
 endif
 
 ifdef MOZ_CALENDAR
 DEFINES += -DMOZ_CALENDAR=1
 endif
--- a/mail/installer/windows/Makefile.in
+++ b/mail/installer/windows/Makefile.in
@@ -1,19 +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 $(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)"
@@ -39,17 +32,16 @@ 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,20 +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@
-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,41 +1,28 @@
 #
 # 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:
+mozmill-virtualenv: $(_DEST_DIR)
 	$(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,8 +3,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/.
 
 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,14 +1,5 @@
 # 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
deleted file mode 100644
--- a/mail/themes/linux/Makefile.in
+++ /dev/null
@@ -1,23 +0,0 @@
-# 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,6 +1,12 @@
 # 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',
+]
deleted file mode 100644
--- a/mail/themes/osx/Makefile.in
+++ /dev/null
@@ -1,23 +0,0 @@
-# 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,6 +1,12 @@
 # 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',
+]
deleted file mode 100644
--- a/mail/themes/windows/Makefile.in
+++ /dev/null
@@ -1,23 +0,0 @@
-# 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,6 +1,12 @@
 # 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',
+]
deleted file mode 100644
--- a/mailnews/Makefile.in
+++ /dev/null
@@ -1,12 +0,0 @@
-#
-# 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
deleted file mode 100644
--- a/mailnews/base/ispdata/Makefile.in
+++ /dev/null
@@ -1,35 +0,0 @@
-#
-# 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,4 +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/.
+
+# 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']
deleted file mode 100644
--- a/mailnews/base/search/src/Makefile.in
+++ /dev/null
@@ -1,29 +0,0 @@
-#
-# 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,8 +19,15 @@ SOURCES += [
 
 EXTRA_COMPONENTS += [
     'nsMsgTraitService.js',
     'nsMsgTraitService.manifest',
 ]
 
 FINAL_LIBRARY = 'mail'
 
+FINAL_TARGET_FILES.isp += [
+    'Bogofilter.sfd',
+    'DSPAM.sfd',
+    'POPFile.sfd',
+    'SpamAssassin.sfd',
+    'SpamPal.sfd',
+]
deleted file mode 100644
--- a/mailnews/extensions/dsn/Makefile.in
+++ /dev/null
@@ -1,16 +0,0 @@
-#
-# 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,8 +4,12 @@
 # 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
deleted file mode 100644
--- a/mailnews/extensions/mailviews/content/Makefile.in
+++ /dev/null
@@ -1,24 +0,0 @@
-#
-# 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,5 +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/.
 
+FINAL_TARGET_FILES.defaults.messenger += [
+    'mailViews.dat',
+]
deleted file mode 100644
--- a/mailnews/extensions/mdn/Makefile.in
+++ /dev/null
@@ -1,16 +0,0 @@
-#
-# 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,8 +2,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/.
 
 DIRS += ['src']
 TEST_DIRS += ['test']
 
 JAR_MANIFESTS += ['jar.mn']
+
+JS_PREFERENCE_FILES += [
+    'content/mdn.js',
+]
deleted file mode 100644
--- a/mailnews/extensions/newsblog/Makefile.in
+++ /dev/null
@@ -1,29 +0,0 @@
-#
-# 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,8 +7,12 @@ EXTRA_COMPONENTS += [
     'js/newsblog.js',
     'js/newsblog.manifest',
 ]
 
 EXTRA_JS_MODULES += [
     'content/FeedUtils.jsm',
 ]
 JAR_MANIFESTS += ['jar.mn']
+
+FINAL_TARGET_FILES.isp += [
+    'rss.rdf',
+]
deleted file mode 100644
--- a/mailnews/extensions/smime/Makefile.in
+++ /dev/null
@@ -1,16 +0,0 @@
-#
-# 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,8 +4,12 @@
 # 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',
+]
--- a/mailnews/mapi/mapiDll/Makefile.in
+++ b/mailnews/mapi/mapiDll/Makefile.in
@@ -1,15 +1,6 @@
 #
 # 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,20 +1,13 @@
 #
 # 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,15 +1,6 @@
 #
 # 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,25 +59,33 @@ 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/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/**',
 ]
 
 JS_PREFERENCE_FILES += [
     'mailnews.js',
 ]
 
--- a/other-licenses/branding/instantbird/Makefile.in
+++ b/other-licenses/branding/instantbird/Makefile.in
@@ -1,21 +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/.
 
 # 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
deleted file mode 100644
--- a/other-licenses/branding/instantbird/locales/Makefile.in
+++ /dev/null
@@ -1,15 +0,0 @@
-# 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
deleted file mode 100644
--- a/other-licenses/branding/thunderbird/locales/Makefile.in
+++ /dev/null
@@ -1,47 +0,0 @@
-# ***** 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,20 +1,13 @@
 #
 # 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,19 +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
-
 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,84 +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
-
 # 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,6 +1,70 @@
 # 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/build/Makefile.in
+++ b/suite/build/Makefile.in
@@ -1,15 +1,6 @@
 # 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 =
--- a/suite/debugQA/Makefile.in
+++ b/suite/debugQA/Makefile.in
@@ -1,17 +1,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/.
 
-
-DEPTH=@DEPTH@
-topsrcdir=@top_srcdir@
-srcdir=@srcdir@
-VPATH=@srcdir@
-
-include $(DEPTH)/config/autoconf.mk
-
 INSTALL_EXTENSION_ID   = debugQA@mozilla.org
 XPI_PKGNAME            = debugQA-$(MOZ_APP_VERSION)
 
-include $(topsrcdir)/config/rules.mk
--- a/suite/debugQA/locales/Makefile.in
+++ b/suite/debugQA/locales/Makefile.in
@@ -1,20 +1,11 @@
 #
 # 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 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,19 +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
-
 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.
@@ -26,17 +19,17 @@ MOZ_NONLOCALIZED_PKG_LIST = \
 	browser \
 	mail \
 	$(NULL)
 
 MOZ_LOCALIZED_PKG_LIST = \
 	$(AB_CD) \
 	$(NULL)
 
-DEFINES += -DAB_CD=$(AB_CD) -DMOZ_APP_NAME=$(MOZ_APP_NAME) -DPREF_DIR=$(PREF_DIR)
+DEFINES += -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,19 +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 $(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 \
@@ -25,17 +18,16 @@ 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,20 +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@
-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 += \
@@ -76,20 +68,16 @@ 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.
@@ -115,19 +103,16 @@ 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,8 +1,12 @@
 # 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',
+]