Bug 845089 - Convert build system to moz.build files on a CLOSED TREE; r=Callek
authorGregory Szorc <gps@mozilla.com>
Thu, 28 Feb 2013 15:16:49 +0100
changeset 15059 c8c0954ad5947fb552ce84b6cafeac9c8e1f0465
parent 15058 b7a675fa51243fd973617f502a97e5f40faabce2
child 15060 e5f81ee8ccf8ff0a1ba394adc060f72e4c1549fe
push id898
push userbugzilla@standard8.plus.com
push dateMon, 13 May 2013 17:03:31 +0000
treeherdercomm-beta@3106694b14de [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersCallek
bugs845089
Bug 845089 - Convert build system to moz.build files on a CLOSED TREE; r=Callek
allmakefiles.sh
bridge/bridge.mk
bridge/bridge.mozbuild
calendar/Makefile.in
calendar/app.mozbuild
calendar/base/Makefile.in
calendar/base/build/moz.build
calendar/base/modules/moz.build
calendar/base/moz.build
calendar/base/public/moz.build
calendar/base/src/moz.build
calendar/build.mk
calendar/import-export/moz.build
calendar/installer/moz.build
calendar/installer/windows/moz.build
calendar/itip/moz.build
calendar/libical/Makefile.in
calendar/libical/moz.build
calendar/libical/src/Makefile.in
calendar/libical/src/libical/moz.build
calendar/libical/src/moz.build
calendar/lightning/Makefile.in
calendar/lightning/components/moz.build
calendar/lightning/locales/moz.build
calendar/lightning/makefiles.sh
calendar/lightning/moz.build
calendar/locales/Makefile.in
calendar/locales/moz.build
calendar/makefiles.sh
calendar/moz.build
calendar/providers/Makefile.in
calendar/providers/caldav/Makefile.in
calendar/providers/caldav/moz.build
calendar/providers/caldav/public/moz.build
calendar/providers/composite/moz.build
calendar/providers/gdata/Makefile.in
calendar/providers/gdata/components/moz.build
calendar/providers/gdata/locales/moz.build
calendar/providers/gdata/moz.build
calendar/providers/gdata/public/moz.build
calendar/providers/ics/moz.build
calendar/providers/memory/moz.build
calendar/providers/moz.build
calendar/providers/storage/moz.build
calendar/providers/wcap/Makefile.in
calendar/providers/wcap/moz.build
calendar/providers/wcap/public/moz.build
calendar/resources/moz.build
calendar/shared_makefiles.sh
calendar/sunbird/Makefile.in
calendar/sunbird/app/Makefile.in
calendar/sunbird/app/moz.build
calendar/sunbird/app/profile/extensions/Makefile.in
calendar/sunbird/app/profile/extensions/moz.build
calendar/sunbird/app/profile/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}/moz.build
calendar/sunbird/app/profile/extensions/{e2fda1a4-762b-4020-b5ad-a41df1933103}/moz.build
calendar/sunbird/base/moz.build
calendar/sunbird/branding/nightly/Makefile.in
calendar/sunbird/branding/nightly/locales/moz.build
calendar/sunbird/branding/nightly/moz.build
calendar/sunbird/locales/moz.build
calendar/sunbird/modules/moz.build
calendar/sunbird/moz.build
calendar/test/Makefile.in
calendar/test/moz.build
calendar/test/mozmill/moz.build
calendar/timezones/Makefile.in
calendar/timezones/locales/moz.build
calendar/timezones/moz.build
chat/Makefile.in
chat/components/public/moz.build
chat/components/src/moz.build
chat/content/moz.build
chat/locales/moz.build
chat/makefiles.sh
chat/modules/moz.build
chat/moz.build
chat/protocols/facebook/moz.build
chat/protocols/gtalk/moz.build
chat/protocols/irc/moz.build
chat/protocols/jsTest/moz.build
chat/protocols/odnoklassniki/moz.build
chat/protocols/twitter/moz.build
chat/protocols/vkontakte/moz.build
chat/protocols/xmpp/moz.build
chat/themes/moz.build
client.mk
config/rules.mk
configure.in
db/Makefile.in
db/makefiles.sh
db/mork/Makefile.in
db/mork/build/moz.build
db/mork/moz.build
db/mork/public/moz.build
db/mork/src/moz.build
db/moz.build
editor/ui/Makefile.in
editor/ui/locales/moz.build
editor/ui/makefiles.sh
editor/ui/moz.build
ldap/makefiles.sh
ldap/xpcom/Makefile.in
ldap/xpcom/moz.build
ldap/xpcom/public/moz.build
ldap/xpcom/src/moz.build
ldap/xpcom/tests/moz.build
mail/Makefile.in
mail/app.mozbuild
mail/app/Makefile.in
mail/app/moz.build
mail/app/profile/Makefile.in
mail/app/profile/extensions/moz.build
mail/app/profile/moz.build
mail/base/Makefile.in
mail/base/modules/moz.build
mail/base/moz.build
mail/base/test/moz.build
mail/branding/aurora/Makefile.in
mail/branding/aurora/locales/moz.build
mail/branding/aurora/moz.build
mail/branding/nightly/Makefile.in
mail/branding/nightly/locales/moz.build
mail/branding/nightly/moz.build
mail/build.mk
mail/components/Makefile.in
mail/components/about-support/moz.build
mail/components/activity/moz.build
mail/components/addrbook/moz.build
mail/components/build/moz.build
mail/components/cloudfile/moz.build
mail/components/compose/moz.build
mail/components/im/moz.build
mail/components/migration/Makefile.in
mail/components/migration/moz.build
mail/components/migration/public/moz.build
mail/components/migration/src/moz.build
mail/components/moz.build
mail/components/newmailaccount/moz.build
mail/components/phishing/moz.build
mail/components/preferences/moz.build
mail/components/search/Makefile.in
mail/components/search/mdimporter/moz.build
mail/components/search/moz.build
mail/components/search/public/moz.build
mail/components/search/wsenable/moz.build
mail/components/shell/Makefile.in
mail/components/shell/moz.build
mail/components/shell/public/moz.build
mail/components/test/moz.build
mail/components/wintaskbar/moz.build
mail/extensions/Makefile.in
mail/extensions/mailviews/moz.build
mail/extensions/moz.build
mail/extensions/smime/moz.build
mail/installer/moz.build
mail/installer/windows/moz.build
mail/jquery/moz.build
mail/locales/moz.build
mail/makefiles.sh
mail/moz.build
mail/steel/moz.build
mail/test/mozmill/moz.build
mail/themes/Makefile.in
mail/themes/gnomestripe/moz.build
mail/themes/moz.build
mail/themes/pinstripe/moz.build
mail/themes/qute/moz.build
mailnews/Makefile.in
mailnews/addrbook/Makefile.in
mailnews/addrbook/moz.build
mailnews/addrbook/public/moz.build
mailnews/addrbook/src/moz.build
mailnews/addrbook/test/moz.build
mailnews/base/Makefile.in
mailnews/base/ispdata/moz.build
mailnews/base/moz.build
mailnews/base/public/moz.build
mailnews/base/search/public/moz.build
mailnews/base/search/src/moz.build
mailnews/base/src/moz.build
mailnews/base/test/moz.build
mailnews/base/util/moz.build
mailnews/build/moz.build
mailnews/compose/Makefile.in
mailnews/compose/moz.build
mailnews/compose/public/moz.build
mailnews/compose/src/moz.build
mailnews/compose/test/moz.build
mailnews/db/Makefile.in
mailnews/db/gloda/Makefile.in
mailnews/db/gloda/components/moz.build
mailnews/db/gloda/modules/moz.build
mailnews/db/gloda/moz.build
mailnews/db/gloda/test/moz.build
mailnews/db/moz.build
mailnews/db/msgdb/Makefile.in
mailnews/db/msgdb/moz.build
mailnews/db/msgdb/public/moz.build
mailnews/db/msgdb/src/moz.build
mailnews/db/msgdb/test/moz.build
mailnews/extensions/Makefile.in
mailnews/extensions/bayesian-spam-filter/Makefile.in
mailnews/extensions/bayesian-spam-filter/moz.build
mailnews/extensions/bayesian-spam-filter/src/moz.build
mailnews/extensions/bayesian-spam-filter/test/moz.build
mailnews/extensions/dsn/moz.build
mailnews/extensions/fts3/Makefile.in
mailnews/extensions/fts3/moz.build
mailnews/extensions/fts3/public/moz.build
mailnews/extensions/fts3/src/moz.build
mailnews/extensions/mailviews/Makefile.in
mailnews/extensions/mailviews/content/moz.build
mailnews/extensions/mailviews/moz.build
mailnews/extensions/mailviews/public/moz.build
mailnews/extensions/mailviews/src/moz.build
mailnews/extensions/mdn/Makefile.in
mailnews/extensions/mdn/moz.build
mailnews/extensions/mdn/src/moz.build
mailnews/extensions/mdn/test/moz.build
mailnews/extensions/moz.build
mailnews/extensions/newsblog/moz.build
mailnews/extensions/offline-startup/moz.build
mailnews/extensions/smime/Makefile.in
mailnews/extensions/smime/build/moz.build
mailnews/extensions/smime/moz.build
mailnews/extensions/smime/public/moz.build
mailnews/extensions/smime/src/moz.build
mailnews/imap/Makefile.in
mailnews/imap/moz.build
mailnews/imap/public/moz.build
mailnews/imap/src/moz.build
mailnews/imap/test/moz.build
mailnews/import/Makefile.in
mailnews/import/applemail/src/moz.build
mailnews/import/build/moz.build
mailnews/import/eudora/src/moz.build
mailnews/import/moz.build
mailnews/import/oexpress/moz.build
mailnews/import/outlook/src/moz.build
mailnews/import/public/moz.build
mailnews/import/src/moz.build
mailnews/import/test/moz.build
mailnews/import/text/src/moz.build
mailnews/import/vcard/src/moz.build
mailnews/import/winlivemail/moz.build
mailnews/local/Makefile.in
mailnews/local/moz.build
mailnews/local/public/moz.build
mailnews/local/src/moz.build
mailnews/local/test/moz.build
mailnews/makefiles.sh
mailnews/mapi/mapiDll/moz.build
mailnews/mapi/mapihook/Makefile.in
mailnews/mapi/mapihook/build/moz.build
mailnews/mapi/mapihook/moz.build
mailnews/mapi/mapihook/public/moz.build
mailnews/mapi/mapihook/src/moz.build
mailnews/mime/Makefile.in
mailnews/mime/cthandlers/Makefile.in
mailnews/mime/cthandlers/glue/moz.build
mailnews/mime/cthandlers/moz.build
mailnews/mime/cthandlers/pgpmime/moz.build
mailnews/mime/cthandlers/smimestub/moz.build
mailnews/mime/cthandlers/vcard/moz.build
mailnews/mime/emitters/Makefile.in
mailnews/mime/emitters/moz.build
mailnews/mime/emitters/src/moz.build
mailnews/mime/moz.build
mailnews/mime/public/moz.build
mailnews/mime/src/moz.build
mailnews/mime/test/moz.build
mailnews/moz.build
mailnews/news/Makefile.in
mailnews/news/moz.build
mailnews/news/public/moz.build
mailnews/news/src/moz.build
mailnews/news/test/moz.build
mailnews/test/performance/bloat/moz.build
moz.build
other-licenses/branding/sunbird/Makefile.in
other-licenses/branding/sunbird/locales/moz.build
other-licenses/branding/sunbird/moz.build
other-licenses/branding/thunderbird/Makefile.in
other-licenses/branding/thunderbird/locales/moz.build
other-licenses/branding/thunderbird/moz.build
suite/Makefile.in
suite/app.mozbuild
suite/app/moz.build
suite/branding/nightly/moz.build
suite/browser/Makefile.in
suite/browser/moz.build
suite/browser/test/moz.build
suite/build.mk
suite/build/moz.build
suite/common/Makefile.in
suite/common/dataman/tests/moz.build
suite/common/downloads/tests/moz.build
suite/common/moz.build
suite/common/places/tests/moz.build
suite/common/public/moz.build
suite/common/src/moz.build
suite/common/tests/Makefile.in
suite/common/tests/browser/moz.build
suite/common/tests/chrome/moz.build
suite/common/tests/moz.build
suite/common/tests/preferences/moz.build
suite/debugQA/Makefile.in
suite/debugQA/locales/moz.build
suite/debugQA/moz.build
suite/feeds/public/moz.build
suite/feeds/src/moz.build
suite/installer/moz.build
suite/installer/windows/moz.build
suite/locales/moz.build
suite/mailnews/Makefile.in
suite/mailnews/modules/moz.build
suite/mailnews/moz.build
suite/makefiles.sh
suite/modules/Makefile.in
suite/modules/moz.build
suite/modules/test/moz.build
suite/moz.build
suite/profile/Makefile.in
suite/profile/migration/public/moz.build
suite/profile/migration/src/moz.build
suite/profile/moz.build
suite/security/moz.build
suite/shell/public/moz.build
suite/shell/src/moz.build
suite/smile/Makefile.in
suite/smile/moz.build
suite/smile/public/moz.build
suite/smile/src/moz.build
suite/smile/test/moz.build
suite/themes/classic/moz.build
suite/themes/modern/moz.build
deleted file mode 100755
--- a/allmakefiles.sh
+++ /dev/null
@@ -1,56 +0,0 @@
-#! /bin/sh
-#
-# 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/.
-
-# allmakefiles.sh - List of all makefiles.
-#   Appends the list of makefiles to the variable, MAKEFILES.
-#   There is no need to rerun autoconf after adding makefiles.
-#   You only need to run configure.
-
-MAKEFILES=""
-
-# add_makefiles - Shell function to add makefiles to MAKEFILES
-add_makefiles() {
-  MAKEFILES="$MAKEFILES $*"
-}
-
-if [ "$srcdir" = "" ]; then
-  srcdir=.
-fi
-
-#
-# Common makefiles used by everyone
-#
-add_makefiles "
-Makefile
-comm-config.h
-config/autoconf.mk
-"
-
-if [ "$MOZ_LDAP_XPCOM" ]; then
-  . "${srcdir}/ldap/makefiles.sh"
-fi
-
-if [ "$MOZ_MORK" ]; then
-  . "${srcdir}/db/makefiles.sh"
-fi
-
-if [ "$MOZ_COMPOSER" ]; then
-  . "${srcdir}/editor/ui/makefiles.sh"
-fi
-
-. "${srcdir}/mailnews/makefiles.sh"
-
-if [ "$MOZ_CALENDAR" ]; then
-  . "${srcdir}/calendar/shared_makefiles.sh"
-  . "${srcdir}/calendar/lightning/makefiles.sh"
-fi
-
-#
-# Application-specific makefiles
-#
-if test -f "${srcdir}/${MOZ_BUILD_APP}/makefiles.sh"; then
-  . "${srcdir}/${MOZ_BUILD_APP}/makefiles.sh"
-fi
deleted file mode 100644
--- a/bridge/bridge.mk
+++ /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/.
-
-APP_LIBXUL_DIRS += $(DEPTH)$(SUBDIR)/mozilla/xpfe/components/autocomplete
-
-ifneq (,$(MOZ_LDAP_XPCOM)$(filter mozldap,$(MOZ_APP_COMPONENT_LIBS)))
-APP_LIBXUL_STATICDIRS += $(DEPTH)$(SUBDIR)/ldap/sdks/c-sdk
-APP_LIBXUL_DIRS += $(DEPTH)$(SUBDIR)/ldap/xpcom
-endif
-
-ifneq (,$(MOZ_MORK)$(filter mork,$(MOZ_APP_COMPONENT_LIBS)))
-APP_LIBXUL_DIRS += $(DEPTH)$(SUBDIR)/db/mork
-endif
-
-APP_LIBXUL_DIRS += \
-  $(DEPTH)$(SUBDIR)/mailnews \
-  $(NULL)
new file mode 100644
--- /dev/null
+++ b/bridge/bridge.mozbuild
@@ -0,0 +1,18 @@
+# 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/.
+
+app_libxul_dirs += [bridge_reldir + 'mozilla/xpfe/components/autocomplete']
+
+component_libs = CONFIG.get('MOZ_APP_COMPONENT_LIBS', '').split()
+
+if 'mozldap' in component_libs or CONFIG['MOZ_LDAP_XPCOM']:
+    app_libxul_static_dirs += [bridge_reldir + 'ldap/sdks/c-sdk']
+    app_libxul_dirs += [bridge_reldir + 'ldap/xpcom']
+
+if 'mork' in component_libs or CONFIG['MOZ_MORK']:
+    app_libxul_dirs += [bridge_reldir + 'db/mork']
+
+app_libxul_dirs += [bridge_reldir + 'mailnews']
+
--- a/calendar/Makefile.in
+++ b/calendar/Makefile.in
@@ -6,20 +6,11 @@ DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 ifdef MOZ_SUNBIRD
 MODULE = calendar
