Bug 1036894 part 1 - Move MAKE_FRAMEWORK, SDK_LIBRARY, SHARED_LIBRARY_NAME and STATIC_LIBRARY_NAME to moz.build. r=gps
authorMike Hommey <mh+mozilla@glandium.org>
Wed, 23 Jul 2014 13:29:09 +0900
changeset 195636 9565dc1c02c6a4917f1d8f68ba42654f4ee588c9
parent 195635 9f4d4f62db1c1c73ee9547889c95c26de89127b0
child 195637 c437b933954627c0ff9da52532b00ffee6dfcb2f
push id27188
push usercbook@mozilla.com
push dateWed, 23 Jul 2014 13:53:43 +0000
treeherdermozilla-central@785acfd2ae48 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgps
bugs1036894
milestone34.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1036894 part 1 - Move MAKE_FRAMEWORK, SDK_LIBRARY, SHARED_LIBRARY_NAME and STATIC_LIBRARY_NAME to moz.build. r=gps At the same time, make the Library data more useful in the build frontend.
browser/components/build/moz.build
build/stlport/Makefile.in
config/config.mk
config/rules.mk
intl/unicharutil/util/Makefile.in
intl/unicharutil/util/moz.build
js/src/Makefile.in
js/src/moz.build
js/xpconnect/tests/components/native/moz.build
memory/build/Makefile.in
memory/build/moz.build
memory/jemalloc/Makefile.in
memory/jemalloc/moz.build
memory/mozalloc/Makefile.in
memory/mozalloc/moz.build
mozglue/build/Makefile.in
mozglue/build/moz.build
python/mozbuild/mozbuild/backend/configenvironment.py
python/mozbuild/mozbuild/backend/recursivemake.py
python/mozbuild/mozbuild/backend/visualstudio.py
python/mozbuild/mozbuild/frontend/data.py
python/mozbuild/mozbuild/frontend/emitter.py
python/mozbuild/mozbuild/frontend/sandbox_symbols.py
python/mozbuild/mozbuild/test/backend/data/variable_passthru/moz.build
python/mozbuild/mozbuild/test/backend/test_recursivemake.py
python/mozbuild/mozbuild/test/frontend/data/variable-passthru/moz.build
python/mozbuild/mozbuild/test/frontend/test_emitter.py
python/mozbuild/mozbuild/util.py
security/build/Makefile.in
security/build/moz.build
toolkit/library/build/Makefile.in
toolkit/library/build/moz.build
toolkit/library/libxul.mk
toolkit/library/libxul.mozbuild
toolkit/system/dbus/moz.build
toolkit/system/gnome/moz.build
xpcom/glue/moz.build
xpcom/glue/nomozalloc/moz.build
xpcom/glue/standalone/moz.build
xpcom/glue/standalone/staticruntime/moz.build
xpcom/glue/staticruntime/moz.build
xpcom/tests/bug656331_component/moz.build
xpcom/tests/component/moz.build
xpcom/tests/component_no_aslr/moz.build
--- a/browser/components/build/moz.build
+++ b/browser/components/build/moz.build
@@ -11,17 +11,15 @@ EXPORTS += [
 SOURCES += [
     'nsModule.cpp',
 ]
 
 LIBRARY_NAME = 'browsercomps'
 
 IS_COMPONENT = True
 
-FORCE_SHARED_LIB = True
-
 LOCAL_INCLUDES += [
     '../about',
     '../dirprovider',
     '../feeds/src',
     '../migration/src',
     '../shell/src',
 ]
--- a/build/stlport/Makefile.in
+++ b/build/stlport/Makefile.in
@@ -1,13 +1,13 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this file,
 # You can obtain one at http://mozilla.org/MPL/2.0/.
 
 MODULES = stlport
 
 # Force to build a static library, instead of a fake library, without
 # installing it in dist/lib.
-LIBRARY = $(LIB_PREFIX)$(LIBRARY_NAME).$(LIB_SUFFIX)
+NO_EXPAND_LIBS = 1
 
 include $(topsrcdir)/config/rules.mk
 
 CXXFLAGS += -fuse-cxa-atexit
--- a/config/config.mk
+++ b/config/config.mk
@@ -51,25 +51,29 @@ endif
   HOST_PROGRAM \
   HOST_SIMPLE_PROGRAMS \
   IS_COMPONENT \
   JAR_MANIFEST \
   JAVA_JAR_TARGETS \
   JS_MODULES_PATH \
   LD_VERSION_SCRIPT \
   LIBRARY_NAME \
+  MAKE_FRAMEWORK \
   MODULE \
   MSVC_ENABLE_PGO \
   NO_DIST_INSTALL \
   PARALLEL_DIRS \
   PROGRAM \
   RESOURCE_FILES \
   SDK_HEADERS \
+  SDK_LIBRARY \
+  SHARED_LIBRARY_NAME \
   SIMPLE_PROGRAMS \
   SONAME \
+  STATIC_LIBRARY_NAME \
   TEST_DIRS \
   TIERS \
   TOOL_DIRS \
   XPCSHELL_TESTS \
   XPIDL_MODULE \
   $(NULL)
 
 _DEPRECATED_VARIABLES := \
@@ -330,42 +334,16 @@ endif
 ifneq (,$(filter xul xul-%,$(FINAL_LIBRARY) $(LIBRARY_NAME)))
   LIBXUL_LIBRARY := 1
 endif
 
 ifdef LIBXUL_LIBRARY
 ifdef IS_COMPONENT
 $(error IS_COMPONENT is set, but is not compatible with LIBXUL_LIBRARY)
 endif
-ifeq (,$(filter xul xul-%,$(LIBRARY_NAME)))
-FORCE_STATIC_LIB=1
-endif
-endif
-
-# If we are building this component into an extension/xulapp, it cannot be
-# statically linked. In the future we may want to add a xulapp meta-component
-# build option.
-
-ifdef XPI_NAME
-ifdef IS_COMPONENT
-FORCE_STATIC_LIB=
-FORCE_SHARED_LIB=1
-endif
-endif
-
-ifndef SHARED_LIBRARY_NAME
-ifdef LIBRARY_NAME
-SHARED_LIBRARY_NAME=$(LIBRARY_NAME)
-endif
-endif
-
-ifndef STATIC_LIBRARY_NAME
-ifdef LIBRARY_NAME
-STATIC_LIBRARY_NAME=$(LIBRARY_NAME)
-endif
 endif
 
 # PGO on MSVC is opt-in
 ifdef _MSC_VER
 ifndef MSVC_ENABLE_PGO
 NO_PROFILE_GUIDED_OPTIMIZE = 1
 endif
 endif
--- a/config/rules.mk
+++ b/config/rules.mk
@@ -132,79 +132,46 @@ endif # ENABLE_TESTS
 #
 # Library rules
 #
 # If FORCE_STATIC_LIB is set, build a static library.
 # Otherwise, build a shared library.
 #
 
 ifndef LIBRARY
-ifdef STATIC_LIBRARY_NAME
-REAL_LIBRARY		:= $(LIB_PREFIX)$(STATIC_LIBRARY_NAME).$(LIB_SUFFIX)
+ifdef REAL_LIBRARY
 # Only build actual library if it is installed in DIST/lib or SDK
 ifeq (,$(SDK_LIBRARY)$(DIST_INSTALL)$(NO_EXPAND_LIBS))
 LIBRARY			:= $(REAL_LIBRARY).$(LIBS_DESC_SUFFIX)
 else
 LIBRARY			:= $(REAL_LIBRARY) $(REAL_LIBRARY).$(LIBS_DESC_SUFFIX)
 endif
-endif # STATIC_LIBRARY_NAME
+endif # REAL_LIBRARY
 endif # LIBRARY
 
 ifndef HOST_LIBRARY
 ifdef HOST_LIBRARY_NAME
 HOST_LIBRARY		:= $(LIB_PREFIX)$(HOST_LIBRARY_NAME).$(LIB_SUFFIX)
 endif
 endif
 
 ifdef LIBRARY
 ifdef FORCE_SHARED_LIB
 ifdef MKSHLIB
 
 ifdef LIB_IS_C_ONLY
 MKSHLIB			= $(MKCSHLIB)
 endif
 
-ifneq (,$(filter WINNT,$(OS_ARCH)))
-IMPORT_LIBRARY		:= $(LIB_PREFIX)$(SHARED_LIBRARY_NAME).$(IMPORT_LIB_SUFFIX)
-endif
-
-ifdef MAKE_FRAMEWORK
-SHARED_LIBRARY		:= $(SHARED_LIBRARY_NAME)
-else
-SHARED_LIBRARY		:= $(DLL_PREFIX)$(SHARED_LIBRARY_NAME)$(DLL_SUFFIX)
-endif
-
 EMBED_MANIFEST_AT=2
 
 endif # MKSHLIB
 endif # FORCE_SHARED_LIB
 endif # LIBRARY
 
-ifdef MKSHLIB
-ifdef SONAME
-DSO_SONAME			= $(DLL_PREFIX)$(SONAME)$(DLL_SUFFIX)
-else
-DSO_SONAME			= $(notdir $@)
-endif
-endif # MKSHLIB
-
-ifdef FORCE_STATIC_LIB
-ifndef FORCE_SHARED_LIB
-SHARED_LIBRARY		:= $(NULL)
-DEF_FILE		:= $(NULL)
-IMPORT_LIBRARY		:= $(NULL)
-endif
-endif
-
-ifdef FORCE_SHARED_LIB
-ifndef FORCE_STATIC_LIB
-LIBRARY := $(NULL)
-endif
-endif
-
 ifeq ($(OS_ARCH),WINNT)
 ifndef GNU_CC
 
 #
 # Unless we're building SIMPLE_PROGRAMS, all C++ files share a PDB file per
 # directory. For parallel builds, this PDB file is shared and locked by
 # MSPDBSRV.EXE, starting with MSVC8 SP1. If you're using MSVC 7.1 or MSVC8
 # without SP1, don't do parallel builds.
@@ -301,17 +268,17 @@ HOST_SIMPLE_PROGRAMS :=
 SDK_BINARY := $(filter %.py,$(SDK_BINARY))
 SDK_LIBRARY :=
 endif
 
 ALL_TRASH = \
 	$(GARBAGE) $(TARGETS) $(OBJS) $(PROGOBJS) LOGS TAGS a.out \
 	$(filter-out $(ASFILES),$(OBJS:.$(OBJ_SUFFIX)=.s)) $(OBJS:.$(OBJ_SUFFIX)=.ii) \
 	$(OBJS:.$(OBJ_SUFFIX)=.i) $(OBJS:.$(OBJ_SUFFIX)=.i_o) \
-	$(HOST_PROGOBJS) $(HOST_OBJS) $(IMPORT_LIBRARY) $(DEF_FILE)\
+	$(HOST_PROGOBJS) $(HOST_OBJS) $(IMPORT_LIBRARY) \
 	$(EXE_DEF_FILE) so_locations _gen _stubs $(wildcard *.res) $(wildcard *.RES) \
 	$(wildcard *.pdb) $(CODFILE) $(IMPORT_LIBRARY) \
 	$(SHARED_LIBRARY:$(DLL_SUFFIX)=.exp) $(wildcard *.ilk) \
 	$(PROGRAM:$(BIN_SUFFIX)=.exp) $(SIMPLE_PROGRAMS:$(BIN_SUFFIX)=.exp) \
 	$(PROGRAM:$(BIN_SUFFIX)=.lib) $(SIMPLE_PROGRAMS:$(BIN_SUFFIX)=.lib) \
 	$(SIMPLE_PROGRAMS:$(BIN_SUFFIX)=.$(OBJ_SUFFIX)) \
 	$(wildcard gts_tmp_*) $(LIBRARY:%.a=.%.timestamp)
 ALL_TRASH_DIRS = \
@@ -648,17 +615,17 @@ endif
 ifneq (,$(SHARED_LIBRARY)$(PROGRAM))
 export::
 ifdef PROGRAM
 	$(PYTHON) $(topsrcdir)/build/win32/pgomerge.py \
 	  $(PROGRAM:$(BIN_SUFFIX)=) $(DIST)/bin
 endif
 ifdef SHARED_LIBRARY
 	$(PYTHON) $(topsrcdir)/build/win32/pgomerge.py \
-	  $(SHARED_LIBRARY_NAME) $(DIST)/bin
+	  $(patsubst $(DLL_PREFIX)%$(DLL_SUFFIX),%,$(SHARED_LIBRARY)) $(DIST)/bin
 endif
 endif # SHARED_LIBRARY || PROGRAM
 endif # WINNT_
 endif # MOZ_PROFILE_USE
 ifdef MOZ_PROFILE_GENERATE
 # Clean up profiling data during PROFILE_GENERATE phase
 export::
 ifeq ($(OS_ARCH)_$(GNU_CC), WINNT_)
@@ -863,29 +830,29 @@ endif
 endif
 endif
 
 # On Darwin (Mac OS X), dwarf2 debugging uses debug info left in .o files,
 # so instead of deleting .o files after repacking them into a dylib, we make
 # symlinks back to the originals. The symlinks are a no-op for stabs debugging,
 # so no need to conditionalize on OS version or debugging format.
 
-$(SHARED_LIBRARY): $(OBJS) $(DEF_FILE) $(RESFILE) $(LIBRARY) $(EXTRA_DEPS) $(GLOBAL_DEPS)
+$(SHARED_LIBRARY): $(OBJS) $(RESFILE) $(LIBRARY) $(EXTRA_DEPS) $(GLOBAL_DEPS)
 	$(REPORT_BUILD)
 ifndef INCREMENTAL_LINKER
 	$(RM) $@
 endif
 ifdef DTRACE_LIB_DEPENDENT
 ifndef XP_MACOSX
 	dtrace -G -C -s $(MOZILLA_DTRACE_SRC) -o  $(DTRACE_PROBE_OBJ) $(shell $(EXPAND_LIBS) $(MOZILLA_PROBE_LIBS))
 endif
-	$(EXPAND_MKSHLIB) $(SHLIB_LDSTARTFILE) $(OBJS) $(SUB_SHLOBJS) $(DTRACE_PROBE_OBJ) $(MOZILLA_PROBE_LIBS) $(RESFILE) $(LDFLAGS) $(WRAP_LDFLAGS) $(SHARED_LIBRARY_LIBS) $(EXTRA_DSO_LDOPTS) $(MOZ_GLUE_LDFLAGS) $(OS_LIBS) $(EXTRA_LIBS) $(DEF_FILE) $(SHLIB_LDENDFILE) $(if $(LIB_IS_C_ONLY),,$(STLPORT_LIBS))
+	$(EXPAND_MKSHLIB) $(SHLIB_LDSTARTFILE) $(OBJS) $(SUB_SHLOBJS) $(DTRACE_PROBE_OBJ) $(MOZILLA_PROBE_LIBS) $(RESFILE) $(LDFLAGS) $(WRAP_LDFLAGS) $(SHARED_LIBRARY_LIBS) $(EXTRA_DSO_LDOPTS) $(MOZ_GLUE_LDFLAGS) $(OS_LIBS) $(EXTRA_LIBS) $(SHLIB_LDENDFILE) $(if $(LIB_IS_C_ONLY),,$(STLPORT_LIBS))
 	@$(RM) $(DTRACE_PROBE_OBJ)
 else # ! DTRACE_LIB_DEPENDENT
-	$(EXPAND_MKSHLIB) $(SHLIB_LDSTARTFILE) $(OBJS) $(SUB_SHLOBJS) $(RESFILE) $(LDFLAGS) $(WRAP_LDFLAGS) $(SHARED_LIBRARY_LIBS) $(EXTRA_DSO_LDOPTS) $(MOZ_GLUE_LDFLAGS) $(OS_LIBS) $(EXTRA_LIBS) $(DEF_FILE) $(SHLIB_LDENDFILE) $(if $(LIB_IS_C_ONLY),,$(STLPORT_LIBS))
+	$(EXPAND_MKSHLIB) $(SHLIB_LDSTARTFILE) $(OBJS) $(SUB_SHLOBJS) $(RESFILE) $(LDFLAGS) $(WRAP_LDFLAGS) $(SHARED_LIBRARY_LIBS) $(EXTRA_DSO_LDOPTS) $(MOZ_GLUE_LDFLAGS) $(OS_LIBS) $(EXTRA_LIBS) $(SHLIB_LDENDFILE) $(if $(LIB_IS_C_ONLY),,$(STLPORT_LIBS))
 endif # DTRACE_LIB_DEPENDENT
 	$(call CHECK_BINARY,$@)
 
 ifeq (_WINNT,$(GNU_CC)_$(OS_ARCH))
 ifdef MSMANIFEST_TOOL
 ifdef EMBED_MANIFEST_AT
 	@if test -f $@.manifest; then \
 		mt.exe -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;$(EMBED_MANIFEST_AT); \
--- a/intl/unicharutil/util/Makefile.in
+++ b/intl/unicharutil/util/Makefile.in
@@ -3,15 +3,14 @@
 # License, v. 2.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 makefile builds the unicharutil_external_s library which should be used
 # by frozen (dependent) linkage components. Internal-linkage code should use
 # unicharutil_s which is built in the internal/ subdirectory.
 
 DIST_INSTALL = 1
-SDK_LIBRARY = $(LIBRARY)
 
 include $(topsrcdir)/config/rules.mk
 
 ifdef ENABLE_INTL_API
 LOCAL_INCLUDES += $(MOZ_ICU_CFLAGS)
 endif
--- a/intl/unicharutil/util/moz.build
+++ b/intl/unicharutil/util/moz.build
@@ -20,16 +20,18 @@ EXPORTS += [
 include('objs.mozbuild')
 
 UNIFIED_SOURCES += intl_unicharutil_util_cppsrcs
 
 LIBRARY_NAME = 'unicharutil_external_s'
 
 FORCE_STATIC_LIB = True
 
+SDK_LIBRARY = True
+
 LOCAL_INCLUDES += [
     '../src',
 ]
 
 USE_STATIC_LIBS = True
 
 if CONFIG['_MSC_VER']:
     DEFINES['_USE_ANSI_CPP'] = True
--- a/js/src/Makefile.in
+++ b/js/src/Makefile.in
@@ -10,17 +10,16 @@ endif
 make_min_ver := 3.81
 ifneq ($(make_min_ver),$(firstword $(sort $(make_min_ver) $(MAKE_VERSION))))
 $(error GNU Make $(make_min_ver) or higher is required)
 endif
 
 TOPLEVEL_BUILD := 1
 
 run_for_side_effects := $(shell echo 'MAKE: $(MAKE)')
-STATIC_LIBRARY_NAME = js_static
 LIBS		= $(NSPR_LIBS)
 
 DIST_INSTALL = 1
 
 ifdef JS_STANDALONE
 SHARED_LIBRARY_LIBS += $(call EXPAND_LIBNAME_PATH,mfbt,$(DEPTH)/mfbt)
 ifndef MOZ_NATIVE_ZLIB
 SHARED_LIBRARY_LIBS += $(call EXPAND_LIBNAME_PATH,mozz,$(DEPTH)/modules/zlib/src)
@@ -44,22 +43,16 @@ endif
 ifndef MOZ_NATIVE_FFI
 DEFINES += -DFFI_BUILDING
 endif
 
 endif # JS_HAS_CTYPES
 
 DASH_R		= -r
 
-ifneq (,$(filter WINNT,$(OS_ARCH)))
-SDK_LIBRARY = $(IMPORT_LIBRARY)
-else
-SDK_LIBRARY = $(SHARED_LIBRARY)
-endif
-
 EXTRA_DSO_LDOPTS += $(NSPR_LIBS)
 
 # Define keyword generator before rules.mk, see bug 323979 comment 50
 
 GARBAGE += jsautokw.h host_jskwgen$(HOST_BIN_SUFFIX)
 
 GARBAGE += selfhosted.out.h
 
--- a/js/src/moz.build
+++ b/js/src/moz.build
@@ -423,18 +423,20 @@ HOST_SIMPLE_PROGRAMS += [
 # the js code getting copied into xpinstall and jsd as well as mozilla-bin,
 # and then the static data cells used for locking no longer work.
 #
 # In fact, we now build both a static and a shared library, as the
 # JS shell would like to link to the static library.
 
 if CONFIG['JS_SHARED_LIBRARY']:
     FORCE_SHARED_LIB = True
+    SDK_LIBRARY = True
 
 FORCE_STATIC_LIB = True
+STATIC_LIBRARY_NAME = 'js_static'
 
 if CONFIG['MOZ_ETW']:
     GENERATED_FILES = [
         'ETWProvider.h',
     ]
     # This will get the ETW provider resources into the library mozjs.dll
     RESFILE = 'ETWProvider.res'
 
--- a/js/xpconnect/tests/components/native/moz.build
+++ b/js/xpconnect/tests/components/native/moz.build
@@ -11,17 +11,15 @@ UNIFIED_SOURCES += [
     'xpctest_module.cpp',
     'xpctest_params.cpp',
 ]
 
 LIBRARY_NAME = 'xpctest'
 
 IS_COMPONENT = True
 
-FORCE_SHARED_LIB = True
-
 DEFINES['LIBRARY_FILENAME'] = '%s%s%s' % (
     CONFIG['DLL_PREFIX'],
     LIBRARY_NAME,
     CONFIG['DLL_SUFFIX']
 )
 
 FAIL_ON_WARNINGS = True
--- a/memory/build/Makefile.in
+++ b/memory/build/Makefile.in
@@ -1,15 +1,14 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this file,
 # You can obtain one at http://mozilla.org/MPL/2.0/.
 
 STLFLAGS =
 ifdef MOZ_GLUE_PROGRAM_LDFLAGS
-SDK_LIBRARY = $(REAL_LIBRARY)
 DIST_INSTALL = 1
 endif
 
 ifdef MOZ_JEMALLOC3
 ifndef MOZ_NATIVE_JEMALLOC
 SHARED_LIBRARY_LIBS += $(call EXPAND_LIBNAME_PATH,jemalloc,$(DEPTH)/memory/jemalloc)
 endif
 else
--- a/memory/build/moz.build
+++ b/memory/build/moz.build
@@ -33,16 +33,19 @@ if CONFIG['MOZ_JEMALLOC3']:
 
 if CONFIG['MOZ_REPLACE_MALLOC']:
     SOURCES += [
         'replace_malloc.c',
     ]
 
 LIBRARY_NAME = 'memory'
 
+if CONFIG['MOZ_GLUE_PROGRAM_LDFLAGS']:
+    SDK_LIBRARY = True
+
 # Keep jemalloc separated when mozglue is statically linked
 if CONFIG['MOZ_MEMORY'] and (CONFIG['OS_TARGET'] in ('WINNT', 'Darwin', 'Android') or
                              CONFIG['MOZ_NATIVE_JEMALLOC']):
     FINAL_LIBRARY = 'mozglue'
 
 if CONFIG['MOZ_REPLACE_MALLOC'] and CONFIG['OS_TARGET'] == 'Darwin':
     # The zone allocator for OSX needs some jemalloc internal functions
     LOCAL_INCLUDES += ['/memory/jemalloc/src/include']
--- a/memory/jemalloc/Makefile.in
+++ b/memory/jemalloc/Makefile.in
@@ -1,14 +1,13 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this file,
 # You can obtain one at http://mozilla.org/MPL/2.0/.
 
 ifdef MOZ_GLUE_PROGRAM_LDFLAGS
-SDK_LIBRARY = $(REAL_LIBRARY)
 DIST_INSTALL = 1
 endif
 
 include $(topsrcdir)/config/rules.mk
 
 ifdef GNU_CC
 CFLAGS += -std=gnu99
 endif
--- a/memory/jemalloc/moz.build
+++ b/memory/jemalloc/moz.build
@@ -35,16 +35,19 @@ if CONFIG['OS_TARGET'] == 'Darwin' and n
     SOURCES += [
         'src/src/zone.c',
     ]
 
 LIBRARY_NAME = 'jemalloc'
 
 FORCE_STATIC_LIB = True
 
+if CONFIG['MOZ_GLUE_PROGRAM_LDFLAGS']:
+    SDK_LIBRARY = True
+
 if CONFIG['_MSC_VER']:
     DEFINES['DLLEXPORT'] = True
     LOCAL_INCLUDES += ['src/include/msvc_compat']
     if not CONFIG['HAVE_INTTYPES_H']:
         LOCAL_INCLUDES += ['src/include/msvc_compat/C99']
 
 if CONFIG['OS_TARGET'] == 'Linux':
     # For mremap
--- a/memory/mozalloc/Makefile.in
+++ b/memory/mozalloc/Makefile.in
@@ -1,12 +1,6 @@
 #
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 DIST_INSTALL 	= 1
-
-ifneq (,$(filter WINNT,$(OS_ARCH)))
-SDK_LIBRARY = $(IMPORT_LIBRARY)
-else
-SDK_LIBRARY = $(SHARED_LIBRARY)
-endif
--- a/memory/mozalloc/moz.build
+++ b/memory/mozalloc/moz.build
@@ -58,16 +58,17 @@ else:
     ]
 
 LIBRARY_NAME = 'mozalloc'
 
 if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk':
     FORCE_STATIC_LIB = True
 else:
     FORCE_SHARED_LIB = True
+    SDK_LIBRARY = True
 
 # The strndup declaration in string.h is in an ifdef __USE_GNU section
 DEFINES['_GNU_SOURCE'] = True
 
 TEST_TOOL_DIRS += ['tests']
 
 GENERATED_INCLUDES += ['/xpcom']
 
--- a/mozglue/build/Makefile.in
+++ b/mozglue/build/Makefile.in
@@ -3,30 +3,16 @@
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 DIST_INSTALL = 1
 
 # For FORCE_SHARED_LIB
 include $(topsrcdir)/config/config.mk
 
-ifneq (1_1,$(MOZ_MEMORY)_$(or $(MOZ_NATIVE_JEMALLOC),$(FORCE_SHARED_LIB)))
-
-ifneq (,$(filter WINNT,$(OS_ARCH)))
-SDK_LIBRARY = $(IMPORT_LIBRARY)
-else
-ifdef FORCE_SHARED_LIB
-SDK_LIBRARY = $(SHARED_LIBRARY)
-else
-SDK_LIBRARY = $(REAL_LIBRARY)
-endif
-endif
-
-endif
- 
 MOZ_GLUE_LDFLAGS = # Don't link against ourselves
 
 SHARED_LIBRARY_LIBS += $(call EXPAND_LIBNAME_PATH,mfbt,$(DEPTH)/mfbt)
 
 ifneq (,$(ZLIB_IN_MOZGLUE)$(MOZ_LINKER))
 ifdef MOZ_NATIVE_ZLIB
 EXTRA_DSO_LDOPTS += $(MOZ_ZLIB_LIBS)
 else
--- a/mozglue/build/moz.build
+++ b/mozglue/build/moz.build
@@ -7,16 +7,18 @@
 # Build mozglue as a shared lib on Windows, OSX and Android.
 # If this is ever changed, update MOZ_SHARED_MOZGLUE in browser/installer/Makefile.in
 if CONFIG['OS_TARGET'] in ('WINNT', 'Darwin', 'Android'):
     FORCE_SHARED_LIB = True
 else:
     FORCE_SHARED_LIB = False
     FORCE_STATIC_LIB = True
 
+SDK_LIBRARY = True
+
 if CONFIG['MOZ_MEMORY'] and (CONFIG['MOZ_NATIVE_JEMALLOC'] or FORCE_SHARED_LIB):
     pass
     # TODO: SHARED_LIBRARY_LIBS go here
 else:
     # Temporary, until bug 662814 lands
     NO_VISIBILITY_FLAGS = True
     SOURCES += [
         'dummy.cpp',
--- a/python/mozbuild/mozbuild/backend/configenvironment.py
+++ b/python/mozbuild/mozbuild/backend/configenvironment.py
@@ -103,16 +103,28 @@ class ConfigEnvironment(object):
 
         if not source:
             source = mozpath.join(topobjdir, 'config.status')
         self.source = source
         self.defines = ReadOnlyDict(defines)
         self.substs = dict(substs)
         self.topsrcdir = mozpath.normsep(topsrcdir)
         self.topobjdir = mozpath.normsep(topobjdir)
+        self.lib_prefix = self.substs.get('LIB_PREFIX', '')
+        if 'LIB_SUFFIX' in self.substs:
+            self.lib_suffix = '.%s' % self.substs['LIB_SUFFIX']
+        self.dll_prefix = self.substs.get('DLL_PREFIX', '')
+        self.dll_suffix = self.substs.get('DLL_SUFFIX', '')
+        if self.substs.get('IMPORT_LIB_SUFFIX'):
+            self.import_prefix = self.lib_prefix
+            self.import_suffix = '.%s' % self.substs['IMPORT_LIB_SUFFIX']
+        else:
+            self.import_prefix = self.dll_prefix
+            self.import_suffix = self.dll_suffix
+
         global_defines = [name for name, value in defines
             if not name in non_global_defines]
         self.substs['ACDEFINES'] = ' '.join(['-D%s=%s' % (name,
             shell_quote(self.defines[name]).replace('$', '$$')) for name in global_defines])
         def serialize(obj):
             if isinstance(obj, StringTypes):
                 return obj
             if isinstance(obj, Iterable):
--- a/python/mozbuild/mozbuild/backend/recursivemake.py
+++ b/python/mozbuild/mozbuild/backend/recursivemake.py
@@ -32,17 +32,17 @@ from ..frontend.data import (
     GeneratedInclude,
     HostProgram,
     HostSimpleProgram,
     InstallationTarget,
     IPDLFile,
     JARManifest,
     JavaJarData,
     JavaScriptModules,
-    LibraryDefinition,
+    Library,
     LocalInclude,
     PerSourceFlag,
     Program,
     Resources,
     SandboxDerived,
     SandboxWrapped,
     SimpleProgram,
     TestManifest,
@@ -455,18 +455,18 @@ class RecursiveMakeBackend(CommonBackend
             # automated.
             if isinstance(obj.wrapped, JavaJarData):
                 self._process_java_jar_data(obj.wrapped, backend_file)
             elif isinstance(obj.wrapped, AndroidEclipseProjectData):
                 self._process_android_eclipse_project_data(obj.wrapped, backend_file)
             else:
                 return
 
-        elif isinstance(obj, LibraryDefinition):
-            self._process_library_definition(obj, backend_file)
+        elif isinstance(obj, Library):
+            self._process_library(obj, backend_file)
 
         else:
             return
         obj.ack()
 
     def _fill_root_mk(self):
         """
         Create two files, root.mk and root-deps.mk, the first containing
@@ -1094,18 +1094,32 @@ class RecursiveMakeBackend(CommonBackend
         args = ['--no-remove',
             '--no-remove-all-directory-symlinks',
             '--no-remove-empty-directories',
             project_directory,
             manifest_path]
         rule.add_commands(['$(call py_action,process_install_manifest,%s)' % ' '.join(args)])
         fragment.dump(backend_file.fh, removal_guard=False)
 
-    def _process_library_definition(self, libdef, backend_file):
-        backend_file.write('LIBRARY_NAME = %s\n' % libdef.basename)
+    def _process_library(self, libdef, backend_file):
+        backend_file.write('LIBRARY_NAME := %s\n' % libdef.basename)
+        if libdef.kind in (libdef.STATIC, libdef.STATIC + libdef.SHARED):
+            backend_file.write('FORCE_STATIC_LIB := 1\n')
+            backend_file.write('REAL_LIBRARY := %s\n' % libdef.static_name)
+        if libdef.kind != libdef.STATIC:
+            backend_file.write('FORCE_SHARED_LIB := 1\n')
+            backend_file.write('IMPORT_LIBRARY := %s\n' % libdef.import_name)
+            backend_file.write('SHARED_LIBRARY := %s\n' % libdef.shared_name)
+        if libdef.kind == libdef.COMPONENT:
+            backend_file.write('IS_COMPONENT := 1\n')
+        if libdef.soname:
+            backend_file.write('DSO_SONAME := %s\n' % libdef.soname)
+        if libdef.is_sdk:
+            backend_file.write('SDK_LIBRARY := %s\n' % libdef.import_name)
+
         thisobjdir = libdef.objdir
         topobjdir = libdef.topobjdir.replace(os.sep, '/')
         for objdir, basename in libdef.static_libraries:
             # If this is an external objdir (i.e., comm-central), use the other
             # directory instead of $(DEPTH).
             if objdir.startswith(topobjdir + '/'):
                 relpath = '$(DEPTH)/%s' % mozpath.relpath(objdir, topobjdir)
             else:
--- a/python/mozbuild/mozbuild/backend/visualstudio.py
+++ b/python/mozbuild/mozbuild/backend/visualstudio.py
@@ -15,17 +15,17 @@ import uuid
 
 from xml.dom import getDOMImplementation
 
 from mozpack.files import FileFinder
 
 from .common import CommonBackend
 from ..frontend.data import (
     Defines,
-    LibraryDefinition,
+    Library,
     LocalInclude,
     VariablePassthru,
 )
 
 
 MSBUILD_NAMESPACE = 'http://schemas.microsoft.com/developer/msbuild/2003'
 
 def get_id(name):
@@ -98,17 +98,17 @@ class VisualStudioBackend(CommonBackend)
             self._paths_to_configs[reldir] = obj.config
 
         if isinstance(obj, VariablePassthru):
             for k, v in obj.variables.items():
                 if k.endswith('SRCS'):
                     s = self._paths_to_sources.setdefault(reldir, set())
                     s.update(v)
 
-        elif isinstance(obj, LibraryDefinition):
+        elif isinstance(obj, Library):
             self._libs_to_paths[obj.basename] = reldir
 
         elif isinstance(obj, Defines):
             self._paths_to_defines.setdefault(reldir, {}).update(obj.defines)
 
         elif isinstance(obj, LocalInclude):
             p = obj.path
             includes = self._paths_to_includes.setdefault(reldir, [])
--- a/python/mozbuild/mozbuild/frontend/data.py
+++ b/python/mozbuild/mozbuild/frontend/data.py
@@ -355,33 +355,85 @@ class HostProgram(BaseProgram):
 class SimpleProgram(BaseProgram):
     """Sandbox container object for each program in SIMPLE_PROGRAMS"""
 
 
 class HostSimpleProgram(BaseProgram):
     """Sandbox container object for each program in HOST_SIMPLE_PROGRAMS"""
 
 
-class LibraryDefinition(SandboxDerived):
-    """Partial definition for a library
+class Library(SandboxDerived):
+    """Sandbox container object for libraries.
 
     The static_libraries member tracks the list of relative directory and
     library names of static libraries that are meant to be linked into
     the library defined by an instance of this class.
     """
     __slots__ = (
         'basename',
+        'import_name',
+        'is_sdk',
+        'shared_name',
+        'static_name',
+        'soname',
         'static_libraries',
         'refcount',
     )
 
-    def __init__(self, sandbox, basename):
+    STATIC = 1
+    SHARED = 2
+    # STATIC + SHARED = 3
+    FRAMEWORK = 4
+    COMPONENT = 5
+    MAX_TYPE = 6
+
+    def __init__(self, sandbox, basename, kind=None, soname=None,
+            static_name=None, shared_name=None, is_sdk=False):
+        assert(kind in range(1, self.MAX_TYPE))
         SandboxDerived.__init__(self, sandbox)
 
         self.basename = basename
+        self.kind = kind
+        self.static_name = self.shared_name = None
+        if kind in (self.STATIC, self.STATIC + self.SHARED):
+            self.static_name = static_name or self.basename
+        if self.static_name:
+            self.static_name = '%s%s%s' % (
+                sandbox.config.lib_prefix,
+                self.static_name,
+                sandbox.config.lib_suffix
+            )
+            self.import_name = self.static_name
+        if kind != self.STATIC:
+            self.shared_name = shared_name or self.basename
+        if self.shared_name:
+            if kind == self.FRAMEWORK:
+                self.shared_name = shared_name
+                self.import_name = shared_name
+            else:
+                self.import_name = '%s%s%s' % (
+                    sandbox.config.import_prefix,
+                    self.shared_name,
+                    sandbox.config.import_suffix,
+                )
+                self.shared_name = '%s%s%s' % (
+                    sandbox.config.dll_prefix,
+                    self.shared_name,
+                    sandbox.config.dll_suffix,
+                )
+        if soname:
+            self.soname = '%s%s%s' % (
+                sandbox.config.dll_prefix,
+                soname,
+                sandbox.config.dll_suffix,
+            )
+        else:
+            self.soname = self.shared_name
+        self.is_sdk = is_sdk
+
         self.refcount = 0
         self.static_libraries = []
 
     def link_static_lib(self, objdir, basename):
         self.static_libraries.append((objdir, basename))
 
 
 class TestManifest(SandboxDerived):
--- a/python/mozbuild/mozbuild/frontend/emitter.py
+++ b/python/mozbuild/mozbuild/frontend/emitter.py
@@ -6,17 +6,19 @@ from __future__ import unicode_literals
 
 import json
 import logging
 import os
 import traceback
 import sys
 import time
 
+from collections import OrderedDict
 from mach.mixin.logging import LoggingMixin
+from mozbuild.util import OrderedDefaultDict
 
 import mozpack.path as mozpath
 import manifestparser
 import reftest
 import mozinfo
 
 from .data import (
     ConfigFileSubstitution,
@@ -29,17 +31,17 @@ from .data import (
     ExampleWebIDLInterface,
     HeaderFileSubstitution,
     HostProgram,
     HostSimpleProgram,
     InstallationTarget,
     IPDLFile,
     JARManifest,
     JavaScriptModules,
-    LibraryDefinition,
+    Library,
     LocalInclude,
     PerSourceFlag,
     PreprocessedTestWebIDLFile,
     PreprocessedWebIDLFile,
     Program,
     ReaderSummary,
     Resources,
     SandboxWrapped,
@@ -78,17 +80,17 @@ class TreeMetadataEmitter(LoggingMixin):
         # arguments. This gross hack works around the problem until we
         # rid ourselves of 2.6.
         self.info = {}
         for k, v in mozinfo.info.items():
             if isinstance(k, unicode):
                 k = k.encode('ascii')
             self.info[k] = v
 
-        self._libs = {}
+        self._libs = OrderedDefaultDict(OrderedDict)
         self._final_libs = []
 
     def emit(self, output):
         """Convert the BuildReader output into data structures.
 
         The return value from BuildReader.read_topsrcdir() (a generator) is
         typically fed into this function.
         """
@@ -226,33 +228,29 @@ class TreeMetadataEmitter(LoggingMixin):
             'EXTRA_COMPILE_FLAGS',
             'EXTRA_COMPONENTS',
             'EXTRA_DSO_LDOPTS',
             'EXTRA_JS_MODULES',
             'EXTRA_PP_COMPONENTS',
             'EXTRA_PP_JS_MODULES',
             'FAIL_ON_WARNINGS',
             'FILES_PER_UNIFIED_FILE',
-            'FORCE_SHARED_LIB',
-            'FORCE_STATIC_LIB',
             'USE_STATIC_LIBS',
             'GENERATED_FILES',
             'HOST_LIBRARY_NAME',
-            'IS_COMPONENT',
             'IS_GYP_DIR',
             'JS_MODULES_PATH',
             'LIBS',
             'MSVC_ENABLE_PGO',
             'NO_DIST_INSTALL',
             'OS_LIBS',
             'RCFILE',
             'RESFILE',
             'RCINCLUDE',
             'DEFFILE',
-            'SDK_LIBRARY',
             'WIN32_EXE_LDFLAGS',
             'LD_VERSION_SCRIPT',
         ]
         for v in varlist:
             if v in sandbox and sandbox[v]:
                 passthru.variables[v] = sandbox[v]
 
         for v in ['CFLAGS', 'CXXFLAGS', 'CMFLAGS', 'CMMFLAGS', 'LDFLAGS']:
@@ -375,35 +373,117 @@ class TreeMetadataEmitter(LoggingMixin):
                 sandbox.get('DIST_SUBDIR'):
             yield InstallationTarget(sandbox)
 
         libname = sandbox.get('LIBRARY_NAME')
         final_lib = sandbox.get('FINAL_LIBRARY')
         if not libname and final_lib:
             # If no LIBRARY_NAME is given, create one.
             libname = sandbox['RELATIVEDIR'].replace('/', '_')
-        if libname:
-            self._libs.setdefault(libname, {})[sandbox['OBJDIR']] = \
-                LibraryDefinition(sandbox, libname)
+
+        static_lib = sandbox.get('FORCE_STATIC_LIB')
+        shared_lib = sandbox.get('FORCE_SHARED_LIB')
+
+        static_name = sandbox.get('STATIC_LIBRARY_NAME')
+        shared_name = sandbox.get('SHARED_LIBRARY_NAME')
+
+        is_framework = sandbox.get('IS_FRAMEWORK')
+        is_component = sandbox.get('IS_COMPONENT')
+
+        soname = sandbox.get('SONAME')
 
         if final_lib:
-            if isinstance(sandbox, MozbuildSandbox) and \
-                    sandbox.get('FORCE_STATIC_LIB'):
+            if isinstance(sandbox, MozbuildSandbox):
+                if static_lib:
+                    raise SandboxValidationError(
+                        'FINAL_LIBRARY implies FORCE_STATIC_LIB. '
+                        'Please remove the latter.', sandbox)
+            if shared_lib:
+                raise SandboxValidationError(
+                    'FINAL_LIBRARY conflicts with FORCE_SHARED_LIB. '
+                    'Please remove one.', sandbox)
+            if is_framework:
+                raise SandboxValidationError(
+                    'FINAL_LIBRARY conflicts with IS_FRAMEWORK. '
+                    'Please remove one.', sandbox)
+            if is_component:
                 raise SandboxValidationError(
-                    'FINAL_LIBRARY implies FORCE_STATIC_LIB', sandbox)
+                    'FINAL_LIBRARY conflicts with IS_COMPONENT. '
+                    'Please remove one.', sandbox)
             self._final_libs.append((sandbox['OBJDIR'], libname, final_lib))
-            passthru.variables['FORCE_STATIC_LIB'] = True
+            static_lib = True
+
+        if libname:
+            args = {
+                'kind': 0,
+            }
+            if is_component:
+                if shared_lib:
+                    raise SandboxValidationError(
+                        'IS_COMPONENT implies FORCE_SHARED_LIB. '
+                        'Please remove the latter.', sandbox)
+                if is_framework:
+                    raise SandboxValidationError(
+                        'IS_COMPONENT conflicts with IS_FRAMEWORK. '
+                        'Please remove one.', sandbox)
+                if static_lib:
+                    raise SandboxValidationError(
+                        'IS_COMPONENT conflicts with FORCE_STATIC_LIB. '
+                        'Please remove one.', sandbox)
+                shared_lib = True
+                args['kind'] = Library.COMPONENT
 
-        soname = sandbox.get('SONAME')
-        if soname:
-            if not sandbox.get('FORCE_SHARED_LIB'):
-                raise SandboxValidationError(
-                    'SONAME applicable only for shared libraries', sandbox)
-            else:
-                passthru.variables['SONAME'] = soname
+            if is_framework:
+                if shared_lib:
+                    raise SandboxValidationError(
+                        'IS_FRAMEWORK implies FORCE_SHARED_LIB. '
+                        'Please remove the latter.', sandbox)
+                if static_lib:
+                    raise SandboxValidationError(
+                        'IS_FRAMEWORK conflicts with FORCE_STATIC_LIB. '
+                        'Please remove one.', sandbox)
+                if soname:
+                    raise SandboxValidationError(
+                        'IS_FRAMEWORK conflicts with SONAME. '
+                        'Please remove one.', sandbox)
+                shared_lib = True
+                args['kind'] = Library.FRAMEWORK
+
+            if static_name:
+                if not static_lib:
+                    raise SandboxValidationError(
+                        'STATIC_LIBRARY_NAME requires FORCE_STATIC_LIB', sandbox)
+                args['static_name'] = static_name
+
+            if shared_name:
+                if not shared_lib:
+                    raise SandboxValidationError(
+                        'SHARED_LIBRARY_NAME requires FORCE_SHARED_LIB', sandbox)
+                args['shared_name'] = shared_name
+
+            if soname:
+                if not shared_lib:
+                    raise SandboxValidationError(
+                        'SONAME requires FORCE_SHARED_LIB', sandbox)
+                args['soname'] = soname
+
+            if not static_lib and not shared_lib:
+                static_lib = True
+            if not args['kind']:
+                if static_lib:
+                    args['kind'] += Library.STATIC
+                if shared_lib:
+                    args['kind'] += Library.SHARED
+
+            if sandbox.get('SDK_LIBRARY'):
+                args['is_sdk'] = True
+
+            self._libs[libname][sandbox['OBJDIR']] = \
+                Library(sandbox, libname, **args)
+
 
         # While there are multiple test manifests, the behavior is very similar
         # across them. We enforce this by having common handling of all
         # manifests and outputting a single class type with the differences
         # described inside the instance.
         #
         # Keys are variable prefixes and values are tuples describing how these
         # manifests should be handled:
--- a/python/mozbuild/mozbuild/frontend/sandbox_symbols.py
+++ b/python/mozbuild/mozbuild/frontend/sandbox_symbols.py
@@ -268,16 +268,18 @@ VARIABLES = {
         """Source code files to compile with the host compiler.
 
         This variable contains a list of source code files to compile.
         with the host compiler.
         """, 'compile'),
 
     'IS_COMPONENT': (bool, bool,
         """Whether the library contains a binary XPCOM component manifest.
+
+        Implies FORCE_SHARED_LIB.
         """, None),
 
     'PARALLEL_DIRS': (list, list,
         """A parallel version of ``DIRS``.
 
         Ideally this variable does not exist. It is provided so a transition
         from recursive makefiles can be made. Once the build system has been
         converted to not use Makefile's for the build frontend, this will
@@ -301,26 +303,48 @@ VARIABLES = {
 
         ``EXTRA_JS_MODULES`` files are copied to
         ``$(FINAL_TARGET)/$(JS_MODULES_PATH)``. This variable does not
         need to be defined if the desired destination directory is
         ``$(FINAL_TARGET)/modules``.
         """, None),
 
     'LIBRARY_NAME': (unicode, unicode,
-        """The name of the library generated for a directory.
+        """The code name of the library generated for a directory.
 
+        By default STATIC_LIBRARY_NAME and SHARED_LIBRARY_NAME take this name.
         In ``example/components/moz.build``,::
 
            LIBRARY_NAME = 'xpcomsample'
 
         would generate ``example/components/libxpcomsample.so`` on Linux, or
         ``example/components/xpcomsample.lib`` on Windows.
         """, 'binaries'),
 
+    'SHARED_LIBRARY_NAME': (unicode, unicode,
+        """The name of the static library generated for a directory, if it needs to
+        differ from the library code name.
+
+        Implies FORCE_SHARED_LIB.
+        """, None),
+
+    'IS_FRAMEWORK': (bool, bool,
+        """Whether the library to build should be built as a framework on OSX.
+
+        This implies the name of the library won't be prefixed nor suffixed.
+        Implies FORCE_SHARED_LIB.
+        """, None),
+
+    'STATIC_LIBRARY_NAME': (unicode, unicode,
+        """The name of the static library generated for a directory, if it needs to
+        differ from the library code name.
+
+        Implies FORCE_STATIC_LIB.
+        """, None),
+
     'LIBS': (StrictOrderingOnAppendList, list,
         """Linker libraries and flags.
 
         A list of libraries and flags to include when linking.
         """, None),
 
     'LOCAL_INCLUDES': (StrictOrderingOnAppendList, list,
         """Additional directories to be searched for include files by the compiler.
@@ -390,21 +414,20 @@ VARIABLES = {
         Added files also have a 'preprocess' attribute, which will cause the
         affected file to be run through the preprocessor, using any ``DEFINES``
         set. It is used like this::
 
            RESOURCE_FILES.fonts += ['baz.res.in']
            RESOURCE_FILES.fonts['baz.res.in'].preprocess = True
         """, None),
 
-    'SDK_LIBRARY': (StrictOrderingOnAppendList, list,
-        """Elements of the distributed SDK.
+    'SDK_LIBRARY': (bool, bool,
+        """Whether the library built in the directory is part of the SDK.
 
-        Files on this list will be copied into ``SDK_LIB_DIR``
-        (``$DIST/sdk/lib``).
+        The library will be copied into ``SDK_LIB_DIR`` (``$DIST/sdk/lib``).
         """, None),
 
     'SIMPLE_PROGRAMS': (StrictOrderingOnAppendList, list,
         """Compile a list of executable names.
 
         Each name in this variable corresponds to an executable built from the
         corresponding source file with the same base name.
 
--- a/python/mozbuild/mozbuild/test/backend/data/variable_passthru/moz.build
+++ b/python/mozbuild/mozbuild/test/backend/data/variable_passthru/moz.build
@@ -16,18 +16,16 @@ HOST_SOURCES += ['bar.cpp', 'foo.cpp']
 HOST_SOURCES += ['bar.c', 'foo.c']
 
 HOST_LIBRARY_NAME = 'host_bar'
 
 LIBS = ['bar.lib', 'foo.lib']
 
 OS_LIBS = ['foo.so', '-l123', 'bar.a']
 
-SDK_LIBRARY = ['bar.sdk', 'foo.sdk']
-
 SOURCES += ['bar.c', 'foo.c']
 
 SOURCES += ['bar.mm', 'foo.mm']
 
 SOURCES += ['baz.S', 'foo.S']
 
 FAIL_ON_WARNINGS = True
 MSVC_ENABLE_PGO = True
--- a/python/mozbuild/mozbuild/test/backend/test_recursivemake.py
+++ b/python/mozbuild/mozbuild/test/backend/test_recursivemake.py
@@ -305,20 +305,16 @@ class TestRecursiveMakeBackend(BackendTe
             'MSVC_ENABLE_PGO': [
                 'MSVC_ENABLE_PGO := 1',
             ],
             'OS_LIBS': [
                 'OS_LIBS += foo.so',
                 'OS_LIBS += -l123',
                 'OS_LIBS += bar.a',
             ],
-            'SDK_LIBRARY': [
-                'SDK_LIBRARY += bar.sdk',
-                'SDK_LIBRARY += foo.sdk',
-            ],
             'SSRCS': [
                 'SSRCS += baz.S',
                 'SSRCS += foo.S',
             ],
             'VISIBILITY_FLAGS': [
                 'VISIBILITY_FLAGS :=',
             ],
             'DELAYLOAD_LDFLAGS': [
--- a/python/mozbuild/mozbuild/test/frontend/data/variable-passthru/moz.build
+++ b/python/mozbuild/mozbuild/test/frontend/data/variable-passthru/moz.build
@@ -16,31 +16,27 @@ HOST_SOURCES += ['fans.cpp', 'tans.cpp']
 HOST_SOURCES += ['fans.c', 'tans.c']
 
 HOST_LIBRARY_NAME = 'host_fans'
 
 LIBS += ['fans.lib', 'tans.lib']
 
 OS_LIBS += ['foo.so', '-l123', 'aaa.a']
 
-SDK_LIBRARY += ['fans.sdk', 'tans.sdk']
-
 SOURCES += ['fans.c', 'tans.c']
 
 SOURCES += ['fans.mm', 'tans.mm']
 
 SOURCES += ['bans.S', 'fans.S']
 
 FAIL_ON_WARNINGS = True
 MSVC_ENABLE_PGO = True
 
 NO_DIST_INSTALL = True
 
-FORCE_SHARED_LIB = True
-IS_COMPONENT = True
 NO_VISIBILITY_FLAGS = True
 
 DELAYLOAD_DLLS = ['foo.dll', 'bar.dll']
 
 RCFILE = 'foo.rc'
 RESFILE = 'bar.res'
 RCINCLUDE = 'bar.rc'
 DEFFILE = 'baz.def'
--- a/python/mozbuild/mozbuild/test/frontend/test_emitter.py
+++ b/python/mozbuild/mozbuild/test/frontend/test_emitter.py
@@ -160,26 +160,23 @@ class TestEmitterBasic(unittest.TestCase
             CSRCS=['fans.c', 'tans.c'],
             CPP_UNIT_TESTS=['foo.cpp'],
             DISABLE_STL_WRAPPING=True,
             EXTRA_COMPONENTS=['fans.js', 'tans.js'],
             EXTRA_PP_COMPONENTS=['fans.pp.js', 'tans.pp.js'],
             EXTRA_JS_MODULES=['bar.jsm', 'foo.jsm'],
             EXTRA_PP_JS_MODULES=['bar.pp.jsm', 'foo.pp.jsm'],
             FAIL_ON_WARNINGS=True,
-            FORCE_SHARED_LIB=True,
             HOST_CPPSRCS=['fans.cpp', 'tans.cpp'],
             HOST_CSRCS=['fans.c', 'tans.c'],
             HOST_LIBRARY_NAME='host_fans',
-            IS_COMPONENT=True,
             LIBS=['fans.lib', 'tans.lib'],
             MSVC_ENABLE_PGO=True,
             NO_DIST_INSTALL=True,
             OS_LIBS=['foo.so', '-l123', 'aaa.a'],
-            SDK_LIBRARY=['fans.sdk', 'tans.sdk'],
             SSRCS=['bans.S', 'fans.S'],
             VISIBILITY_FLAGS='',
             DELAYLOAD_LDFLAGS=['-DELAYLOAD:foo.dll', '-DELAYLOAD:bar.dll'],
             USE_DELAYIMP=True,
             RCFILE='foo.rc',
             RESFILE='bar.res',
             RCINCLUDE='bar.rc',
             DEFFILE='baz.def',
--- a/python/mozbuild/mozbuild/util.py
+++ b/python/mozbuild/mozbuild/util.py
@@ -11,16 +11,17 @@ import copy
 import difflib
 import errno
 import hashlib
 import os
 import stat
 import sys
 import time
 
+from collections import OrderedDict
 from StringIO import StringIO
 
 
 if sys.version_info[0] == 3:
     str_type = str
 else:
     str_type = basestring
 
@@ -662,8 +663,22 @@ def shell_quote(s):
     '''
     if type(s) == int:
         return '%d' % s
     # Single quoted strings can contain any characters unescaped except the
     # single quote itself, which can't even be escaped, so the string needs to
     # be closed, an escaped single quote added, and reopened.
     t = type(s)
     return t("'%s'") % s.replace(t("'"), t("'\\''"))
+
+
+class OrderedDefaultDict(OrderedDict):
+    '''A combination of OrderedDict and defaultdict.'''
+    def __init__(self, default_factory, *args, **kwargs):
+        OrderedDict.__init__(self, *args, **kwargs)
+        self._default_factory = default_factory
+
+    def __getitem__(self, key):
+        try:
+            return OrderedDict.__getitem__(self, key)
+        except KeyError:
+            value = self[key] = self._default_factory()
+            return value
--- a/security/build/Makefile.in
+++ b/security/build/Makefile.in
@@ -356,22 +356,16 @@ nss3.def: $(nss_def_file) $(sqlite_def_f
 	  $(nss_def_file) $(sqlite_def_file) $(nspr_def_file))
 
 GARBAGE += \
   nss3.def \
   $(NULL)
 endif # GCC_USE_GNU_LD
 endif # WINNT
 
-ifneq (,$(filter WINNT,$(OS_ARCH)))
-SDK_LIBRARY = $(IMPORT_LIBRARY)
-else
-SDK_LIBRARY = $(SHARED_LIBRARY)
-endif
-
 endif # MOZ_FOLD_LIBS
 
 include $(topsrcdir)/config/rules.mk
 
 ifdef MOZ_FOLD_LIBS
 # Force the linker to include everything from the static libraries.
 EXPAND_LIBS_EXEC += --extract
 
--- a/security/build/moz.build
+++ b/security/build/moz.build
@@ -4,16 +4,17 @@
 # License, v. 2.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_FOLD_LIBS']:
     # TODO: The library name can be changed when bug 845217 is fixed.
     LIBRARY_NAME = 'nss3'
 
     FORCE_SHARED_LIB = True
+    SDK_LIBRARY = True
 
 if CONFIG['OS_TARGET'] == 'WINNT':
     DEFFILE = 'nss3.def'
 
 if CONFIG['OS_ARCH'] == 'Linux' and \
    CONFIG['MOZ_FOLD_LIBS'] and \
    CONFIG['GCC_USE_GNU_LD']:
     LD_VERSION_SCRIPT = 'nss3.def'
--- a/toolkit/library/build/Makefile.in
+++ b/toolkit/library/build/Makefile.in
@@ -4,22 +4,16 @@
 
 include $(topsrcdir)/toolkit/library/libxul.mk
 
 ifeq (WINNT_1,$(OS_TARGET)_$(MOZ_PROFILE_USE))
 # Wrap linker to measure peak virtual memory usage.
 LD := $(PYTHON) $(topsrcdir)/build/link.py $(DEPTH)/toolkit/library/linker-vsize $(LD)
 endif
 
-ifneq (,$(filter WINNT,$(OS_ARCH)))
-SDK_LIBRARY = $(IMPORT_LIBRARY)
-else
-SDK_LIBRARY = $(SHARED_LIBRARY)
-endif
-
 include $(topsrcdir)/config/rules.mk
 
 ifdef COMPILE_ENVIRONMENT
 libs:: $(FINAL_TARGET)/dependentlibs.list
 endif
 
 $(FINAL_TARGET)/dependentlibs.list: $(topsrcdir)/toolkit/library/dependentlibs.py $(SHARED_LIBRARY) $(wildcard $(if $(wildcard $(FINAL_TARGET)/dependentlibs.list),$(addprefix $(FINAL_TARGET)/,$(shell cat $(FINAL_TARGET)/dependentlibs.list))))
 	$(PYTHON) $< $(SHARED_LIBRARY) -L $(FINAL_TARGET) $(if $(TOOLCHAIN_PREFIX),$(addprefix -p ,$(TOOLCHAIN_PREFIX))) > $@
--- a/toolkit/library/build/moz.build
+++ b/toolkit/library/build/moz.build
@@ -1,9 +1,10 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 LIBRARY_NAME = 'xul-shared'
+SDK_LIBRARY = True
 
 include('../libxul.mozbuild')
--- a/toolkit/library/libxul.mk
+++ b/toolkit/library/libxul.mk
@@ -1,24 +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/.
 
-ifeq ($(MOZ_WIDGET_TOOLKIT),cocoa)
-# This is going to be a framework named "XUL", not an ordinary library named
-# "libxul.dylib"
-SHARED_LIBRARY_NAME=XUL
-# Setting MAKE_FRAMEWORK makes DLL_PREFIX and DLL_SUFFIX be ignored when
-# setting SHARED_LIBRARY; we need to leave DLL_PREFIX and DLL_SUFFIX
-# as-is so that dependencies of the form -ltracemalloc still work.
-MAKE_FRAMEWORK=1
-else
-SHARED_LIBRARY_NAME=xul
-endif
-
 SHARED_LIBRARY_LIBS += $(call EXPAND_LIBNAME_PATH,xul,$(DEPTH)/toolkit/library)
 
 EXTRA_DEPS += $(topsrcdir)/toolkit/library/libxul.mk
 
 # dependent libraries
 ifdef MOZ_B2G_BT_BLUEZ #{
 ifeq (gonk,$(MOZ_WIDGET_TOOLKIT))
 OS_LIBS += -ldbus
@@ -31,17 +19,17 @@ endif #}
 
 ifeq (Linux,$(OS_ARCH))
 ifneq (Android,$(OS_TARGET))
 OS_LIBS += -lrt
 EXTRA_DSO_LDOPTS += -Wl,-version-script,symverscript
 
 symverscript: $(topsrcdir)/toolkit/library/symverscript.in
 	$(call py_action,preprocessor, \
-		-DVERSION='$(SHARED_LIBRARY_NAME)$(MOZILLA_SYMBOLVERSION)' $< -o $@)
+		-DVERSION='xul$(MOZILLA_SYMBOLVERSION)' $< -o $@)
 
 EXTRA_DEPS += symverscript
 endif
 endif
 
 ifeq ($(MOZ_WIDGET_TOOLKIT),cocoa)
 OS_LIBS += -lcups
 endif
--- a/toolkit/library/libxul.mozbuild
+++ b/toolkit/library/libxul.mozbuild
@@ -1,17 +1,25 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 MSVC_ENABLE_PGO = True
 
-FORCE_SHARED_LIB = True
+if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
+    # This is going to be a framework named "XUL", not an ordinary library named
+    # "libxul.dylib"
+    SHARED_LIBRARY_NAME = 'XUL'
+    IS_FRAMEWORK = True
+else:
+    SHARED_LIBRARY_NAME = 'xul'
+    FORCE_SHARED_LIB = True
+
 
 DELAYLOAD_DLLS += [
     'comdlg32.dll',
     'dbghelp.dll',
     'psapi.dll',
     'rasapi32.dll',
     'rasdlg.dll',
     'secur32.dll',
--- a/toolkit/system/dbus/moz.build
+++ b/toolkit/system/dbus/moz.build
@@ -8,10 +8,8 @@ SOURCES += [
     'nsDBusModule.cpp',
     'nsDBusService.cpp',
     'nsNetworkManagerListener.cpp',
 ]
 
 LIBRARY_NAME = 'dbusservice'
 
 IS_COMPONENT = True
-
-FORCE_SHARED_LIB = True
--- a/toolkit/system/gnome/moz.build
+++ b/toolkit/system/gnome/moz.build
@@ -24,14 +24,12 @@ if CONFIG['MOZ_ENABLE_GIO']:
         'nsGSettingsService.cpp',
     ]
 
 LIBRARY_NAME = 'mozgnome'
 
 FAIL_ON_WARNINGS = True
 IS_COMPONENT = True
 
-FORCE_SHARED_LIB = True
-
 LOCAL_INCLUDES += [
     '/toolkit/components/build/',
 ]
 
--- a/xpcom/glue/moz.build
+++ b/xpcom/glue/moz.build
@@ -92,19 +92,17 @@ UNIFIED_SOURCES += xpcom_glue_src_cppsrc
 
 UNIFIED_SOURCES += [
     'GenericModule.cpp',
     'nsStringAPI.cpp',
 ]
 
 LIBRARY_NAME = 'xpcomglue_s'
 
-SDK_LIBRARY = [
-    "%s%s.%s" % (CONFIG['LIB_PREFIX'], 'xpcomglue_s', CONFIG['LIB_SUFFIX']),
-]
+SDK_LIBRARY = True
 
 FORCE_STATIC_LIB = True
 
 if CONFIG['_MSC_VER']:
     DEFINES['_USE_ANSI_CPP'] = True
     # Don't include directives about which CRT to use
     CFLAGS += ['-Zl']
     CXXFLAGS += ['-Zl']
--- a/xpcom/glue/nomozalloc/moz.build
+++ b/xpcom/glue/nomozalloc/moz.build
@@ -11,19 +11,17 @@ UNIFIED_SOURCES += xpcom_glue_src_cppsrc
 
 UNIFIED_SOURCES += [
     '../GenericModule.cpp',
     '../nsStringAPI.cpp',
 ]
 
 LIBRARY_NAME = 'xpcomglue_s_nomozalloc'
 
-SDK_LIBRARY = [
-    "%s%s.%s" % (CONFIG['LIB_PREFIX'], 'xpcomglue_s_nomozalloc', CONFIG['LIB_SUFFIX']),
-]
+SDK_LIBRARY = True
 
 # we don't want the shared lib, but we want to force the creation of a static lib.
 FORCE_STATIC_LIB = True
 
 if CONFIG['_MSC_VER']:
     DEFINES['_USE_ANSI_CPP'] = True
     # Don't include directives about which CRT to use
     CFLAGS += ['-Zl']
--- a/xpcom/glue/standalone/moz.build
+++ b/xpcom/glue/standalone/moz.build
@@ -19,19 +19,17 @@ SOURCES += [
 ]
 
 LIBRARY_NAME = 'xpcomglue'
 
 EXPORTS += [
     'nsXPCOMGlue.h',
 ]
 
-SDK_LIBRARY = [
-    "%s%s.%s" % (CONFIG['LIB_PREFIX'], 'xpcomglue', CONFIG['LIB_SUFFIX']),
-]
+SDK_LIBRARY = True
 
 FORCE_STATIC_LIB = True
 
 if CONFIG['_MSC_VER']:
     DEFINES['_USE_ANSI_CPP'] = True
     # Don't include directives about which CRT to use
     CFLAGS += ['-Zl']
     CXXFLAGS += ['-Zl']
--- a/xpcom/glue/standalone/staticruntime/moz.build
+++ b/xpcom/glue/standalone/staticruntime/moz.build
@@ -10,19 +10,17 @@ SOURCES += xpcom_glue_src_cppsrcs
 
 SOURCES += [
     '../../nsStringAPI.cpp',
     '../nsXPCOMGlue.cpp',
 ]
 
 LIBRARY_NAME = 'xpcomglue_staticruntime'
 
-SDK_LIBRARY = [
-    "%s%s.%s" % (CONFIG['LIB_PREFIX'], 'xpcomglue_staticruntime', CONFIG['LIB_SUFFIX']),
-]
+SDK_LIBRARY = True
 
 # create a static lib
 FORCE_STATIC_LIB = True
 
 if CONFIG['_MSC_VER']:
     DEFINES['_USE_ANSI_CPP'] = True
     # Don't include directives about which CRT to use
     CFLAGS += ['-Zl']
--- a/xpcom/glue/staticruntime/moz.build
+++ b/xpcom/glue/staticruntime/moz.build
@@ -11,19 +11,17 @@ UNIFIED_SOURCES += xpcom_glue_src_cppsrc
 
 UNIFIED_SOURCES += [
     '../GenericModule.cpp',
     '../nsStringAPI.cpp',
 ]
 
 LIBRARY_NAME = 'xpcomglue_staticruntime_s'
 
-SDK_LIBRARY = [
-    "%s%s.%s" % (CONFIG['LIB_PREFIX'], 'xpcomglue_staticruntime_s', CONFIG['LIB_SUFFIX']),
-]
+SDK_LIBRARY = True
 
 FORCE_STATIC_LIB = True
 
 if CONFIG['_MSC_VER']:
     DEFINES['_USE_ANSI_CPP'] = True
     # Don't include directives about which CRT to use
     CFLAGS += ['-Zl']
     CXXFLAGS += ['-Zl']
--- a/xpcom/tests/bug656331_component/moz.build
+++ b/xpcom/tests/bug656331_component/moz.build
@@ -9,15 +9,13 @@ NO_DIST_INSTALL = True
 SOURCES += [
     'TestComponent.cpp',
 ]
 
 LIBRARY_NAME = 'test656331'
 
 IS_COMPONENT = True
 
-FORCE_SHARED_LIB = True
-
 DEFINES['LIBRARY_FILENAME'] = '%s%s%s' % (
     CONFIG['DLL_PREFIX'],
     LIBRARY_NAME,
     CONFIG['DLL_SUFFIX']
 )
--- a/xpcom/tests/component/moz.build
+++ b/xpcom/tests/component/moz.build
@@ -9,15 +9,13 @@ NO_DIST_INSTALL = True
 SOURCES += [
     'TestComponent.cpp',
 ]
 
 LIBRARY_NAME = 'testcomponent'
 
 IS_COMPONENT = True
 
-FORCE_SHARED_LIB = True
-
 DEFINES['LIBRARY_FILENAME'] = '%s%s%s' % (
     CONFIG['DLL_PREFIX'],
     LIBRARY_NAME,
     CONFIG['DLL_SUFFIX']
 )
--- a/xpcom/tests/component_no_aslr/moz.build
+++ b/xpcom/tests/component_no_aslr/moz.build
@@ -9,15 +9,13 @@ NO_DIST_INSTALL = True
 SOURCES += [
     'TestComponent.cpp',
 ]
 
 LIBRARY_NAME = 'testcompnoaslr'
 
 IS_COMPONENT = True
 
-FORCE_SHARED_LIB = True
-
 DEFINES['LIBRARY_FILENAME'] = '%s%s%s' % (
     CONFIG['DLL_PREFIX'],
     LIBRARY_NAME,
     CONFIG['DLL_SUFFIX']
 )