-DIRS = libical resources base providers import-export locales
-else
-ifdef MOZ_CALENDAR
-DIRS = lightning
-endif
-endif
-
-ifdef ENABLE_TESTS
-DIRS += test
 endif
 
 include $(topsrcdir)/config/rules.mk
new file mode 100644
--- /dev/null
+++ b/calendar/app.mozbuild
@@ -0,0 +1,27 @@
+# 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/.
+
+app_libxul_dirs = []
+app_libxul_static_dirs = []
+
+# /mozilla build system.
+if not CONFIG['COMM_BUILD']:
+    if not CONFIG['LIBXUL_SDK']:
+        include('/toolkit/toolkit.mozbuild')
+
+    if CONFIG['MOZ_EXTENSIONS']:
+        add_tier_dir('app', '/toolkit/extensions')
+
+# Our build system.
+else:
+    add_tier_dir('app', [
+        CONFIG['MOZ_BRANDING_DIRECTORY'],
+        'calendar',
+        'calendar/sunbird',
+    ])
+
+    if CONFIG['MOZ_CALENDAR']:
+        add_tier_dir('app', 'calendar/lightning')
+
--- a/calendar/base/Makefile.in
+++ b/calendar/base/Makefile.in
@@ -8,18 +8,16 @@ topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE = calbase
 MODULE_NAME = calBaseModule
 
-DIRS = public src modules build
-
 # Select a theme from which to pull our skin goodness
 # Linux: gnomestripe
 # OS X: pinstripe
 # Windows: winstripe
 
 ifneq (,$(filter gtk2 qt,$(MOZ_WIDGET_TOOLKIT)))
 THEME = gnomestripe
 else
new file mode 100644
--- /dev/null
+++ b/calendar/base/build/moz.build
@@ -0,0 +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/.
+
new file mode 100644
--- /dev/null
+++ b/calendar/base/modules/moz.build
@@ -0,0 +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/.
+
new file mode 100644
--- /dev/null
+++ b/calendar/base/moz.build
@@ -0,0 +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/.
+
+DIRS = [
+    'public',
+    'src',
+    'modules',
+    'build',
+]
+
new file mode 100644
--- /dev/null
+++ b/calendar/base/public/moz.build
@@ -0,0 +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/.
+
new file mode 100644
--- /dev/null
+++ b/calendar/base/src/moz.build
@@ -0,0 +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/.
+
--- a/calendar/build.mk
+++ b/calendar/build.mk
@@ -1,41 +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/.
 
-ifndef COMM_BUILD # Mozila Makefile
-
-ifndef LIBXUL_SDK
-include $(topsrcdir)/toolkit/toolkit-tiers.mk
-endif
-
-TIERS += app
-
-ifdef MOZ_EXTENSIONS
-tier_app_dirs += extensions
-endif
-
-else # toplevel Makefile
-
-TIERS += app
-
-tier_app_dirs += $(MOZ_BRANDING_DIRECTORY)
-
-tier_app_dirs += \
-	calendar \
-	calendar/sunbird \
-	$(NULL)
-
-ifdef MOZ_CALENDAR
-tier_app_dirs += calendar/lightning
-endif
-
-endif # COMM_BUILD
-
 installer:
 	@$(MAKE) -C calendar/installer installer
 
 package:
 	@$(MAKE) -C calendar/installer
 
 package-compare:
 	@$(MAKE) -C calendar/installer package-compare
new file mode 100644
--- /dev/null
+++ b/calendar/import-export/moz.build
@@ -0,0 +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/.
+
new file mode 100644
--- /dev/null
+++ b/calendar/installer/moz.build
@@ -0,0 +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/.
+
new file mode 100644
--- /dev/null
+++ b/calendar/installer/windows/moz.build
@@ -0,0 +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/.
+
new file mode 100644
--- /dev/null
+++ b/calendar/itip/moz.build
@@ -0,0 +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/.
+
--- a/calendar/libical/Makefile.in
+++ b/calendar/libical/Makefile.in
@@ -37,11 +37,9 @@
 
 DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
-DIRS = src
-
 include $(topsrcdir)/config/rules.mk
new file mode 100644
--- /dev/null
+++ b/calendar/libical/moz.build
@@ -0,0 +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/.
+
+DIRS += ['src']
--- a/calendar/libical/src/Makefile.in
+++ b/calendar/libical/src/Makefile.in
@@ -37,11 +37,9 @@
 
 DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
-DIRS = libical
-
 include $(topsrcdir)/config/rules.mk
new file mode 100644
--- /dev/null
+++ b/calendar/libical/src/libical/moz.build
@@ -0,0 +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/.
+
new file mode 100644
--- /dev/null
+++ b/calendar/libical/src/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/.
+
+DIRS += ['libical']
+
--- a/calendar/lightning/Makefile.in
+++ b/calendar/lightning/Makefile.in
@@ -90,30 +90,16 @@ include $(topsrcdir)/config/config.mk
 # tinderboxen to disable that.
 ifndef DISABLE_LIGHTNING_INSTALL
 ifndef MOZ_SUNBIRD
 # install Lightning as a global extension in dist/bin/extensions/
 INSTALL_EXTENSION_ID = $(XPI_EM_ID)
 endif
 endif
 
-DIRS = ../libical \
-       ../locales \
-       ../base \
-       ../providers \
-       ../import-export \
-       ../itip \
-       components \
-       locales \
-       $(NULL)
-
-ifdef ENABLE_TESTS
-DIRS += ../test
-endif
-
 # Select a theme from which to pull our skin goodness
 # Linux: gnomestripe
 # OS X: pinstripe
 # Windows: winstripe
 
 ifneq (,$(filter gtk2 qt,$(MOZ_WIDGET_TOOLKIT)))
 THEME=gnomestripe
 else
new file mode 100644
--- /dev/null
+++ b/calendar/lightning/components/moz.build
@@ -0,0 +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/.
+
new file mode 100644
--- /dev/null
+++ b/calendar/lightning/locales/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/.
deleted file mode 100644
--- a/calendar/lightning/makefiles.sh
+++ /dev/null
@@ -1,11 +0,0 @@
-#! /bin/sh
-# 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/.
-
-add_makefiles "
-calendar/lightning/Makefile
-calendar/lightning/components/Makefile
-calendar/lightning/locales/Makefile
-calendar/itip/Makefile
-"
new file mode 100644
--- /dev/null
+++ b/calendar/lightning/moz.build
@@ -0,0 +1,18 @@
+# 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 += [
+    '../libical',
+    '../locales',
+    '../base',
+    '../providers',
+    '../import-export',
+    '../itip',
+    'components',
+    'locales',
+]
+
+TEST_DIRS += ['../test']
+
--- a/calendar/locales/Makefile.in
+++ b/calendar/locales/Makefile.in
@@ -8,20 +8,16 @@ topsrcdir       = @top_srcdir@
 srcdir          = @srcdir@
 VPATH           = @srcdir@
 relativesrcdir  = @relativesrcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 export MOZ_CHROME_FILE_FORMAT=jar
 
-ifeq ($(AB_CD),)
-DIRS = ../timezones
-endif
-
 include $(topsrcdir)/config/config.mk
 
 run_for_effects := $(shell if test ! -d $(DIST); then $(NSINSTALL) -D $(DIST); fi; if test ! -d $(DIST)/branding; then $(NSINSTALL) -D $(DIST)/branding; fi)
 _ABS_DIST := $(call core_abspath,$(DIST))
 
 SUBMAKEFILES += $(DEPTH)/$(MOZ_BRANDING_DIRECTORY)/Makefile
 
 # This makefile uses variable overrides from the libs-% target to
new file mode 100644
--- /dev/null
+++ b/calendar/locales/moz.build
@@ -0,0 +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/.
+
+if not CONFIG['AB_CD']:
+    DIRS += ['../timezones']
+
deleted file mode 100644
--- a/calendar/makefiles.sh
+++ /dev/null
@@ -1,18 +0,0 @@
-#! /bin/sh
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-if [ "$COMM_BUILD" ]; then
-
-    add_makefiles "
-    calendar/sunbird/Makefile
-    calendar/sunbird/app/Makefile
-    calendar/sunbird/base/Makefile
-    calendar/sunbird/locales/Makefile
-    $MOZ_BRANDING_DIRECTORY/Makefile
-    $MOZ_BRANDING_DIRECTORY/locales/Makefile
-    "
-
-   . ${srcdir}/calendar/shared_makefiles.sh
-fi
new file mode 100644
--- /dev/null
+++ b/calendar/moz.build
@@ -0,0 +1,19 @@
+# vim: set filetype=python:
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+if CONFIG['MOZ_SUNBIRD']:
+    DIRS += [
+        'libical',
+        'resources',
+        'base',
+        'providers',
+        'import-export',
+        'locales',
+    ]
+elif CONFIG['MOZ_CALENDAR']:
+    DIRS += ['lightning']
+
+TEST_DIRS += ['test']
+
--- a/calendar/providers/Makefile.in
+++ b/calendar/providers/Makefile.in
@@ -8,18 +8,9 @@ topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE = calprovs
 MODULE_NAME = calProviderModule
 
-DIRS = caldav \
-       composite \
-       gdata \
-       ics \
-       memory \
-       storage \
-       wcap \
-	   $(NULL)
-
 include $(topsrcdir)/config/rules.mk
--- a/calendar/providers/caldav/Makefile.in
+++ b/calendar/providers/caldav/Makefile.in
@@ -1,24 +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
 
 MODULE = caldav
 
-DIRS = public
-
 EXTRA_COMPONENTS = calDavCalendar.js calDavCalendar.manifest
 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
 
 # The install target must use SYSINSTALL, which is NSINSTALL in copy mode.
new file mode 100644
--- /dev/null
+++ b/calendar/providers/caldav/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/.
+
+DIRS += ['public']
+
new file mode 100644
--- /dev/null
+++ b/calendar/providers/caldav/public/moz.build
@@ -0,0 +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/.
+
new file mode 100644
--- /dev/null
+++ b/calendar/providers/composite/moz.build
@@ -0,0 +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/.
+
--- a/calendar/providers/gdata/Makefile.in
+++ b/calendar/providers/gdata/Makefile.in
@@ -26,14 +26,13 @@ DEFINES += -DAB_CD=$(AB_CD) \
            -DCALENDAR_VERSION=$(CALENDAR_VERSION) \
            -DSEAMONKEY_VERSION=$(SEAMONKEY_VERSION) \
            -DTHUNDERBIRD_VERSION=$(THUNDERBIRD_VERSION) \
            -DCOMM_BUILD=$(COMM_BUILD) \
            -DGDATA_VERSION=$(GDATA_VERSION) \
            $(NULL)
 
 PREF_JS_EXPORTS = $(srcdir)/defaults/preferences.js
-DIRS = components locales public
 
 libs-%:
 	$(MAKE) -C locales libs AB_CD=$* XPI_NAME=$(XPI_NAME) USE_EXTENSION_MANIFEST=1
 
 include $(topsrcdir)/config/rules.mk
new file mode 100644
--- /dev/null
+++ b/calendar/providers/gdata/components/moz.build
@@ -0,0 +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/.
+
new file mode 100644
--- /dev/null
+++ b/calendar/providers/gdata/locales/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/calendar/providers/gdata/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/.
+
+DIRS += [
+    'components',
+    'locales',
+    'public',
+]
+
new file mode 100644
--- /dev/null
+++ b/calendar/providers/gdata/public/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/calendar/providers/ics/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/calendar/providers/memory/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/calendar/providers/moz.build
@@ -0,0 +1,15 @@
+# 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 += [
+    'caldav',
+    'composite',
+    'gdata',
+    'ics',
+    'memory',
+    'storage',
+    'wcap',
+]
+
new file mode 100644
--- /dev/null
+++ b/calendar/providers/storage/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/calendar/providers/wcap/Makefile.in
+++ b/calendar/providers/wcap/Makefile.in
@@ -4,17 +4,16 @@
 
 DEPTH           = @DEPTH@
 topsrcdir       = @top_srcdir@
 srcdir          = @srcdir@
 VPATH           = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
-DIRS            = public
 MODULE          = wcap
 
 EXTRA_SCRIPTS = \
                 calWcapUtils.js \
                 calWcapRequest.js \
                 calWcapErrors.js \
                 calWcapSession.js \
                 calWcapCalendarItems.js \
new file mode 100644
--- /dev/null
+++ b/calendar/providers/wcap/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/.
+
+DIRS += ['public']
+
new file mode 100644
--- /dev/null
+++ b/calendar/providers/wcap/public/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/calendar/resources/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/.
deleted file mode 100755
--- a/calendar/shared_makefiles.sh
+++ /dev/null
@@ -1,26 +0,0 @@
- # ***** BEGIN LICENSE BLOCK *****
-# 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/.
-
-add_makefiles "
-calendar/Makefile
-calendar/resources/Makefile
-calendar/libical/Makefile
-calendar/libical/src/Makefile
-calendar/libical/src/libical/Makefile
-calendar/base/Makefile
-calendar/base/public/Makefile
-calendar/base/src/Makefile
-calendar/base/build/Makefile
-calendar/providers/Makefile
-calendar/providers/memory/Makefile
-calendar/providers/storage/Makefile
-calendar/providers/composite/Makefile
-calendar/installer/Makefile
-calendar/installer/windows/Makefile
-calendar/locales/Makefile
-calendar/import-export/Makefile
-calendar/timezones/Makefile
-calendar/timezones/locales/Makefile
-"
--- a/calendar/sunbird/Makefile.in
+++ b/calendar/sunbird/Makefile.in
@@ -4,20 +4,17 @@
 
 DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
-DIRS = base locales app
-
 ifeq ($(OS_ARCH),WINNT)
-DIRS += ../installer/windows
 
 # 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
 
 include $(topsrcdir)/config/rules.mk
--- a/calendar/sunbird/app/Makefile.in
+++ b/calendar/sunbird/app/Makefile.in
@@ -4,18 +4,16 @@
 
 DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
-DIRS		= profile/extensions
-
 PREF_JS_EXPORTS = \
     $(srcdir)/profile/sunbird.js \
     $(srcdir)/profile/channel-prefs.js \
     $(NULL)
 
 # hardcode en-US for the moment
 AB_CD = en-US
 DEFINES += -DAB_CD=$(AB_CD)
new file mode 100644
--- /dev/null
+++ b/calendar/sunbird/app/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/.
+
+DIRS += ['profile/extensions']
+
--- a/calendar/sunbird/app/profile/extensions/Makefile.in
+++ b/calendar/sunbird/app/profile/extensions/Makefile.in
@@ -5,14 +5,10 @@
 
 DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
-DIRS = {972ce4c6-7e08-4474-a285-3208198ce6fd} \
-       {e2fda1a4-762b-4020-b5ad-a41df1933103} \
-       $(NULL)
-
 include $(topsrcdir)/config/rules.mk
 
new file mode 100644
--- /dev/null
+++ b/calendar/sunbird/app/profile/extensions/moz.build
@@ -0,0 +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/.
+
+DIRS += [
+    '{972ce4c6-7e08-4474-a285-3208198ce6fd}',
+    '{e2fda1a4-762b-4020-b5ad-a41df1933103}',
+]
+
new file mode 100644
--- /dev/null
+++ b/calendar/sunbird/app/profile/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}/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/calendar/sunbird/app/profile/extensions/{e2fda1a4-762b-4020-b5ad-a41df1933103}/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/calendar/sunbird/base/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/calendar/sunbird/branding/nightly/Makefile.in
+++ b/calendar/sunbird/branding/nightly/Makefile.in
@@ -4,20 +4,16 @@
 
 DEPTH = @DEPTH@
 topsrcdir = @top_srcdir@
 srcdir = @srcdir@
 VPATH = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
-DIRS = \
-	locales \
-	$(NULL)
-
 include $(topsrcdir)/config/rules.mk
 
 export::
 	$(NSINSTALL) -D $(DIST)/branding
 ifeq ($(OS_ARCH),WINNT)
 	cp $(srcdir)/sunbird.ico       $(DIST)/branding/sunbird.ico
 	cp $(srcdir)/sunbird.ico       $(DIST)/branding/app.ico
 	cp $(srcdir)/sunbird.ico       $(DIST)/branding/document.ico
new file mode 100644
--- /dev/null
+++ b/calendar/sunbird/branding/nightly/locales/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/calendar/sunbird/branding/nightly/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/.
+
+DIRS += ['locales']
+
new file mode 100644
--- /dev/null
+++ b/calendar/sunbird/locales/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/calendar/sunbird/modules/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/calendar/sunbird/moz.build
@@ -0,0 +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/.
+
+DIRS += [
+    'base',
+    'locales',
+    'app',
+]
+
+if CONFIG['OS_ARCH'] == 'WINNT':
+    DIRS += ['../installer/windows']
+
--- a/calendar/test/Makefile.in
+++ b/calendar/test/Makefile.in
@@ -7,11 +7,9 @@ topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir = @relativesrcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 XPCSHELL_TESTS = unit
 
-DIRS = mozmill
-
 include $(topsrcdir)/config/rules.mk
new file mode 100644
--- /dev/null
+++ b/calendar/test/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/.
+
+DIRS += ['mozmill']
+
new file mode 100644
--- /dev/null
+++ b/calendar/test/mozmill/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/calendar/timezones/Makefile.in
+++ b/calendar/timezones/Makefile.in
@@ -30,17 +30,16 @@ include $(DEPTH)/config/autoconf.mk
 
 MODULE = timezones
 export USE_EXTENSION_MANIFEST = 1
 export XPI_NAME = calendar-timezones
 DIST_FILES = install.rdf
 XPI_PKGNAME = calendar-timezones
 
 PREF_JS_EXPORTS = $(srcdir)/defaults/preferences.js
-DIRS = locales
 
 ifndef DISABLE_LIGHTNING_INSTALL
 # install as a global extension in dist/bin/extensions/
 INSTALL_EXTENSION_ID = calendar-timezones@mozilla.org
 endif
 
 CALENDAR_VERSION := $(shell cat $(topsrcdir)/calendar/sunbird/config/version.txt)
 THUNDERBIRD_VERSION := $(shell cat $(topsrcdir)/mail/config/version.txt)
new file mode 100644
--- /dev/null
+++ b/calendar/timezones/locales/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/calendar/timezones/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/.
+
+DIRS += ['locales']
+
--- a/chat/Makefile.in
+++ b/chat/Makefile.in
@@ -4,35 +4,11 @@
 
 DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
-PROTOCOLS = \
-		facebook \
-		gtalk \
-		irc \
-		odnoklassniki \
-		twitter \
-		vkontakte \
-		xmpp \
-		$(NULL)
-
-ifdef MOZ_DEBUG
-PROTOCOLS += jsTest
-endif
-
 PREF_JS_EXPORTS = $(srcdir)/chat-prefs.js
 
-PARALLEL_DIRS	= \
-		components/public \
-		components/src \
-		modules \
-		content \
-		themes \
-		locales \
-		$(foreach proto,$(PROTOCOLS),protocols/$(proto)) \
-		$(NULL)
-
 include $(topsrcdir)/config/rules.mk
new file mode 100644
--- /dev/null
+++ b/chat/components/public/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/chat/components/src/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/chat/content/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/chat/locales/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/.
deleted file mode 100644
--- a/chat/makefiles.sh
+++ /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/.
-
-add_makefiles "
-chat/Makefile
-chat/components/public/Makefile
-chat/components/src/Makefile
-chat/content/Makefile
-chat/locales/Makefile
-chat/modules/Makefile
-chat/protocols/facebook/Makefile
-chat/protocols/gtalk/Makefile
-chat/protocols/irc/Makefile
-chat/protocols/jsTest/Makefile
-chat/protocols/odnoklassniki/Makefile
-chat/protocols/twitter/Makefile
-chat/protocols/vkontakte/Makefile
-chat/protocols/xmpp/Makefile
-chat/themes/Makefile
-"
new file mode 100644
--- /dev/null
+++ b/chat/modules/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/chat/moz.build
@@ -0,0 +1,24 @@
+# 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/.
+
+PARALLEL_DIRS += [
+    'components/public',
+    'components/src',
+    'modules',
+    'content',
+    'themes',
+    'locales',
+    'protocols/facebook',
+    'protocols/gtalk',
+    'protocols/irc',
+    'protocols/odnoklassniki',
+    'protocols/twitter',
+    'protocols/vkontakte',
+    'protocols/xmpp',
+]
+
+if CONFIG['MOZ_DEBUG']:
+    PARALLEL_DIRS += ['protocols/jsTest']
+
new file mode 100644
--- /dev/null
+++ b/chat/protocols/facebook/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/chat/protocols/gtalk/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/chat/protocols/irc/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/chat/protocols/jsTest/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/chat/protocols/odnoklassniki/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/chat/protocols/twitter/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/chat/protocols/vkontakte/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/chat/protocols/xmpp/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/chat/themes/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/client.mk
+++ b/client.mk
@@ -264,18 +264,16 @@ EXTRA_CONFIG_DEPS := \
 	$(NULL)
 
 $(CONFIGURES): %: %.in $(EXTRA_CONFIG_DEPS)
 	@echo Generating $@ using autoconf
 	cd $(@D); $(AUTOCONF)
 
 CONFIG_STATUS_DEPS := \
 	$(wildcard $(CONFIGURES)) \
-	$(TOPSRCDIR)/allmakefiles.sh \
-	$(TOPSRCDIR)/mozilla/allmakefiles.sh \
 	$(wildcard $(TOPSRCDIR)/mozilla/nsprpub/configure) \
 	$(wildcard $(TOPSRCDIR)/mozilla/config/milestone.txt) \
 	$(wildcard $(TOPSRCDIR)/ldap/sdks/c-sdk/configure) \
 	$(wildcard $(addsuffix confvars.sh,$(wildcard $(TOPSRCDIR)/*/))) \
 	$(NULL)
 
 CONFIGURE_ENV_ARGS += \
   MAKE="$(MAKE)" \
--- a/config/rules.mk
+++ b/config/rules.mk
@@ -4,16 +4,42 @@
 # 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/.
 #
 
 ifndef topsrcdir
 $(error topsrcdir was not set))
 endif
 
+# Integrate with mozbuild-generated make files. We first verify that no
+# variables provided by the automatically generated .mk files are
+# present. If they are, this is a violation of the separation of
+# responsibility between Makefile.in and mozbuild files.
+_MOZBUILD_EXTERNAL_VARIABLES := \
+  DIRS \
+  PARALLEL_DIRS \
+  TEST_DIRS \
+  TIERS \
+  TOOL_DIRS \
+  $(NULL)
+
+ifndef EXTERNALLY_MANAGED_MAKE_FILE
+$(foreach var,$(_MOZBUILD_EXTERNAL_VARIABLES),$(if $($(var)),\
+    $(error Variable $(var) is defined in Makefile. It should only be defined in moz.build files.),\
+    ))
+
+# Import the automatically generated backend file. If this file doesn't exist,
+# the backend hasn't been properly configured. We want this to be a fatal
+# error, hence not using "-include".
+ifndef STANDALONE_MAKEFILE
+GLOBAL_DEPS += backend.mk
+include backend.mk
+endif
+endif
+
 ifndef MOZILLA_DIR
 MOZILLA_DIR = $(MOZILLA_SRCDIR)
 endif
 
 ifndef INCLUDED_CONFIG_MK
 include $(topsrcdir)/config/config.mk
 endif
 
@@ -69,16 +95,18 @@ endif
 ################################################################################
 # Testing frameworks support
 ################################################################################
 
 testxpcobjdir = $(MOZDEPTH)/_tests/xpcshell
 
 ifdef ENABLE_TESTS
 
+DIRS += $(TEST_DIRS)
+
 ifdef XPCSHELL_TESTS
 ifndef relativesrcdir
 $(error Must define relativesrcdir when defining XPCSHELL_TESTS.)
 endif
 
 define _INSTALL_TESTS
 $(DIR_INSTALL) $(wildcard $(srcdir)/$(dir)/*) $(testxpcobjdir)/$(relativesrcdir)/$(dir)
 
--- a/configure.in
+++ b/configure.in
@@ -6381,41 +6381,33 @@ case "$host" in
 *-apple-darwin11*)
     FIXED_EGREP="arch -arch i386 egrep"
     ;;
 *)
     FIXED_EGREP="egrep"
     ;;
 esac
 
-dnl Load the list of Makefiles to generate.
-dnl   To add new Makefiles, edit allmakefiles.sh.
-dnl   allmakefiles.sh sets the variable, MAKEFILES.
-. ${srcdir}/allmakefiles.sh
-
-echo $MAKEFILES > unallmakefiles
-
-AC_OUTPUT($MAKEFILES)
+AC_OUTPUT([comm-config.h config/autoconf.mk])
 
 dnl ========================================================
 dnl = Setup a nice relatively clean build environment for
 dnl = sub-configures.
 dnl ========================================================
 CC="$_SUBDIR_CC" 
 CXX="$_SUBDIR_CXX" 
 CFLAGS="$_SUBDIR_CFLAGS" 
 CPPFLAGS="$_SUBDIR_CPPFLAGS"
 CXXFLAGS="$_SUBDIR_CXXFLAGS"
 LDFLAGS="$_SUBDIR_LDFLAGS"
 HOST_CC="$_SUBDIR_HOST_CC" 
 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
 RC=
 
-unset MAKEFILES
 unset CONFIG_FILES
 
 export WRAP_LDFLAGS
 
 if test -n "$_WRAP_MALLOC"; then
     # Avoid doubling wrap malloc arguments
     _SUBDIR_CONFIG_ARGS="`echo $_SUBDIR_CONFIG_ARGS | sed -e 's/--enable-wrap-malloc *//'`"
 fi
@@ -6424,18 +6416,19 @@ fi
 #
 # the subdir may not yet have been created in the build tree.
 #
 if test ! -d "mozilla"; then
     mkdir "mozilla"
 fi
 
 # --enable-application needs to find confvars.sh, build.mk, etc in the gived dir, so add ../
+# --external-source-dir is so the build system doesn't reject files outside known locations.
 # --disable-official-branding disables all checks for official branding, as we're doing this ourselves in our own repo
-ac_configure_args="$_SUBDIR_CONFIG_ARGS --enable-application=../$MOZ_BUILD_APP --disable-official-branding --with-branding=../$REAL_BRANDING_DIRECTORY"
+ac_configure_args="$_SUBDIR_CONFIG_ARGS --enable-application=../$MOZ_BUILD_APP --with-external-source-dir=$_topsrcdir --disable-official-branding --with-branding=../$REAL_BRANDING_DIRECTORY"
 if test -n "$L10NBASEDIR"; then
     dnl Override the initial value with the new one which is guaranteed to be an absolute path.
     ac_configure_args="$ac_configure_args --with-l10n-base=$L10NBASEDIR"
 fi
 
 # for Mac universal builds, we need to call the Mozilla configure with MOZ_BUILD_APP=[i386|x86_64]
 MOZ_BUILD_APP_CACHED="$MOZ_BUILD_APP"
 if test -n "$MOZ_CURRENT_PROJECT"; then
--- a/db/Makefile.in
+++ b/db/Makefile.in
@@ -5,15 +5,9 @@
 
 DEPTH     = @DEPTH@
 topsrcdir = @top_srcdir@
 srcdir    = @srcdir@
 VPATH     = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
-ifndef NSS_DISABLE_DBM
-ifdef MOZ_MORK
-PARALLEL_DIRS = mork
-endif
-endif 
-
 include $(topsrcdir)/config/rules.mk
deleted file mode 100644
--- a/db/makefiles.sh
+++ /dev/null
@@ -1,12 +0,0 @@
-#! /bin/sh
-# 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/.
-
-add_makefiles "
-db/Makefile
-db/mork/Makefile
-db/mork/public/Makefile
-db/mork/build/Makefile
-db/mork/src/Makefile
-"
--- a/db/mork/Makefile.in
+++ b/db/mork/Makefile.in
@@ -7,12 +7,10 @@ DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE = mork
 
-DIRS = public src build
-
 include $(topsrcdir)/config/rules.mk
 
new file mode 100644
--- /dev/null
+++ b/db/mork/build/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/db/mork/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/.
+
+DIRS += [
+    'public',
+    'src',
+    'build',
+]
+
new file mode 100644
--- /dev/null
+++ b/db/mork/public/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/db/mork/src/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/db/moz.build
@@ -0,0 +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/.
+
+if not CONFIG['NSS_DISABLE_DBM'] and CONFIG['MOZ_MORK']:
+    PARALLEL_DIRS += ['mork']
+
--- a/editor/ui/Makefile.in
+++ b/editor/ui/Makefile.in
@@ -4,20 +4,16 @@
 
 DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
-DIRS           = \
-               locales \
-               $(NULL)
-
 ifndef MOZ_STANDALONE_COMPOSER
 PREF_JS_EXPORTS = $(srcdir)/composer.js
 ifdef MOZ_SUITE
 EXTRA_COMPONENTS = nsComposerCmdLineHandler.manifest nsComposerCmdLineHandler.js
 endif
 endif
 
 EXTRA_JS_MODULES += \
new file mode 100644
--- /dev/null
+++ b/editor/ui/locales/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/.
deleted file mode 100644
--- a/editor/ui/makefiles.sh
+++ /dev/null
@@ -1,9 +0,0 @@
-#! /bin/sh
-# 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/.
-
-add_makefiles "
-editor/ui/Makefile
-editor/ui/locales/Makefile
-"
new file mode 100644
--- /dev/null
+++ b/editor/ui/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/.
+
+DIRS += ['locales']
+
deleted file mode 100644
--- a/ldap/makefiles.sh
+++ /dev/null
@@ -1,11 +0,0 @@
-#! /bin/sh
-# 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/.
-
-add_makefiles "
-ldap/xpcom/Makefile
-ldap/xpcom/public/Makefile
-ldap/xpcom/src/Makefile
-ldap/xpcom/tests/Makefile
-"
--- a/ldap/xpcom/Makefile.in
+++ b/ldap/xpcom/Makefile.in
@@ -5,18 +5,9 @@
 
 DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
-PARALLEL_DIRS	= \
-		public \
-		src \
-		$(NULL)
-
-ifdef ENABLE_TESTS
-TOOL_DIRS += tests
-endif
-
 include $(topsrcdir)/config/rules.mk
new file mode 100644
--- /dev/null
+++ b/ldap/xpcom/moz.build
@@ -0,0 +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/.
+
+PARALLEL_DIRS += [
+    'public',
+    'src',
+]
+
+TEST_TOOL_DIRS += ['tests']
+
new file mode 100644
--- /dev/null
+++ b/ldap/xpcom/public/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/ldap/xpcom/src/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/ldap/xpcom/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/mail/Makefile.in
+++ b/mail/Makefile.in
@@ -5,31 +5,17 @@
 
 DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(topsrcdir)/config/config.mk
 
-# app is always last as it packages up the built files on mac
-DIRS += base locales extensions steel themes jquery app
-
-# add components for external linkage build
-ifdef MOZ_INCOMPLETE_EXTERNAL_LINKAGE
-DIRS += components
-endif
-
-ifeq ($(OS_ARCH),WINNT)
-# though some lasts are more last than others
-DIRS += installer/windows
-endif
-
 ifdef ENABLE_TESTS
-DIRS += test/mozmill
 
 check-sync-dirs::
 	@$(PYTHON) $(topsrcdir)/mozilla/js/src/config/check-sync-dirs.py \
 	   $(srcdir)/config/tooltool-manifests $(MOZILLA_SRCDIR)/browser/config/tooltool-manifests
 
 check:: check-sync-dirs
 endif
 
new file mode 100644
--- /dev/null
+++ b/mail/app.mozbuild
@@ -0,0 +1,40 @@
+# vim: set filetype=python:
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+app_libxul_dirs = []
+app_libxul_static_dirs = []
+
+# Invoked from /mozilla.
+if not CONFIG['COMM_BUILD']:
+    if CONFIG['MOZ_APP_COMPONENT_LIBS']:
+        bridge_reldir = '../'
+        include('../bridge/bridge.mozbuild')
+        app_libxul_dirs += ['../mail/components']
+
+    if not CONFIG['LIBXUL_SDK']:
+        include('/toolkit/toolkit.mozbuild')
+
+    if CONFIG['MOZ_EXTENSIONS']:
+        add_tier_dir('app', 'toolkit/extensions')
+
+else:
+    bridge_reldir = ''
+    include('/bridge/bridge.mozbuild')
+
+    if CONFIG['MOZ_INCOMPLETE_EXTERNAL_LINKAGE']:
+        add_tier_dir('app', app_libxul_static_dirs, static=True)
+        add_tier_dir('app', app_libxul_dirs)
+
+    if CONFIG['MOZ_COMPOSER']:
+        add_tier_dir('app', 'editor/ui')
+
+    add_tier_dir('app', CONFIG['MOZ_BRANDING_DIRECTORY'])
+
+    if CONFIG['MOZ_CALENDAR']:
+        add_tier_dir('app', 'calendar/lightning')
+
+    add_tier_dir('app', 'chat')
+    add_tier_dir('app', 'mail')
+
--- a/mail/app/Makefile.in
+++ b/mail/app/Makefile.in
@@ -23,18 +23,16 @@ SOURCE_REPO := $(shell hg -R $(topsrcdir
 ifdef SOURCE_REPO
 DEFINES += -DMOZ_SOURCE_REPO="$(SOURCE_REPO)"
 endif
 
 ifdef MOZILLA_OFFICIAL
 DEFINES += -DMOZILLA_OFFICIAL
 endif
 
-DIRS		= profile
-
 PREF_JS_EXPORTS = \
     $(srcdir)/profile/all-thunderbird.js \
     $(srcdir)/profile/channel-prefs.js \
     $(NULL)
 
 DEFINES += \
   -DAB_CD=$(AB_CD) \
   -DAPP_VERSION="$(MOZ_APP_VERSION)" \
new file mode 100644
--- /dev/null
+++ b/mail/app/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/.
+
+DIRS += ['profile']
+
--- a/mail/app/profile/Makefile.in
+++ b/mail/app/profile/Makefile.in
@@ -5,18 +5,16 @@
 
 DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
-DIRS		= extensions
-
 include $(topsrcdir)/config/rules.mk
 
 FILES := \
 	mimeTypes.rdf \
 	localstore.rdf \
 	$(NULL)
 
 libs:: $(FILES)
new file mode 100644
--- /dev/null
+++ b/mail/app/profile/extensions/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/mail/app/profile/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/.
+
+DIRS += ['extensions']
+
--- a/mail/base/Makefile.in
+++ b/mail/base/Makefile.in
@@ -5,18 +5,16 @@
 
 DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
-DIRS = modules
-
 PRE_RELEASE_SUFFIX := $(shell $(PYTHON) $(topsrcdir)/mozilla/config/printprereleasesuffix.py \
                       $(MOZ_APP_VERSION))
 
 DEFINES += -DMOZ_APP_VERSION=$(MOZ_APP_VERSION) \
            -DPRE_RELEASE_SUFFIX=""
 
 ifdef MOZILLA_OFFICIAL
 DEFINES += -DOFFICIAL_BUILD=1
@@ -25,20 +23,16 @@ endif
 ifneq (,$(filter windows gtk2 cocoa, $(MOZ_WIDGET_TOOLKIT)))
 DEFINES += -DHAVE_SHELL_SERVICE=1
 endif
 
 ifdef MOZ_UPDATER
 DEFINES += -DMOZ_UPDATER=1
 endif
 
-ifdef ENABLE_TESTS
-DIRS += test
-endif
-
 ifneq (,$(filter windows, $(MOZ_WIDGET_TOOLKIT)))
 DEFINES += -DCAN_DRAW_IN_TITLEBAR=1
 endif
 
 abs_srcdir = $(call core_abspath,$(srcdir))
 
 CHROME_DEPS += $(abs_srcdir)/content/overrides/app-license.html
 
new file mode 100644
--- /dev/null
+++ b/mail/base/modules/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/mail/base/moz.build
@@ -0,0 +1,9 @@
+# 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 += ['modules']
+
+TEST_DIRS += ['test']
+
new file mode 100644
--- /dev/null
+++ b/mail/base/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/mail/branding/aurora/Makefile.in
+++ b/mail/branding/aurora/Makefile.in
@@ -6,20 +6,16 @@
 
 DEPTH = @DEPTH@
 topsrcdir = @top_srcdir@
 srcdir = @srcdir@
 VPATH = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
-DIRS = \
-	locales \
-	$(NULL)
-
 PREF_JS_EXPORTS += $(srcdir)/thunderbird-branding.js
 
 include $(topsrcdir)/config/rules.mk
 
 export::
 	$(NSINSTALL) -D $(DIST)/branding
 ifeq ($(OS_ARCH),WINNT)
 	cp $(srcdir)/thunderbird.ico   $(DIST)/branding/thunderbird.ico
new file mode 100644
--- /dev/null
+++ b/mail/branding/aurora/locales/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/mail/branding/aurora/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/.
+
+DIRS += ['locales']
+
--- a/mail/branding/nightly/Makefile.in
+++ b/mail/branding/nightly/Makefile.in
@@ -6,20 +6,16 @@
 
 DEPTH = @DEPTH@
 topsrcdir = @top_srcdir@
 srcdir = @srcdir@
 VPATH = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
-DIRS = \
-	locales \
-	$(NULL)
-
 PREF_JS_EXPORTS += $(srcdir)/thunderbird-branding.js
 
 include $(topsrcdir)/config/rules.mk
 
 export::
 	$(NSINSTALL) -D $(DIST)/branding
 ifeq ($(OS_ARCH),WINNT)
 	cp $(srcdir)/thunderbird.ico   $(DIST)/branding/thunderbird.ico
new file mode 100644
--- /dev/null
+++ b/mail/branding/nightly/locales/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/mail/branding/nightly/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/.
+
+DIRS += ['locales']
+
--- a/mail/build.mk
+++ b/mail/build.mk
@@ -1,61 +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/.
 
-ifndef COMM_BUILD # Mozilla Makefile
-
-ifdef MOZ_APP_COMPONENT_LIBS
-SUBDIR=/..
-include $(topsrcdir)/../bridge/bridge.mk
-# For libxul builds this gets linked into libxul. For non-libxul
-# builds, the build of components is controlled in mail/Makefile.in
-APP_LIBXUL_DIRS += $(DEPTH)/../mail/components
-endif
-
-ifndef LIBXUL_SDK
-include $(topsrcdir)/toolkit/toolkit-tiers.mk
-endif
-
-TIERS += app
-
-ifdef MOZ_EXTENSIONS
-tier_app_dirs += extensions
-endif
-
-else # toplevel Makefile
-
-TIERS += app
-
-include $(topsrcdir)/bridge/bridge.mk
-ifdef MOZ_INCOMPLETE_EXTERNAL_LINKAGE
-tier_app_staticdirs += $(APP_LIBXUL_STATICDIRS:./%=%)
-tier_app_dirs += $(APP_LIBXUL_DIRS:./%=%)
-else
+ifdef COMM_BUILD
+ifndef MOZ_INCOMPLETE_EXTERNAL_LINKAGE
 # workaround Bug 599809 by making these makefiles be generated here
 SUBMAKEFILES += $(addsuffix /Makefile, $(APP_LIBXUL_DIRS) $(APP_LIBXUL_STATICDIRS))
 endif
 
-ifdef MOZ_COMPOSER
-tier_app_dirs += editor/ui
-endif
-
-tier_app_dirs += $(MOZ_BRANDING_DIRECTORY)
-
-ifdef MOZ_CALENDAR
-tier_app_dirs += calendar/lightning
-endif
-
-tier_app_dirs += \
-	chat \
-	mail \
-	$(NULL)
-#	purple instantbird
-
 installer:
 	@$(MAKE) -C mail/installer installer
 
 package:
 	@$(MAKE) -C mail/installer
 
 package-compare:
 	@$(MAKE) -C mail/installer package-compare
--- a/mail/components/Makefile.in
+++ b/mail/components/Makefile.in
@@ -12,34 +12,16 @@ include $(DEPTH)/config/autoconf.mk
 
 MODULE = mailcomps
 XPIDL_MODULE = mailcompsbase
 
 XPIDLSRCS = \
       nsIMailGlue.idl \
       $(NULL)
 
-# Only Mac and Windows have search integration components, but we include at
-# least one module from search/ on all platforms
-DIRS    = compose cloudfile preferences addrbook migration activity search about-support wintaskbar newmailaccount im
-
-ifneq (,$(filter windows gtk2 cocoa qt, $(MOZ_WIDGET_TOOLKIT)))
-DIRS += shell
-endif
-
-ifdef MOZ_SAFE_BROWSING
-DIRS += phishing 
-endif
-
-ifdef ENABLE_TESTS
-DIRS += test
-endif
-
-DIRS += build
-
 EXTRA_COMPONENTS = \
 	nsMailDefaultHandler.js \
 	mailContentHandler.js \
 	aboutRedirector.js \
 	mailGlue.js \
 	mailComponents.manifest \
 	$(NULL)
 
new file mode 100644
--- /dev/null
+++ b/mail/components/about-support/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/mail/components/activity/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/mail/components/addrbook/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/mail/components/build/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/mail/components/cloudfile/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/mail/components/compose/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/mail/components/im/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/mail/components/migration/Makefile.in
+++ b/mail/components/migration/Makefile.in
@@ -4,13 +4,10 @@
 
 DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
-DIRS		= public src
-
 include $(topsrcdir)/config/rules.mk
 
-
new file mode 100644
--- /dev/null
+++ b/mail/components/migration/moz.build
@@ -0,0 +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/.
+
+DIRS += [
+    'public',
+    'src',
+]
+
new file mode 100644
--- /dev/null
+++ b/mail/components/migration/public/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/mail/components/migration/src/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/mail/components/moz.build
@@ -0,0 +1,31 @@
+# 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/.
+
+# Only Mac and Windows have search integration components, but we include at
+# least one module from search/ on all platforms
+DIRS += [
+    'compose',
+    'cloudfile',
+    'preferences',
+    'addrbook',
+    'migration',
+    'activity',
+    'search',
+    'about-support',
+    'wintaskbar',
+    'newmailaccount',
+    'im',
+]
+
+if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('windows', 'gtk2', 'cocoa', 'qt'):
+    DIRS += ['shell']
+
+if CONFIG['MOZ_SAFE_BROWSING']:
+    DIRS += ['phishing']
+
+TEST_DIRS += ['test']
+
+DIRS += ['build']
+
new file mode 100644
--- /dev/null
+++ b/mail/components/newmailaccount/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/mail/components/phishing/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/mail/components/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/mail/components/search/Makefile.in
+++ b/mail/components/search/Makefile.in
@@ -9,24 +9,16 @@ VPATH     = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 # Include SearchIntegration.js on all platforms
 EXTRA_PP_JS_MODULES = \
   SearchIntegration.js \
   $(NULL)
 
-ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
-DIRS += mdimporter
-endif
-
-ifneq (,$(filter windows, $(MOZ_WIDGET_TOOLKIT)))
-DIRS += wsenable
-endif
-
 # If on Mac, build Spotlight integration
 ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
 EXTRA_PP_JS_MODULES += \
   SpotlightIntegration.js \
   $(NULL)
 endif
 
 # If on Windows, build Windows Search integration
@@ -38,18 +30,16 @@ ifneq ($(MOZ_WIDGET_TOOLKIT), gtk2)
 MOZILLA_INTERNAL_API = 1
 endif
 
 
 CPPSRCS = \
   nsMailWinSearchHelper.cpp \
   $(NULL)
 
-DIRS += public
-
 # Windows Search component
 EXTRA_PP_JS_MODULES += \
   WinSearchIntegration.js \
   $(NULL)
 
 FORCE_STATIC_LIB = 1
 endif
 
new file mode 100644
--- /dev/null
+++ b/mail/components/search/mdimporter/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/mail/components/search/moz.build
@@ -0,0 +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/.
+
+if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
+    DIRS += ['mdimporter']
+elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
+    DIRS += ['wsenable']
+
+DIRS += ['public']
+
new file mode 100644
--- /dev/null
+++ b/mail/components/search/public/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/mail/components/search/wsenable/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/mail/components/shell/Makefile.in
+++ b/mail/components/shell/Makefile.in
@@ -4,18 +4,16 @@
 
 DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
-DIRS = public
-
 DEFINES += -DMOZ_APP_NAME=\"$(MOZ_APP_NAME)\"
 
 MODULE = shellservice
 LIBRARY_NAME = shellservice_s
 MODULE_NAME = nsMailShellModule
 MOZILLA_INTERNAL_API = 1
 
 EXTRA_COMPONENTS = \
new file mode 100644
--- /dev/null
+++ b/mail/components/shell/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/.
+
+DIRS += ['public']
+
new file mode 100644
--- /dev/null
+++ b/mail/components/shell/public/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/mail/components/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/.
new file mode 100644
--- /dev/null
+++ b/mail/components/wintaskbar/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/mail/extensions/Makefile.in
+++ b/mail/extensions/Makefile.in
@@ -5,20 +5,14 @@
 
 DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
-DIRS = mailviews
-
 ifdef MOZ_PSM
 BUILD_SMIME=1
 endif
 
-ifdef BUILD_SMIME
-DIRS		+= smime
-endif
-
 include $(topsrcdir)/config/rules.mk
 
new file mode 100644
--- /dev/null
+++ b/mail/extensions/mailviews/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/mail/extensions/moz.build
@@ -0,0 +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/.
+
+DIRS += ['mailviews']
+
+if CONFIG['MOZ_PSM'] or CONFIG['BUILD_SMIME']:
+    DIRS += ['smime']
+
new file mode 100644
--- /dev/null
+++ b/mail/extensions/smime/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/mail/installer/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/mail/installer/windows/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/mail/jquery/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/mail/locales/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/.
deleted file mode 100644
--- a/mail/makefiles.sh
+++ /dev/null
@@ -1,47 +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/.
-
-if [ "$COMM_BUILD" ]; then
-add_makefiles "
-mail/Makefile
-mail/app/Makefile
-mail/app/profile/Makefile
-mail/base/Makefile
-mail/components/Makefile
-mail/components/about-support/Makefile
-mail/components/activity/Makefile
-mail/components/addrbook/Makefile
-mail/components/build/Makefile
-mail/components/compose/Makefile
-mail/components/im/Makefile
-mail/components/migration/Makefile
-mail/components/migration/public/Makefile
-mail/components/migration/src/Makefile
-mail/components/newmailaccount/Makefile
-mail/components/phishing/Makefile
-mail/components/preferences/Makefile
-mail/components/search/Makefile
-mail/components/shell/Makefile
-mail/components/shell/public/Makefile
-mail/components/test/Makefile
-mail/components/wintaskbar/Makefile
-mail/extensions/Makefile
-mail/extensions/mailviews/Makefile
-mail/extensions/smime/Makefile
-mail/installer/Makefile
-mail/installer/windows/Makefile
-mail/jquery/Makefile
-mail/locales/Makefile
-mail/steel/Makefile
-mail/test/mozmill/Makefile
-mail/themes/Makefile
-mail/themes/gnomestripe/Makefile
-mail/themes/pinstripe/Makefile
-mail/themes/qute/Makefile
-$MOZ_BRANDING_DIRECTORY/Makefile
-$MOZ_BRANDING_DIRECTORY/locales/Makefile
-"
-
-. "${srcdir}/chat/makefiles.sh"
-fi
new file mode 100644
--- /dev/null
+++ b/mail/moz.build
@@ -0,0 +1,25 @@
+# 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/.
+
+# app is always last as it packages up the built files on mac.
+DIRS += [
+    'base',
+    'locales',
+    'extensions',
+    'steel',
+    'themes',
+    'jquery',
+    'app',
+]
+
+# Add components for external linkage build
+if CONFIG['MOZ_INCOMPLETE_EXTERNAL_LINKAGE']:
+    DIRS += ['components']
+
+if CONFIG['OS_ARCH'] == 'WINNT':
+    DIRS += ['installer/windows']
+
+TEST_DIRS += ['test/mozmill']
+
new file mode 100644
--- /dev/null
+++ b/mail/steel/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/mail/test/mozmill/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/mail/themes/Makefile.in
+++ b/mail/themes/Makefile.in
@@ -4,34 +4,16 @@
 
 DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(topsrcdir)/config/config.mk
 
-#
-# Theme Selection
-#
-# Linux                   Gnomesripe
-# Windows                 Qute
-# MacOS X                 Pinstripe
-#
-
-ifneq (,$(filter gtk2 qt,$(MOZ_WIDGET_TOOLKIT)))
-DIRS += gnomestripe
-else
-ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
-DIRS += pinstripe
-else
-DIRS += qute
-endif
-endif
-
 include $(topsrcdir)/config/rules.mk
 
 CLASSIC_EXTENSION_DIR = {972ce4c6-7e08-4474-a285-3208198ce6fd}
 
 DEFINES += -DTHUNDERBIRD_VERSION=$(THUNDERBIRD_VERSION)
 
 libs::
 	$(NSINSTALL) -D $(DIST)/bin/extensions/$(CLASSIC_EXTENSION_DIR)
new file mode 100644
--- /dev/null
+++ b/mail/themes/gnomestripe/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/mail/themes/moz.build
@@ -0,0 +1,17 @@
+# 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/.
+
+# Theme Selection
+#
+# Linux                   Gnomesripe
+# Windows                 Qute
+# MacOS X                 Pinstripe
+if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('gtk2', 'qt'):
+    DIRS += ['gnomestripe']
+elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
+    DIRS += ['pinstripe']
+else:
+    DIRS += ['qute']
+
new file mode 100644
--- /dev/null
+++ b/mail/themes/pinstripe/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/mail/themes/qute/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/mailnews/Makefile.in
+++ b/mailnews/Makefile.in
@@ -7,45 +7,16 @@ DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE       = mailnews
 
-# If adding to these, consider if you need to add to XPCSHELL_TEST_DIRS below.
-PARALLEL_DIRS	+= \
-	addrbook \
-	base \
-	compose \
-	db/gloda \
-	db/msgdb \
-	extensions\
-	imap \
-	import \
-	local \
-	mime \
-	news \
-	$(NULL)
-
-ifdef ENABLE_TESTS
-PARALLEL_DIRS += \
-  test/performance/bloat \
-  $(NULL)
-endif
-
-ifeq ($(OS_ARCH),WINNT)
-ifndef GNU_CC
-PARALLEL_DIRS += mapi/mapiDLL mapi/mapihook
-endif
-endif
-
-DIRS += build
-
 PREF_JS_EXPORTS = $(srcdir)/mailnews.js
 
 DEFINES += -DOS_ARCH=$(OS_ARCH) \
            -DMOZ_WIDGET_TOOLKIT=$(MOZ_WIDGET_TOOLKIT) \
            -DNO_NSPR_10_SUPPORT \
            $(NULL)
 
 include $(topsrcdir)/config/rules.mk
--- a/mailnews/addrbook/Makefile.in
+++ b/mailnews/addrbook/Makefile.in
@@ -5,16 +5,10 @@
 
 DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
-PARALLEL_DIRS	= public src
-
-ifdef ENABLE_TESTS
-PARALLEL_DIRS += test
-endif
-
 include $(topsrcdir)/config/rules.mk
 
new file mode 100644
--- /dev/null
+++ b/mailnews/addrbook/moz.build
@@ -0,0 +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/.
+
+PARALLEL_DIRS += [
+    'public',
+    'src',
+]
+
+TEST_DIRS += ['test']
+
new file mode 100644
--- /dev/null
+++ b/mailnews/addrbook/public/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/mailnews/addrbook/src/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/mailnews/addrbook/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/mailnews/base/Makefile.in
+++ b/mailnews/base/Makefile.in
@@ -7,16 +7,10 @@ DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE		= msgbase
 
-PARALLEL_DIRS	= public src util ispdata search/public search/src
-
-ifdef ENABLE_TESTS
-TOOL_DIRS += test
-endif
-
 include $(topsrcdir)/config/rules.mk
 
new file mode 100644
--- /dev/null
+++ b/mailnews/base/ispdata/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/mailnews/base/moz.build
@@ -0,0 +1,16 @@
+# 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/.
+
+PARALLEL_DIRS += [
+    'public',
+    'src',
+    'util',
+    'ispdata',
+    'search/public',
+    'search/src',
+]
+
+TEST_TOOL_DIRS += ['test']
+
new file mode 100644
--- /dev/null
+++ b/mailnews/base/public/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/mailnews/base/search/public/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/mailnews/base/search/src/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/mailnews/base/src/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/mailnews/base/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/.
new file mode 100644
--- /dev/null
+++ b/mailnews/base/util/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/mailnews/build/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/mailnews/compose/Makefile.in
+++ b/mailnews/compose/Makefile.in
@@ -7,16 +7,10 @@ DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE		= msgcompose
 
-PARALLEL_DIRS	= public src
-
-ifdef ENABLE_TESTS
-PARALLEL_DIRS += test
-endif
-
 include $(topsrcdir)/config/rules.mk
 
new file mode 100644
--- /dev/null
+++ b/mailnews/compose/moz.build
@@ -0,0 +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/.
+
+PARALLEL_DIRS += [
+    'public',
+    'src',
+]
+
+TEST_DIRS += ['test']
+
new file mode 100644
--- /dev/null
+++ b/mailnews/compose/public/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/mailnews/compose/src/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/mailnews/compose/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/mailnews/db/Makefile.in
+++ b/mailnews/db/Makefile.in
@@ -5,12 +5,10 @@
 
 DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
-DIRS		= msgdb gloda
-
 include $(topsrcdir)/config/rules.mk
 
--- a/mailnews/db/gloda/Makefile.in
+++ b/mailnews/db/gloda/Makefile.in
@@ -5,16 +5,9 @@
 
 DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
-DIRS		= modules components
-#DIRS        = components
-
-ifdef ENABLE_TESTS
-DIRS += test
-endif
-
 include $(topsrcdir)/config/rules.mk
new file mode 100644
--- /dev/null
+++ b/mailnews/db/gloda/components/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/mailnews/db/gloda/modules/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/mailnews/db/gloda/moz.build
@@ -0,0 +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/.
+
+DIRS += [
+    'modules',
+    'components',
+]
+
+TEST_DIRS += ['test']
+
new file mode 100644
--- /dev/null
+++ b/mailnews/db/gloda/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/.
new file mode 100644
--- /dev/null
+++ b/mailnews/db/moz.build
@@ -0,0 +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/.
+
+DIRS += [
+    'msgdb',
+    'gloda',
+]
+
--- a/mailnews/db/msgdb/Makefile.in
+++ b/mailnews/db/msgdb/Makefile.in
@@ -7,15 +7,9 @@ DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE		= msgdb
 
-PARALLEL_DIRS	= public src
-
-ifdef ENABLE_TESTS
-PARALLEL_DIRS += test
-endif
-
 include $(topsrcdir)/config/rules.mk
new file mode 100644
--- /dev/null
+++ b/mailnews/db/msgdb/moz.build
@@ -0,0 +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/.
+
+PARALLEL_DIRS += [
+    'public',
+    'src',
+]
+
+TEST_DIRS += ['test']
+
new file mode 100644
--- /dev/null
+++ b/mailnews/db/msgdb/public/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/mailnews/db/msgdb/src/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/mailnews/db/msgdb/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/mailnews/extensions/Makefile.in
+++ b/mailnews/extensions/Makefile.in
@@ -5,21 +5,14 @@
 
 DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
-# these extensions are not optional
-PARALLEL_DIRS	= mdn mailviews bayesian-spam-filter offline-startup newsblog fts3
-
 ifdef MOZ_PSM
 BUILD_SMIME=1
 endif
 
-ifdef BUILD_SMIME
-PARALLEL_DIRS	+= smime
-endif
-
 include $(topsrcdir)/config/rules.mk
 
--- a/mailnews/extensions/bayesian-spam-filter/Makefile.in
+++ b/mailnews/extensions/bayesian-spam-filter/Makefile.in
@@ -7,15 +7,9 @@ topsrcdir	= @top_srcdir@
 
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE		= bayesflt
 
-PARALLEL_DIRS	= src
-
-ifdef ENABLE_TESTS
-PARALLEL_DIRS += test
-endif
-
 include $(topsrcdir)/config/rules.mk
new file mode 100644
--- /dev/null
+++ b/mailnews/extensions/bayesian-spam-filter/moz.build
@@ -0,0 +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/.
+
+PARALLEL_DIRS += ['src']
+TEST_DIRS += ['test']
+
new file mode 100644
--- /dev/null
+++ b/mailnews/extensions/bayesian-spam-filter/src/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/mailnews/extensions/bayesian-spam-filter/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/.
new file mode 100644
--- /dev/null
+++ b/mailnews/extensions/dsn/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/mailnews/extensions/fts3/Makefile.in
+++ b/mailnews/extensions/fts3/Makefile.in
@@ -8,11 +8,9 @@ topsrcdir	= @top_srcdir@
 
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE		= fts3tok
 
-PARALLEL_DIRS	= public src
-
 include $(topsrcdir)/config/rules.mk
new file mode 100644
--- /dev/null
+++ b/mailnews/extensions/fts3/moz.build
@@ -0,0 +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/.
+
+PARALLEL_DIRS += [
+    'public',
+    'src',
+]
+
new file mode 100644
--- /dev/null
+++ b/mailnews/extensions/fts3/public/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/mailnews/extensions/fts3/src/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/mailnews/extensions/mailviews/Makefile.in
+++ b/mailnews/extensions/mailviews/Makefile.in
@@ -7,11 +7,9 @@ DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE		= mailview
 
-PARALLEL_DIRS	= public src content
-
 include $(topsrcdir)/config/rules.mk
new file mode 100644
--- /dev/null
+++ b/mailnews/extensions/mailviews/content/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/mailnews/extensions/mailviews/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/.
+
+PARALLEL_DIRS += [
+    'public',
+    'src',
+    'content',
+]
+
new file mode 100644
--- /dev/null
+++ b/mailnews/extensions/mailviews/public/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/mailnews/extensions/mailviews/src/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/mailnews/extensions/mdn/Makefile.in
+++ b/mailnews/extensions/mdn/Makefile.in
@@ -7,22 +7,15 @@ DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE		= msgmdn
 
-DIRS		= src
-
-ifdef ENABLE_TESTS
-DIRS += test
-endif
-
-
 include $(topsrcdir)/config/rules.mk
 
 libs::
 	$(INSTALL) $(srcdir)/content/mdn.js $(DIST)/bin/defaults/pref
 
 install::
 	$(SYSINSTALL) $(IFLAGS1) $(srcdir)/content/mdn.js $(DESTDIR)$(mozappdir)/defaults/pref
new file mode 100644
--- /dev/null
+++ b/mailnews/extensions/mdn/moz.build
@@ -0,0 +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/.
+
+DIRS += ['src']
+TEST_DIRS += ['test']
+
new file mode 100644
--- /dev/null
+++ b/mailnews/extensions/mdn/src/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/mailnews/extensions/mdn/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/.
new file mode 100644
--- /dev/null
+++ b/mailnews/extensions/moz.build
@@ -0,0 +1,18 @@
+# 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/.
+
+# These extensions are not optional.
+PARALLEL_DIRS += [
+    'mdn',
+    'mailviews',
+    'bayesian-spam-filter',
+    'offline-startup',
+    'newsblog',
+    'fts3',
+]
+
+if CONFIG['BUILD_SMIME'] or CONFIG['MOZ_PSM']:
+    PARALLEL_DIRS += ['smime']
+
new file mode 100644
--- /dev/null
+++ b/mailnews/extensions/newsblog/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/mailnews/extensions/offline-startup/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/mailnews/extensions/smime/Makefile.in
+++ b/mailnews/extensions/smime/Makefile.in
@@ -7,19 +7,15 @@ DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE		= msgsmime
 
-PARALLEL_DIRS	= public src
-
-DIRS		= build
-
 include $(topsrcdir)/config/rules.mk
 
 libs::
 	$(INSTALL) $(srcdir)/content/smime.js $(DIST)/bin/defaults/pref
 
 install::
 	$(SYSINSTALL) $(IFLAGS1) $(srcdir)/content/smime.js $(DESTDIR)$(mozappdir)/defaults/pref
new file mode 100644
--- /dev/null
+++ b/mailnews/extensions/smime/build/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/mailnews/extensions/smime/moz.build
@@ -0,0 +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/.
+
+PARALLEL_DIRS += [
+    'public',
+    'src',
+]
+
+DIRS += ['build']
+
new file mode 100644
--- /dev/null
+++ b/mailnews/extensions/smime/public/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/mailnews/extensions/smime/src/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/mailnews/imap/Makefile.in
+++ b/mailnews/imap/Makefile.in
@@ -7,16 +7,10 @@ DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE		= msgimap
 
-PARALLEL_DIRS	= public src
-
-ifdef ENABLE_TESTS
-TOOL_DIRS += test
-endif
-
 include $(topsrcdir)/config/rules.mk
 
new file mode 100644
--- /dev/null
+++ b/mailnews/imap/moz.build
@@ -0,0 +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/.
+
+PARALLEL_DIRS += [
+    'public',
+    'src',
+]
+
+TEST_TOOL_DIRS += ['test']
+
new file mode 100644
--- /dev/null
+++ b/mailnews/imap/public/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/mailnews/imap/src/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/mailnews/imap/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/mailnews/import/Makefile.in
+++ b/mailnews/import/Makefile.in
@@ -7,28 +7,9 @@ DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE		= import
 
-PARALLEL_DIRS	= public src text/src vcard/src
-
-ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
-PARALLEL_DIRS	+= eudora/src applemail/src
-endif
-
-ifeq ($(OS_ARCH),WINNT)
-PARALLEL_DIRS	+= eudora/src
-ifndef GNU_CC
-PARALLEL_DIRS	+= oexpress outlook/src winlivemail
-endif
-endif
-
-ifdef ENABLE_TESTS
-TOOL_DIRS += test
-endif
-
-DIRS = build
-
 include $(topsrcdir)/config/rules.mk
new file mode 100644
--- /dev/null
+++ b/mailnews/import/applemail/src/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/mailnews/import/build/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/mailnews/import/eudora/src/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/mailnews/import/moz.build
@@ -0,0 +1,32 @@
+# 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/.
+
+PARALLEL_DIRS += [
+    'public',
+    'src',
+    'text/src',
+    'vcard/src',
+]
+
+if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
+    PARALLEL_DIRS += [
+        'eudora/src',
+        'applemail/src',
+    ]
+
+if CONFIG['OS_ARCH'] == 'WINNT':
+    PARALLEL_DIRS += ['eudora/src']
+
+    if not CONFIG['GNU_CC']:
+        PARALLEL_DIRS += [
+            'oexpress',
+            'outlook/src',
+            'winlivemail',
+        ]
+
+TEST_TOOL_DIRS += ['test']
+
+DIRS += ['build']
+
new file mode 100644
--- /dev/null
+++ b/mailnews/import/oexpress/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/mailnews/import/outlook/src/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/mailnews/import/public/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/mailnews/import/src/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/mailnews/import/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/.
new file mode 100644
--- /dev/null
+++ b/mailnews/import/text/src/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/mailnews/import/vcard/src/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/mailnews/import/winlivemail/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/mailnews/local/Makefile.in
+++ b/mailnews/local/Makefile.in
@@ -7,16 +7,10 @@ DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE		= msglocal
 
-PARALLEL_DIRS	= public src
-
-ifdef ENABLE_TESTS
-PARALLEL_DIRS += test
-endif
-
 include $(topsrcdir)/config/rules.mk
 
new file mode 100644
--- /dev/null
+++ b/mailnews/local/moz.build
@@ -0,0 +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/.
+
+PARALLEL_DIRS += [
+    'public',
+    'src',
+]
+
+TEST_DIRS += ['test']
+
new file mode 100644
--- /dev/null
+++ b/mailnews/local/public/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/mailnews/local/src/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/mailnews/local/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/.
deleted file mode 100644
--- a/mailnews/makefiles.sh
+++ /dev/null
@@ -1,93 +0,0 @@
-#! /bin/sh
-# 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/.
-
-add_makefiles "
-mailnews/Makefile
-mailnews/addrbook/Makefile
-mailnews/addrbook/public/Makefile
-mailnews/addrbook/src/Makefile
-mailnews/addrbook/test/Makefile
-mailnews/base/Makefile
-mailnews/base/ispdata/Makefile
-mailnews/base/public/Makefile
-mailnews/base/search/public/Makefile
-mailnews/base/search/src/Makefile
-mailnews/base/src/Makefile
-mailnews/base/test/Makefile
-mailnews/base/util/Makefile
-mailnews/build/Makefile
-mailnews/compose/Makefile
-mailnews/compose/public/Makefile
-mailnews/compose/src/Makefile
-mailnews/compose/test/Makefile
-mailnews/db/Makefile
-mailnews/db/gloda/Makefile
-mailnews/db/gloda/components/Makefile
-mailnews/db/gloda/modules/Makefile
-mailnews/db/gloda/test/Makefile
-mailnews/db/msgdb/Makefile
-mailnews/db/msgdb/public/Makefile
-mailnews/db/msgdb/src/Makefile
-mailnews/db/msgdb/test/Makefile
-mailnews/extensions/Makefile
-mailnews/extensions/bayesian-spam-filter/Makefile
-mailnews/extensions/bayesian-spam-filter/src/Makefile
-mailnews/extensions/bayesian-spam-filter/test/Makefile
-mailnews/extensions/fts3/Makefile
-mailnews/extensions/fts3/public/Makefile
-mailnews/extensions/fts3/src/Makefile
-mailnews/extensions/mailviews/Makefile
-mailnews/extensions/mailviews/public/Makefile
-mailnews/extensions/mailviews/content/Makefile
-mailnews/extensions/mailviews/src/Makefile
-mailnews/extensions/mdn/Makefile
-mailnews/extensions/mdn/src/Makefile
-mailnews/extensions/newsblog/Makefile
-mailnews/extensions/offline-startup/Makefile
-mailnews/extensions/smime/Makefile
-mailnews/extensions/smime/public/Makefile
-mailnews/extensions/smime/src/Makefile
-mailnews/imap/Makefile
-mailnews/imap/public/Makefile
-mailnews/imap/src/Makefile
-mailnews/imap/test/Makefile
-mailnews/import/Makefile
-mailnews/import/applemail/src/Makefile
-mailnews/import/build/Makefile
-mailnews/import/eudora/src/Makefile
-mailnews/import/oexpress/Makefile
-mailnews/import/outlook/src/Makefile
-mailnews/import/public/Makefile
-mailnews/import/src/Makefile
-mailnews/import/test/Makefile
-mailnews/import/text/src/Makefile
-mailnews/import/vcard/src/Makefile
-mailnews/import/winlivemail/Makefile
-mailnews/local/Makefile
-mailnews/local/public/Makefile
-mailnews/local/src/Makefile
-mailnews/local/test/Makefile
-mailnews/mapi/mapiDll/Makefile
-mailnews/mapi/mapihook/Makefile
-mailnews/mapi/mapihook/build/Makefile
-mailnews/mapi/mapihook/public/Makefile
-mailnews/mapi/mapihook/src/Makefile
-mailnews/mime/Makefile
-mailnews/mime/cthandlers/Makefile
-mailnews/mime/cthandlers/glue/Makefile
-mailnews/mime/cthandlers/smimestub/Makefile
-mailnews/mime/cthandlers/vcard/Makefile
-mailnews/mime/cthandlers/pgpmime/Makefile
-mailnews/mime/emitters/Makefile
-mailnews/mime/emitters/src/Makefile
-mailnews/mime/public/Makefile
-mailnews/mime/src/Makefile
-mailnews/mime/test/Makefile
-mailnews/news/Makefile
-mailnews/news/public/Makefile
-mailnews/news/src/Makefile
-mailnews/news/test/Makefile
-mailnews/test/performance/bloat/Makefile
-"
new file mode 100644
--- /dev/null
+++ b/mailnews/mapi/mapiDll/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/mailnews/mapi/mapihook/Makefile.in
+++ b/mailnews/mapi/mapihook/Makefile.in
@@ -5,11 +5,9 @@
 
 DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
-DIRS	= public build src
-
 include $(topsrcdir)/config/rules.mk
new file mode 100644
--- /dev/null
+++ b/mailnews/mapi/mapihook/build/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/mailnews/mapi/mapihook/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/.
+
+DIRS += [
+    'public',
+    'build',
+    'src',
+]
+
new file mode 100644
--- /dev/null
+++ b/mailnews/mapi/mapihook/public/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/mailnews/mapi/mapihook/src/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/mailnews/mime/Makefile.in
+++ b/mailnews/mime/Makefile.in
@@ -7,22 +7,16 @@ DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE		= mime
 
-PARALLEL_DIRS	= public src emitters cthandlers
-
-ifdef ENABLE_TESTS
-PARALLEL_DIRS += test
-endif
-
 # Install the MIME parser (recommended API) to mimeParser.jsm, but install all
 # of the other JS files to a mime subdirectory
 libs:: jsmime/mimeParser.jsm
 	$(call install_cmd,$(IFLAGS1) $^ $(FINAL_TARGET)/modules)
 
 JS_MODULES_PATH = $(FINAL_TARGET)/modules/mime
 
 EXTRA_JS_MODULES = \
--- a/mailnews/mime/cthandlers/Makefile.in
+++ b/mailnews/mime/cthandlers/Makefile.in
@@ -9,20 +9,10 @@ srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 ifdef MOZ_PSM
 BUILD_SMIME=1
 endif
 
-PARALLEL_DIRS += glue vcard
-
-# pgpmime depends on glue
-DIRS += pgpmime
-
-ifndef BUILD_SMIME
-# smimestub always depends on glue, so always build that afterwards
-DIRS += smimestub
-endif
-
 include $(topsrcdir)/config/rules.mk
 
new file mode 100644
--- /dev/null
+++ b/mailnews/mime/cthandlers/glue/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/mailnews/mime/cthandlers/moz.build
@@ -0,0 +1,17 @@
+# 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/.
+
+PARALLEL_DIRS += [
+    'glue',
+    'vcard',
+]
+
+# pgpmime depends on glue.
+DIRS += ['pgpmime']
+
+if not CONFIG['MOZ_PSM'] and not CONFIG['BUILD_SMIME']:
+    # smimestub always depends on glue, so always build that afterwards.
+    DIRS += ['smimestub']
+
new file mode 100644
--- /dev/null
+++ b/mailnews/mime/cthandlers/pgpmime/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/mailnews/mime/cthandlers/smimestub/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/mailnews/mime/cthandlers/vcard/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/mailnews/mime/emitters/Makefile.in
+++ b/mailnews/mime/emitters/Makefile.in
@@ -6,12 +6,11 @@
 DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE		= mimemitter
-DIRS		= src
 
 include $(topsrcdir)/config/rules.mk
 
new file mode 100644
--- /dev/null
+++ b/mailnews/mime/emitters/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/.
+
+DIRS += ['src']
+
new file mode 100644
--- /dev/null
+++ b/mailnews/mime/emitters/src/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/mailnews/mime/moz.build
@@ -0,0 +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/.
+
+PARALLEL_DIRS += [
+    'public',
+    'src',
+    'emitters',
+    'cthandlers',
+]
+
+TEST_DIRS += ['test']
+
new file mode 100644
--- /dev/null
+++ b/mailnews/mime/public/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/mailnews/mime/src/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/mailnews/mime/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/.
new file mode 100644
--- /dev/null
+++ b/mailnews/moz.build
@@ -0,0 +1,29 @@
+# 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/.
+
+PARALLEL_DIRS += [
+    'addrbook',
+    'base',
+    'compose',
+    'db/gloda',
+    'db/msgdb',
+    'extensions',
+    'imap',
+    'import',
+    'local',
+    'mime',
+    'news',
+]
+
+TEST_DIRS += ['test/performance/bloat']
+
+if CONFIG['OS_ARCH'] == 'WINNT' and not CONFIG['GNU_CC']:
+    PARALLEL_DIRS += [
+        'mapi/mapiDLL',
+        'mapi/mapihook',
+    ]
+
+DIRS += ['build']
+
--- a/mailnews/news/Makefile.in
+++ b/mailnews/news/Makefile.in
@@ -5,16 +5,10 @@
 
 DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
-PARALLEL_DIRS	= public src
-
-ifdef ENABLE_TESTS
-PARALLEL_DIRS += test
-endif
-
 include $(topsrcdir)/config/rules.mk
 
new file mode 100644
--- /dev/null
+++ b/mailnews/news/moz.build
@@ -0,0 +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/.
+
+PARALLEL_DIRS += [
+    'public',
+    'src',
+]
+
+TEST_DIRS += ['test']
+
new file mode 100644
--- /dev/null
+++ b/mailnews/news/public/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/mailnews/news/src/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/mailnews/news/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/.
new file mode 100644
--- /dev/null
+++ b/mailnews/test/performance/bloat/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/moz.build
@@ -0,0 +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/.
+
+if CONFIG['COMPILE_ENVIRONMENT']:
+    include('/' + CONFIG['MOZ_BUILD_APP'] + '/app.mozbuild')
+
--- a/other-licenses/branding/sunbird/Makefile.in
+++ b/other-licenses/branding/sunbird/Makefile.in
@@ -38,20 +38,16 @@
 
 DEPTH = @DEPTH@
 topsrcdir = @top_srcdir@
 srcdir = @srcdir@
 VPATH = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
-DIRS = \
-	locales \
-	$(NULL)
-
 include $(topsrcdir)/config/rules.mk
 
 export::
 	$(NSINSTALL) -D $(DIST)/branding
 ifeq ($(OS_ARCH),WINNT)
 	cp $(srcdir)/sunbird.ico        $(DIST)/branding/sunbird.ico
 	cp $(srcdir)/sunbird.ico        $(DIST)/branding/app.ico
 	cp $(srcdir)/branding.nsi       $(DIST)/branding/branding.nsi
new file mode 100644
--- /dev/null
+++ b/other-licenses/branding/sunbird/locales/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/other-licenses/branding/sunbird/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/.
+
+DIRS += ['locales']
+
--- a/other-licenses/branding/thunderbird/Makefile.in
+++ b/other-licenses/branding/thunderbird/Makefile.in
@@ -5,20 +5,16 @@
 
 DEPTH = @DEPTH@
 topsrcdir = @top_srcdir@
 srcdir = @srcdir@
 VPATH = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
-DIRS = \
-	locales \
-	$(NULL)
-
 PREF_JS_EXPORTS = $(srcdir)/thunderbird-branding.js
 
 include $(topsrcdir)/config/rules.mk
 
 export::
 	$(NSINSTALL) -D $(DIST)/branding
 # Export items into the branding directory first
 ifeq ($(OS_ARCH),WINNT)
new file mode 100644
--- /dev/null
+++ b/other-licenses/branding/thunderbird/locales/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/other-licenses/branding/thunderbird/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/.
+
+DIRS += ['locales']
+
--- a/suite/Makefile.in
+++ b/suite/Makefile.in
@@ -5,47 +5,16 @@
 
 DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
-# Check whether this build is an alpha or nightly:
-# replace "pre" with "a" in the version then look if "a" matches.
-# This should match /suite/installer/Makefile.in.
-ifneq (,$(findstring a,$(MOZ_APP_VERSION:pre=a)))
-PARALLEL_DIRS = debugQA
-endif
-
-PARALLEL_DIRS	+= \
-		browser \
-		common \
-		feeds/public \
-		feeds/src \
-		locales \
-		mailnews \
-		modules \
-		themes/classic \
-		themes/modern \
-		profile \
-		security \
-		shell/public \
-		shell/src \
-		smile \
-		$(NULL)
-
-ifeq ($(OS_ARCH),WINNT)
-PARALLEL_DIRS += installer/windows
-endif
-
-# app is always last as it packages up the built files on mac
-DIRS = build app
-
 include $(topsrcdir)/config/rules.mk
 
 ifeq ($(OS_ARCH),WINNT)
 # 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
new file mode 100644
--- /dev/null
+++ b/suite/app.mozbuild
@@ -0,0 +1,35 @@
+# 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/.
+
+app_libxul_dirs = []
+app_libxul_static_dirs = []
+
+# /mozilla build system.
+if not CONFIG['COMM_BUILD']:
+    if CONFIG['MOZ_APP_COMPONENT_LIBS']:
+        bridge_reldir = '../'
+        include('../bridge/bridge.mozbuild')
+
+    if not CONFIG['LIBXUL_SDK']:
+        include('/toolkit/toolkit.mozbuild')
+
+    if CONFIG['MOZ_EXTENSIONS']:
+        add_tier_dir('app', 'toolkit/extensions')
+
+# Our build system.
+else:
+    bridge_reldir = ''
+    include('/bridge/bridge.mozbuild')
+
+    if CONFIG['MOZ_COMPOSER']:
+        add_tier_dir('app', 'editor/ui')
+
+    add_tier_dir('app', CONFIG['MOZ_BRANDING_DIRECTORY'])
+
+    if CONFIG['MOZ_CALENDAR']:
+        add_tier_dir('app', 'calendar/lightning')
+
+    add_tier_dir('app', 'suite')
+
new file mode 100644
--- /dev/null
+++ b/suite/app/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/branding/nightly/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/browser/Makefile.in
+++ b/suite/browser/Makefile.in
@@ -5,20 +5,16 @@
 
 DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
-ifdef ENABLE_TESTS
-PARALLEL_DIRS += test
-endif
-
 EXTRA_COMPONENTS = \
 	SuiteBrowser.manifest \
 	nsBrowserContentHandler.js \
 	nsTypeAheadFind.js \
 	$(NULL)
 
 PREF_JS_EXPORTS = \
 	$(srcdir)/browser-prefs.js \
new file mode 100644
--- /dev/null
+++ b/suite/browser/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/.
+
+TEST_DIRS += ['test']
+
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.mk
+++ b/suite/build.mk
@@ -1,58 +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/.
 
-ifndef COMM_BUILD # Mozilla Makefile
-
-ifdef MOZ_APP_COMPONENT_LIBS
-SUBDIR=/..
-include $(topsrcdir)/../bridge/bridge.mk
-endif
-
-ifndef LIBXUL_SDK
-include $(topsrcdir)/toolkit/toolkit-tiers.mk
-endif
-
-TIERS += app
-
-ifdef MOZ_EXTENSIONS
-tier_app_dirs += extensions
-endif
-
-else # toplevel Makefile
-
-TIERS += app
-
-include $(topsrcdir)/bridge/bridge.mk
-ifdef MOZ_INCOMPLETE_EXTERNAL_LINKAGE
-tier_app_staticdirs += $(APP_LIBXUL_STATICDIRS:./%=%)
-tier_app_dirs += $(APP_LIBXUL_DIRS:./%=%)
-else
+ifdef COMM_BUILD # Mozilla Makefile
+ifndef MOZ_INCOMPLETE_EXTERNAL_LINKAGE
 # workaround Bug 599809 by making these makefiles be generated here
 SUBMAKEFILES += $(addsuffix /Makefile, $(APP_LIBXUL_DIRS) $(APP_LIBXUL_STATICDIRS))
 endif
-
-ifdef MOZ_COMPOSER
-tier_app_dirs += editor/ui
 endif
 
-tier_app_dirs += $(MOZ_BRANDING_DIRECTORY)
-
-ifdef MOZ_CALENDAR
-tier_app_dirs += calendar/lightning
-endif
-
-tier_app_dirs += \
-	suite \
-	$(NULL)
-
-endif # COMM_BUILD
-
 installer:
 	@$(MAKE) -C suite/installer installer
 
 package:
 	@$(MAKE) -C suite/installer
 
 package-compare:
 	@$(MAKE) -C suite/installer package-compare
new file mode 100644
--- /dev/null
+++ b/suite/build/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/Makefile.in
+++ b/suite/common/Makefile.in
@@ -4,22 +4,16 @@
 
 DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
-PARALLEL_DIRS = public src
-
-ifdef ENABLE_TESTS
-PARALLEL_DIRS += tests dataman/tests downloads/tests places/tests
-endif
-
 include $(topsrcdir)/config/rules.mk
 
 abs_srcdir = $(call core_abspath,$(srcdir))
 
 CHROME_DEPS += $(abs_srcdir)/app-license.html
 
 # DEFINES for preprocessing
 # Use suite/common/app-license.html as input when generating 
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/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/moz.build
@@ -0,0 +1,16 @@
+# 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/.
+
+PARALLEL_DIRS += [
+    'public',
+    'src',
+]
+
+TEST_DIRS += [
+    'tests',
+    'dataman/tests',
+    'downloads/tests',
+    'places/tests',
+]
new file mode 100644
--- /dev/null
+++ b/suite/common/places/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/public/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/src/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/tests/Makefile.in
+++ b/suite/common/tests/Makefile.in
@@ -7,13 +7,9 @@ DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE		= test_suite_common
 
-ifdef ENABLE_TESTS
-PARALLEL_DIRS = browser chrome preferences
-endif
-
 include $(topsrcdir)/config/rules.mk
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/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/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
@@ -14,16 +14,14 @@ include $(DEPTH)/config/autoconf.mk
 MODULE                 = debugQA
 XPI_NAME               = debugQA
 USE_EXTENSION_MANIFEST = 1
 INSTALL_EXTENSION_ID   = debugQA@mozilla.org
 XPI_PKGNAME            = debugQA-$(MOZ_APP_VERSION)
 
 DIST_FILES = install.rdf
 
-DIRS = locales
-
 XULAPP_DEFINES = \
     -DMOZ_APP_VERSION=$(MOZ_APP_VERSION) \
     -DMOZ_APP_MAXVERSION=$(MOZ_APP_MAXVERSION) \
     $(NULL)
 
 include $(topsrcdir)/config/rules.mk
new file mode 100644
--- /dev/null
+++ b/suite/debugQA/locales/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/debugQA/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/.
+
+DIRS += ['locales']
+
new file mode 100644
--- /dev/null
+++ b/suite/feeds/public/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/feeds/src/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/installer/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/installer/windows/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/locales/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/mailnews/Makefile.in
+++ b/suite/mailnews/Makefile.in
@@ -5,11 +5,9 @@
 
 DEPTH=@DEPTH@
 topsrcdir=@top_srcdir@
 srcdir=@srcdir@
 VPATH=@srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
-DIRS = modules
-
 include $(topsrcdir)/config/rules.mk
new file mode 100644
--- /dev/null
+++ b/suite/mailnews/modules/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/mailnews/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/.
+
+DIRS += ['modules']
+
deleted file mode 100755
--- a/suite/makefiles.sh
+++ /dev/null
@@ -1,47 +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/.
-
-if [ "$COMM_BUILD" ]; then
-add_makefiles "
-  suite/Makefile
-  suite/app/Makefile
-  suite/browser/Makefile
-  suite/browser/test/Makefile
-  suite/build/Makefile
-  suite/common/Makefile
-  suite/common/dataman/tests/Makefile
-  suite/common/downloads/tests/Makefile
-  suite/common/places/tests/Makefile
-  suite/common/public/Makefile
-  suite/common/src/Makefile
-  suite/common/tests/Makefile
-  suite/common/tests/browser/Makefile
-  suite/common/tests/chrome/Makefile
-  suite/common/tests/preferences/Makefile
-  suite/debugQA/Makefile
-  suite/debugQA/locales/Makefile
-  suite/feeds/public/Makefile
-  suite/feeds/src/Makefile
-  suite/installer/Makefile
-  suite/installer/windows/Makefile
-  suite/locales/Makefile
-  suite/mailnews/Makefile
-  suite/mailnews/modules/Makefile
-  suite/modules/Makefile
-  suite/modules/test/Makefile
-  suite/profile/Makefile
-  suite/profile/migration/public/Makefile
-  suite/profile/migration/src/Makefile
-  suite/security/Makefile
-  suite/shell/public/Makefile
-  suite/shell/src/Makefile
-  suite/smile/Makefile
-  suite/smile/public/Makefile
-  suite/smile/src/Makefile
-  suite/smile/test/Makefile
-  suite/themes/modern/Makefile
-  suite/themes/classic/Makefile
-  $MOZ_BRANDING_DIRECTORY/Makefile
-"
-fi
--- a/suite/modules/Makefile.in
+++ b/suite/modules/Makefile.in
@@ -4,20 +4,16 @@
 
 DEPTH     = @DEPTH@
 VPATH     = @srcdir@
 topsrcdir = @top_srcdir@
 srcdir    = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
-ifdef ENABLE_TESTS
-DIRS += test
-endif
-
 EXTRA_JS_MODULES = \
   DownloadTaskbarIntegration.jsm \
   Sanitizer.jsm \
   $(NULL)
 
 ifeq ($(OS_ARCH),WINNT)
 EXTRA_JS_MODULES += \
   WindowsJumpLists.jsm \
new file mode 100644
--- /dev/null
+++ b/suite/modules/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/.
+
+TEST_DIRS += ['test']
+
new file mode 100644
--- /dev/null
+++ b/suite/modules/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/.
new file mode 100644
--- /dev/null
+++ b/suite/moz.build
@@ -0,0 +1,35 @@
+# 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/.
+
+# This should match /suite/installer/moz.build.
+if 'pre' in CONFIG['MOZ_APP_VERSION'] or 'a' in CONFIG['MOZ_APP_VERSION']:
+    PARALLEL_DIRS += ['debugQA']
+
+PARALLEL_DIRS += [
+    'browser',
+    'common',
+    'feeds/public',
+    'feeds/src',
+    'locales',
+    'mailnews',
+    'modules',
+    'themes/classic',
+    'themes/modern',
+    'profile',
+    'security',
+    'shell/public',
+    'shell/src',
+    'smile',
+]
+
+if CONFIG['OS_ARCH'] == 'WINNT':
+    PARALLEL_DIRS += ['installer/windows']
+
+# app is always last as it packages up the built files on mac.
+DIRS += [
+    'build',
+    'app',
+]
+
--- a/suite/profile/Makefile.in
+++ b/suite/profile/Makefile.in
@@ -4,18 +4,16 @@
 
 DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
-PARALLEL_DIRS	= migration/public migration/src
-
 MODULE		= suiteprofile
 LIBRARY_NAME	= suiteprofile_s
 
 
 CPPSRCS 	= \
 		nsSuiteDirectoryProvider.cpp \
 		$(NULL)
 
new file mode 100644
--- /dev/null
+++ b/suite/profile/migration/public/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/profile/migration/src/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/profile/moz.build
@@ -0,0 +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/.
+
+PARALLEL_DIRS += [
+    'migration/public',
+    'migration/src',
+]
+
new file mode 100644
--- /dev/null
+++ b/suite/security/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/shell/public/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/shell/src/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/smile/Makefile.in
+++ b/suite/smile/Makefile.in
@@ -4,15 +4,9 @@
 
 DEPTH     = @DEPTH@
 topsrcdir = @top_srcdir@
 srcdir    = @srcdir@
 VPATH     = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
-PARALLEL_DIRS = public src
-
-ifdef ENABLE_TESTS
-PARALLEL_DIRS += test
-endif
-
 include $(topsrcdir)/config/rules.mk
new file mode 100644
--- /dev/null
+++ b/suite/smile/moz.build
@@ -0,0 +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/.
+
+PARALLEL_DIRS += [
+    'public',
+    'src',
+]
+
+TEST_DIRS += ['test']
+
new file mode 100644
--- /dev/null
+++ b/suite/smile/public/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/smile/src/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/smile/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/.
new file mode 100644
--- /dev/null
+++ b/suite/themes/classic/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/themes/modern/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/.