Bug 1629553 Rework the LIBRARY_NAME ruleset r=rrelyea
authorJan-Marek Glogowski <glogow@fbihome.de>
Tue, 05 May 2020 12:30:24 +0000
changeset 15601 877d721d93cdb151eb0ded41a1dc6de9e94ecad6
parent 15600 9b628d9c57e5c490a5bcc90005f13f366026ebb6
child 15602 dc1ef0faf4a6ca181486b6fe45bf63cd01e166bf
push id3740
push userjjones@mozilla.com
push dateMon, 11 May 2020 21:08:39 +0000
reviewersrrelyea
bugs1629553
Bug 1629553 Rework the LIBRARY_NAME ruleset r=rrelyea * Drop the WIN% "32" default DLL suffix * Add default resource file handling => drop default RES * Generate IMPORT_LIBRARY based on IMPORT_LIB_SUFFIX and SHARED_LIBRARY, so we can drop all the explicit empty IMPORT_LIBRARY lines Originally this patch also tried to add a default MAPFILE rule, but this fails, because the ARCH makefiles set linker flags based on an existing MAPFILE variable. Differential Revision: https://phabricator.services.mozilla.com/D70369
cmd/libpkix/testutil/config.mk
coreconf/OS2.mk
coreconf/WIN32.mk
coreconf/ruleset.mk
coreconf/suffix.mk
gtests/common/Makefile
gtests/common/manifest.mn
gtests/google_test/Makefile
gtests/google_test/manifest.mn
gtests/pkcs11testmodule/Makefile
gtests/pkcs11testmodule/config.mk
gtests/pkcs11testmodule/manifest.mn
lib/ckfw/builtins/config.mk
lib/ckfw/builtins/manifest.mn
lib/ckfw/builtins/testlib/config.mk
lib/ckfw/capi/config.mk
lib/ckfw/capi/manifest.mn
lib/freebl/config.mk
lib/nss/config.mk
lib/nss/manifest.mn
lib/smime/config.mk
lib/smime/manifest.mn
lib/softoken/config.mk
lib/softoken/legacydb/config.mk
lib/softoken/legacydb/manifest.mn
lib/softoken/manifest.mn
lib/sqlite/config.mk
lib/sqlite/manifest.mn
lib/ssl/config.mk
lib/ssl/manifest.mn
lib/sysinit/config.mk
lib/sysinit/manifest.mn
lib/util/config.mk
lib/util/manifest.mn
--- a/cmd/libpkix/testutil/config.mk
+++ b/cmd/libpkix/testutil/config.mk
@@ -1,15 +1,8 @@
 # 
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 # don't build the static library
 LIBRARY =
-
-ifeq (,$(filter-out WIN%,$(OS_TARGET)))
-
-# don't want the 32 in the shared library name
-SHARED_LIBRARY = $(OBJDIR)/$(DLL_PREFIX)$(LIBRARY_NAME)$(LIBRARY_VERSION).$(DLL_SUFFIX)
-IMPORT_LIBRARY = $(OBJDIR)/$(IMPORT_LIB_PREFIX)$(LIBRARY_NAME)$(LIBRARY_VERSION)$(IMPORT_LIB_SUFFIX)
-
-endif
+RES =
--- a/coreconf/OS2.mk
+++ b/coreconf/OS2.mk
@@ -135,20 +135,19 @@ endef
 #
 # override the definition of DLL_PREFIX in prefix.mk
 #
 
 ifndef DLL_PREFIX
     DLL_PREFIX = $(NULL)
 endif
 
+ifndef IMPORT_LIB_SUFFIX
+    IMPORT_LIB_SUFFIX = .$(LIB_SUFFIX)
+endif
+
 #
 # override the TARGETS defined in ruleset.mk, adding IMPORT_LIBRARY
 #
 ifndef TARGETS
     TARGETS = $(LIBRARY) $(SHARED_LIBRARY) $(IMPORT_LIBRARY) $(PROGRAM)
 endif
 
-
-ifdef LIBRARY_NAME
-    IMPORT_LIBRARY = $(OBJDIR)/$(LIBRARY_NAME)$(LIBRARY_VERSION)$(JDK_DEBUG_SUFFIX).lib
-endif
-
--- a/coreconf/WIN32.mk
+++ b/coreconf/WIN32.mk
@@ -360,22 +360,13 @@ endif
 # When the processor is NOT 386-based on Windows NT, override the
 # value of $(CPU_TAG).  For WinNT, 95, 16, not CE.
 #
 ifneq ($(CPU_ARCH),x386)
     CPU_TAG = _$(CPU_ARCH)
 endif
 
 #
-# override ruleset.mk, removing the "lib" prefix for library names, and
-# adding the "32" after the LIBRARY_VERSION.
-#
-ifdef LIBRARY_NAME
-    SHARED_LIBRARY = $(OBJDIR)/$(LIBRARY_NAME)$(LIBRARY_VERSION)32$(JDK_DEBUG_SUFFIX).dll
-    IMPORT_LIBRARY = $(OBJDIR)/$(LIBRARY_NAME)$(LIBRARY_VERSION)32$(JDK_DEBUG_SUFFIX).lib
-endif
-
-#
 # override the TARGETS defined in ruleset.mk, adding IMPORT_LIBRARY
 #
 ifndef TARGETS
     TARGETS = $(LIBRARY) $(SHARED_LIBRARY) $(IMPORT_LIBRARY) $(PROGRAM)
 endif
--- a/coreconf/ruleset.mk
+++ b/coreconf/ruleset.mk
@@ -74,30 +74,64 @@ endif
 #
 # This makefile contains rules for building the following kinds of
 # objects:
 # - (1) LIBRARY: a static (archival) library
 # - (2) SHARED_LIBRARY: a shared (dynamic link) library
 # - (3) IMPORT_LIBRARY: an import library, defined in $(OS_TARGET).mk
 # - (4) PROGRAM: an executable binary
 #
-# NOTE:  The names of libraries can be generated by simply specifying
-# LIBRARY_NAME (and LIBRARY_VERSION in the case of non-static libraries).
-# LIBRARY and SHARED_LIBRARY may be defined differently in $(OS_TARGET).mk
+# A library is build by specifying the LIBRARY_NAME variable.
+# If you want to build only a static library, set SHARED_LIBRARY = $(NULL)
+# If you want to build only a shared library, set LIBRARY = $(NULL)
+# You can specify the shared library major version via LIBRARY_VERSION.
 #
+# Normally you want to link to the shared library. In this case you must
+# provide an export script, like:
+#   MAPFILE = $(OBJDIR)/$(LIBRARY_NAME).def.
+# Unfortunatly this variable is needed by the ARCH setup, so you have to set
+# it explicitly in the manifest.mn.
+#
+# Per default, it's assumed the shared library provides resource specification
+# in the file RES. You can set it to $(NULL), if that is not true.
+#
+# If you have an unversioned SHARED_LIBRARY, you must explicitly change or
+# disable the static LIBRARY, as these normally clash on Windows.
 
 ifdef LIBRARY_NAME
     ifndef LIBRARY
-	LIBRARY        = $(OBJDIR)/$(LIB_PREFIX)$(LIBRARY_NAME).$(LIB_SUFFIX)
+	LIBRARY := $(OBJDIR)/$(LIB_PREFIX)$(LIBRARY_NAME).$(LIB_SUFFIX)
     endif
     ifndef SHARED_LIBRARY
-	SHARED_LIBRARY = $(OBJDIR)/$(DLL_PREFIX)$(LIBRARY_NAME)$(LIBRARY_VERSION)$(JDK_DEBUG_SUFFIX).$(DLL_SUFFIX)
+	SHARED_LIBRARY := $(OBJDIR)/$(DLL_PREFIX)$(LIBRARY_NAME)$(LIBRARY_VERSION)$(JDK_DEBUG_SUFFIX).$(DLL_SUFFIX)
+    endif
+
+    ifneq ($(SHARED_LIBRARY),)
+
+    ifdef IMPORT_LIB_SUFFIX
+    ifdef MAPFILE
+    ifndef IMPORT_LIBRARY
+	IMPORT_LIBRARY := $(OBJDIR)/$(IMPORT_LIB_PREFIX)$(LIBRARY_NAME)$(LIBRARY_VERSION)$(JDK_DEBUG_SUFFIX)$(IMPORT_LIB_SUFFIX)
+    endif
+    endif
     endif
+
     ifndef MAPFILE_SOURCE
-	MAPFILE_SOURCE = $(LIBRARY_NAME).def
+	MAPFILE_SOURCE := $(LIBRARY_NAME).def
+    endif
+
+    ifeq (,$(filter-out WIN%,$(OS_TARGET)))
+    ifndef RES
+	RES := $(OBJDIR)/$(LIBRARY_NAME).res
+    endif
+    ifndef RESNAME
+	RESNAME := $(LIBRARY_NAME).rc
+    endif
+    endif
+
     endif
 endif
 
 #
 # Common rules used by lots of makefiles...
 #
 
 ifdef PROGRAM
--- a/coreconf/suffix.mk
+++ b/coreconf/suffix.mk
@@ -35,21 +35,16 @@ ifndef STATIC_LIB_SUFFIX
     STATIC_LIB_SUFFIX = .$(LIB_SUFFIX)
 endif
 
 
 ifndef DYNAMIC_LIB_SUFFIX
     DYNAMIC_LIB_SUFFIX = .$(DLL_SUFFIX)
 endif
 
-# WIN% overridese this
-ifndef IMPORT_LIB_SUFFIX
-    IMPORT_LIB_SUFFIX = 
-endif
-
 
 ifndef STATIC_LIB_SUFFIX_FOR_LINKING
     STATIC_LIB_SUFFIX_FOR_LINKING = $(STATIC_LIB_SUFFIX)
 endif
 
 
 # WIN% overridese this
 ifndef DYNAMIC_LIB_SUFFIX_FOR_LINKING
--- a/gtests/common/Makefile
+++ b/gtests/common/Makefile
@@ -15,18 +15,16 @@ include manifest.mn
 #######################################################################
 
 include $(CORE_DEPTH)/coreconf/config.mk
 
 #######################################################################
 # (3) Include "component" configuration information. (OPTIONAL)       #
 #######################################################################
 
-SHARED_LIBRARY = $(NULL)
-IMPORT_LIBRARY = $(NULL)
 
 #######################################################################
 # (4) Include "local" platform-dependent assignments (OPTIONAL).      #
 #######################################################################
 
 include gtest.mk
 
 #######################################################################
--- a/gtests/common/manifest.mn
+++ b/gtests/common/manifest.mn
@@ -2,16 +2,17 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 CORE_DEPTH = ../..
 DEPTH      = ../..
 MODULE = nss
 
 LIBRARY_NAME = gtestutil
+SHARED_LIBRARY = $(NULL)
 
 ifeq ($(NSS_BUILD_UTIL_ONLY),1)
 CPPSRCS = gtests-util.cc
 else
 CPPSRCS = gtests.cc
 endif
 
 INCLUDES += -I$(CORE_DEPTH)/gtests/google_test/gtest/include \
--- a/gtests/google_test/Makefile
+++ b/gtests/google_test/Makefile
@@ -15,18 +15,16 @@ include manifest.mn
 #######################################################################
 
 include $(CORE_DEPTH)/coreconf/config.mk
 
 #######################################################################
 # (3) Include "component" configuration information. (OPTIONAL)       #
 #######################################################################
 
-SHARED_LIBRARY = $(NULL)
-IMPORT_LIBRARY = $(NULL)
 
 #######################################################################
 # (4) Include "local" platform-dependent assignments (OPTIONAL).      #
 #######################################################################
 
 include ../common/gtest.mk
 
 #######################################################################
--- a/gtests/google_test/manifest.mn
+++ b/gtests/google_test/manifest.mn
@@ -3,14 +3,15 @@
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 CORE_DEPTH = ../..
 DEPTH = ../..
 
 MODULE = gtest
 
 LIBRARY_NAME = gtest
+SHARED_LIBRARY = $(NULL)
 
 INCLUDES += -Igtest/include/ -Igtest
 
 CPPSRCS = \
 	gtest/src/gtest-all.cc \
 	$(NULL)
--- a/gtests/pkcs11testmodule/Makefile
+++ b/gtests/pkcs11testmodule/Makefile
@@ -15,24 +15,21 @@ include manifest.mn
 #######################################################################
 
 include $(CORE_DEPTH)/coreconf/config.mk
 
 #######################################################################
 # (3) Include "component" configuration information. (OPTIONAL)       #
 #######################################################################
 
-LIBRARY = $(NULL)
-IMPORT_LIBRARY = $(NULL)
 
 #######################################################################
 # (4) Include "local" platform-dependent assignments (OPTIONAL).      #
 #######################################################################
 
-include config.mk
 
 #######################################################################
 # (5) Execute "global" rules. (OPTIONAL)                              #
 #######################################################################
 
 include $(CORE_DEPTH)/coreconf/rules.mk
 
 #######################################################################
deleted file mode 100644
--- a/gtests/pkcs11testmodule/config.mk
+++ /dev/null
@@ -1,16 +0,0 @@
-#
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-# can't do this in manifest.mn because OS_TARGET isn't defined there.
-ifeq (,$(filter-out WIN%,$(OS_TARGET)))
-
-# don't want the 32 in the shared library name
-SHARED_LIBRARY = $(OBJDIR)/$(DLL_PREFIX)$(LIBRARY_NAME)$(LIBRARY_VERSION).$(DLL_SUFFIX)
-IMPORT_LIBRARY = $(OBJDIR)/$(IMPORT_LIB_PREFIX)$(LIBRARY_NAME)$(LIBRARY_VERSION)$(IMPORT_LIB_SUFFIX)
-
-RES = $(OBJDIR)/$(LIBRARY_NAME).res
-RESNAME = $(LIBRARY_NAME).rc
-
-endif
--- a/gtests/pkcs11testmodule/manifest.mn
+++ b/gtests/pkcs11testmodule/manifest.mn
@@ -9,14 +9,15 @@ MODULE = nss
 CPPSRCS = \
       pkcs11testmodule.cpp \
       $(NULL)
 
 INCLUDES += -I$(CORE_DEPTH)/cpputil
 
 REQUIRES = cpputil
 
-MAPFILE = $(OBJDIR)/pkcs11testmodule.def
-
 LIBRARY_NAME = pkcs11testmodule
+MAPFILE = $(OBJDIR)/$(LIBRARY_NAME).def
+LIBRARY = $(NULL)
+IMPORT_LIBRARY = $(NULL)
 
 EXTRA_LIBS = $(DIST)/lib/$(LIB_PREFIX)cpputil.$(LIB_SUFFIX) \
              $(NULL)
--- a/lib/ckfw/builtins/config.mk
+++ b/lib/ckfw/builtins/config.mk
@@ -8,22 +8,16 @@
 #  are specifed as dependencies within rules.mk.
 #
 
 TARGETS        = $(SHARED_LIBRARY)
 LIBRARY        =
 IMPORT_LIBRARY =
 PROGRAM        =
 
-ifeq (,$(filter-out WIN%,$(OS_TARGET)))
-    SHARED_LIBRARY = $(OBJDIR)/$(DLL_PREFIX)$(LIBRARY_NAME)$(LIBRARY_VERSION).$(DLL_SUFFIX)
-    RES = $(OBJDIR)/$(LIBRARY_NAME).res
-    RESNAME = $(LIBRARY_NAME).rc
-endif
-
 ifdef BUILD_IDG
     DEFINES += -DNSSDEBUG
 endif
 
 # Needed for compilation of $(OBJDIR)/certdata.c
 INCLUDES += -I.
 
 #
--- a/lib/ckfw/builtins/manifest.mn
+++ b/lib/ckfw/builtins/manifest.mn
@@ -3,17 +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/.
 
 CORE_DEPTH = ../../..
 
 DIRS = testlib
 
 MODULE = nss
-MAPFILE = $(OBJDIR)/nssckbi.def
 
 EXPORTS =		\
 	nssckbi.h	\
 	$(NULL)
 
 CSRCS =			\
 	anchor.c	\
 	constants.c	\
@@ -25,8 +24,9 @@ CSRCS =			\
 	btoken.c	\
 	certdata.c	\
 	ckbiver.c	\
 	$(NULL)
 
 REQUIRES = nspr
 
 LIBRARY_NAME = nssckbi
+MAPFILE = $(OBJDIR)/$(LIBRARY_NAME).def
--- a/lib/ckfw/builtins/testlib/config.mk
+++ b/lib/ckfw/builtins/testlib/config.mk
@@ -8,22 +8,16 @@
 #  are specifed as dependencies within rules.mk.
 #
 
 TARGETS        = $(SHARED_LIBRARY)
 LIBRARY        =
 IMPORT_LIBRARY =
 PROGRAM        =
 
-ifeq (,$(filter-out WIN%,$(OS_TARGET)))
-	SHARED_LIBRARY = $(OBJDIR)/$(DLL_PREFIX)$(LIBRARY_NAME)$(LIBRARY_VERSION).$(DLL_SUFFIX)
-	RES = $(OBJDIR)/$(LIBRARY_NAME).res
-	RESNAME = $(LIBRARY_NAME).rc
-endif
-
 ifdef BUILD_IDG
 	DEFINES += -DNSSDEBUG
 endif
 
 # Needed for compilation of $(OBJDIR)/certdata.c
 INCLUDES += -I.
 
 #
--- a/lib/ckfw/capi/config.mk
+++ b/lib/ckfw/capi/config.mk
@@ -8,22 +8,16 @@
 #  are specifed as dependencies within rules.mk.
 #
 
 TARGETS        = $(SHARED_LIBRARY)
 LIBRARY        =
 IMPORT_LIBRARY =
 PROGRAM        =
 
-ifeq (,$(filter-out WIN%,$(OS_TARGET)))
-    SHARED_LIBRARY = $(OBJDIR)/$(DLL_PREFIX)$(LIBRARY_NAME)$(LIBRARY_VERSION).$(DLL_SUFFIX)
-    RES = $(OBJDIR)/$(LIBRARY_NAME).res
-    RESNAME = $(LIBRARY_NAME).rc
-endif
-
 ifdef BUILD_IDG
     DEFINES += -DNSSDEBUG
 endif
 
 #
 # To create a loadable module on Darwin, we must use -bundle.
 #
 ifeq ($(OS_TARGET),Darwin)
--- a/lib/ckfw/capi/manifest.mn
+++ b/lib/ckfw/capi/manifest.mn
@@ -1,17 +1,16 @@
 # 
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 CORE_DEPTH = ../../../..
 
 MODULE = nss
-MAPFILE = $(OBJDIR)/nsscapi.def
 
 EXPORTS =		\
 	nsscapi.h	\
 	$(NULL)
 
 CSRCS =			\
 	anchor.c	\
 	constants.c	\
@@ -24,10 +23,11 @@ CSRCS =			\
 	ctoken.c	\
 	ckcapiver.c	\
 	staticobj.c	\
 	$(NULL)
 
 REQUIRES = nspr
 
 LIBRARY_NAME = nsscapi
+MAPFILE = $(OBJDIR)/$(LIBRARY_NAME).def
 
 #EXTRA_SHARED_LIBS = -L$(DIST)/lib -lnssckfw -lnssb -lplc4 -lplds4
--- a/lib/freebl/config.mk
+++ b/lib/freebl/config.mk
@@ -42,20 +42,16 @@ IMPORT_LIBRARY =
 PROGRAM      =
 
 ifeq ($(OS_TARGET), SunOS)
 OS_LIBS += -lkstat
 endif
 
 ifeq (,$(filter-out WIN%,$(OS_TARGET)))
 
-# don't want the 32 in the shared library name
-SHARED_LIBRARY = $(OBJDIR)/$(DLL_PREFIX)$(LIBRARY_NAME)$(LIBRARY_VERSION).$(DLL_SUFFIX)
-
-RES     = $(OBJDIR)/$(LIBRARY_NAME).res
 RESNAME = freebl.rc
 
 ifdef NS_USE_GCC
 OS_LIBS += -ladvapi32
 else
 OS_LIBS += advapi32.lib
 endif
 
--- a/lib/nss/config.mk
+++ b/lib/nss/config.mk
@@ -1,23 +1,16 @@
 #
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 # can't do this in manifest.mn because OS_TARGET isn't defined there.
 ifeq (,$(filter-out WIN%,$(OS_TARGET)))
 
-# don't want the 32 in the shared library name
-SHARED_LIBRARY = $(OBJDIR)/$(DLL_PREFIX)$(LIBRARY_NAME)$(LIBRARY_VERSION).$(DLL_SUFFIX)
-IMPORT_LIBRARY = $(OBJDIR)/$(IMPORT_LIB_PREFIX)$(LIBRARY_NAME)$(LIBRARY_VERSION)$(IMPORT_LIB_SUFFIX)
-
-RES = $(OBJDIR)/$(LIBRARY_NAME).res
-RESNAME = $(LIBRARY_NAME).rc
-
 ifdef NS_USE_GCC
 EXTRA_SHARED_LIBS += \
 	-L$(DIST)/lib \
 	-L$(NSSUTIL_LIB_DIR) \
 	-lnssutil3 \
 	-L$(NSPR_LIB_DIR) \
 	-lplc4 \
 	-lplds4 \
--- a/lib/nss/manifest.mn
+++ b/lib/nss/manifest.mn
@@ -17,15 +17,14 @@ MODULE = nss
 
 CSRCS = \
 	nssinit.c \
 	nssoptions.c \
 	nssver.c \
 	utilwrap.c \
 	$(NULL)
 
-MAPFILE = $(OBJDIR)/nss.def
-
 LIBRARY_NAME = nss
 LIBRARY_VERSION = 3
+MAPFILE = $(OBJDIR)/$(LIBRARY_NAME).def
 
 # This part of the code, including all sub-dirs, can be optimized for size
 export ALLOW_OPT_CODE_SIZE = 1
--- a/lib/smime/config.mk
+++ b/lib/smime/config.mk
@@ -2,23 +2,16 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 RELEASE_LIBS = $(TARGETS)
 
 ifeq (,$(filter-out WIN%,$(OS_TARGET)))
 
-# don't want the 32 in the shared library name
-SHARED_LIBRARY = $(OBJDIR)/$(DLL_PREFIX)$(LIBRARY_NAME)$(LIBRARY_VERSION).$(DLL_SUFFIX)
-IMPORT_LIBRARY = $(OBJDIR)/$(IMPORT_LIB_PREFIX)$(LIBRARY_NAME)$(LIBRARY_VERSION)$(IMPORT_LIB_SUFFIX)
-
-RES = $(OBJDIR)/smime.res
-RESNAME = smime.rc
-
 ifdef NS_USE_GCC
 EXTRA_SHARED_LIBS += \
 	-L$(DIST)/lib \
 	-lnss3 \
 	-L$(NSSUTIL_LIB_DIR) \
 	-lnssutil3 \
 	-L$(NSPR_LIB_DIR) \
 	-lplc4 \
--- a/lib/smime/manifest.mn
+++ b/lib/smime/manifest.mn
@@ -12,17 +12,16 @@ EXPORTS = \
 	cmsreclist.h \
 	$(NULL)
 
 PRIVATE_EXPORTS = \
 	cmslocal.h \
 	$(NULL)
 
 MODULE = nss
-MAPFILE = $(OBJDIR)/smime.def
 
 CSRCS = \
 	cmsarray.c \
 	cmsasn1.c \
 	cmsattr.c \
 	cmscinfo.c \
 	cmscipher.c \
 	cmsdecode.c \
@@ -41,11 +40,12 @@ CSRCS = \
 	cmsutil.c \
 	smimemessage.c \
 	smimeutil.c \
 	smimever.c \
 	$(NULL)
 
 LIBRARY_NAME = smime
 LIBRARY_VERSION = 3
+MAPFILE = $(OBJDIR)/$(LIBRARY_NAME).def
 
 # This part of the code, including all sub-dirs, can be optimized for size
 export ALLOW_OPT_CODE_SIZE = 1
--- a/lib/softoken/config.mk
+++ b/lib/softoken/config.mk
@@ -8,23 +8,16 @@ CRYPTOLIB=$(DIST)/lib/$(LIB_PREFIX)freeb
 
 EXTRA_LIBS += \
 	$(CRYPTOLIB) \
 	$(NULL)
 
 # can't do this in manifest.mn because OS_TARGET isn't defined there.
 ifeq (,$(filter-out WIN%,$(OS_TARGET)))
 
-# don't want the 32 in the shared library name
-SHARED_LIBRARY = $(OBJDIR)/$(DLL_PREFIX)$(LIBRARY_NAME)$(LIBRARY_VERSION).$(DLL_SUFFIX)
-IMPORT_LIBRARY = $(OBJDIR)/$(IMPORT_LIB_PREFIX)$(LIBRARY_NAME)$(LIBRARY_VERSION)$(IMPORT_LIB_SUFFIX)
-
-RES = $(OBJDIR)/$(LIBRARY_NAME).res
-RESNAME = $(LIBRARY_NAME).rc
-
 ifdef NS_USE_GCC
 EXTRA_SHARED_LIBS += \
 	-L$(SQLITE_LIB_DIR) \
 	-l$(SQLITE_LIB_NAME) \
 	-L$(NSSUTIL_LIB_DIR) \
 	-lnssutil3 \
 	-L$(NSPR_LIB_DIR) \
 	-lplc4 \
--- a/lib/softoken/legacydb/config.mk
+++ b/lib/softoken/legacydb/config.mk
@@ -9,23 +9,16 @@ CRYPTOLIB=$(DIST)/lib/$(LIB_PREFIX)freeb
 EXTRA_LIBS += \
 	$(CRYPTOLIB) \
 	$(DIST)/lib/$(LIB_PREFIX)dbm.$(LIB_SUFFIX) \
 	$(NULL)
 
 # can't do this in manifest.mn because OS_TARGET isn't defined there.
 ifeq (,$(filter-out WIN%,$(OS_TARGET)))
 
-# don't want the 32 in the shared library name
-SHARED_LIBRARY = $(OBJDIR)/$(DLL_PREFIX)$(LIBRARY_NAME)$(LIBRARY_VERSION).$(DLL_SUFFIX)
-IMPORT_LIBRARY = $(OBJDIR)/$(IMPORT_LIB_PREFIX)$(LIBRARY_NAME)$(LIBRARY_VERSION)$(IMPORT_LIB_SUFFIX)
-
-RES = $(OBJDIR)/$(LIBRARY_NAME).res
-RESNAME = $(LIBRARY_NAME).rc
-
 ifdef NS_USE_GCC
 EXTRA_SHARED_LIBS += \
 	-L$(DIST)/lib \
 	-L$(NSSUTIL_LIB_DIR) \
 	-lnssutil3 \
 	-L$(NSPR_LIB_DIR) \
 	-lplc4 \
 	-lplds4 \
--- a/lib/softoken/legacydb/manifest.mn
+++ b/lib/softoken/legacydb/manifest.mn
@@ -5,17 +5,17 @@
 CORE_DEPTH = ../../..
 
 MODULE = nss
 
 REQUIRES = dbm
 
 LIBRARY_NAME = nssdbm
 LIBRARY_VERSION = 3
-MAPFILE = $(OBJDIR)/nssdbm.def
+MAPFILE = $(OBJDIR)/$(LIBRARY_NAME).def
 
 DEFINES += -DSHLIB_SUFFIX=\"$(DLL_SUFFIX)\" -DSHLIB_PREFIX=\"$(DLL_PREFIX)\" -DLG_LIB_NAME=\"$(notdir $(SHARED_LIBRARY))\"
 
 CSRCS = \
 	dbmshim.c \
 	keydb.c \
 	lgattr.c \
 	lgcreate.c \
--- a/lib/softoken/manifest.mn
+++ b/lib/softoken/manifest.mn
@@ -4,17 +4,17 @@
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 CORE_DEPTH = ../..
 
 MODULE = nss
 DIRS = legacydb
 
 LIBRARY_NAME = softokn
 LIBRARY_VERSION = 3
-MAPFILE = $(OBJDIR)/softokn.def
+MAPFILE = $(OBJDIR)/$(LIBRARY_NAME).def
 
 DEFINES += -DSHLIB_SUFFIX=\"$(DLL_SUFFIX)\" -DSHLIB_PREFIX=\"$(DLL_PREFIX)\" -DSOFTOKEN_LIB_NAME=\"$(notdir $(SHARED_LIBRARY))\" -DSHLIB_VERSION=\"$(LIBRARY_VERSION)\"
 
 ifdef SQLITE_INCLUDE_DIR
 INCLUDES += -I$(SQLITE_INCLUDE_DIR)
 endif
 
 EXPORTS = \
--- a/lib/sqlite/config.mk
+++ b/lib/sqlite/config.mk
@@ -1,25 +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/.
 
-
-# can't do this in manifest.mn because OS_TARGET isn't defined there.
-ifeq (,$(filter-out WIN%,$(OS_TARGET)))
-
-# don't want the 32 in the shared library name
-SHARED_LIBRARY = $(OBJDIR)/$(DLL_PREFIX)$(LIBRARY_NAME)$(LIBRARY_VERSION).$(DLL_SUFFIX)
-IMPORT_LIBRARY = $(OBJDIR)/$(IMPORT_LIB_PREFIX)$(LIBRARY_NAME)$(LIBRARY_VERSION)$(IMPORT_LIB_SUFFIX)
-
-#RES = $(OBJDIR)/$(LIBRARY_NAME).res
-#RESNAME = $(LIBRARY_NAME).rc
-endif
-
 ifeq ($(OS_TARGET),AIX)
 EXTRA_LIBS += -lpthreads
 ifdef BUILD_OPT
 OPTIMIZER=
 endif
 endif
 
 ifeq ($(OS_TARGET),Darwin)
--- a/lib/sqlite/manifest.mn
+++ b/lib/sqlite/manifest.mn
@@ -3,17 +3,19 @@
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 CORE_DEPTH = ../..
 
 MODULE = nss
 
 LIBRARY_NAME = sqlite
 LIBRARY_VERSION = 3
-MAPFILE = $(OBJDIR)/sqlite.def
+MAPFILE = $(OBJDIR)/$(LIBRARY_NAME).def
+RES = $(NULL)
+
 DEFINES += -DSQLITE_THREADSAFE=1
 
 PRIVATE_EXPORTS = \
 	sqlite3.h \
 	$(NULL)
 
 CSRCS = \
 	sqlite3.c \
--- a/lib/ssl/config.mk
+++ b/lib/ssl/config.mk
@@ -4,23 +4,16 @@
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 ifdef NISCC_TEST
 DEFINES += -DNISCC_TEST
 endif
 
 ifeq (,$(filter-out WIN%,$(OS_TARGET)))
 
-# don't want the 32 in the shared library name
-SHARED_LIBRARY = $(OBJDIR)/$(DLL_PREFIX)$(LIBRARY_NAME)$(LIBRARY_VERSION).$(DLL_SUFFIX)
-IMPORT_LIBRARY = $(OBJDIR)/$(IMPORT_LIB_PREFIX)$(LIBRARY_NAME)$(LIBRARY_VERSION)$(IMPORT_LIB_SUFFIX)
-
-RES = $(OBJDIR)/ssl.res
-RESNAME = ssl.rc
-
 ifdef NS_USE_GCC
 EXTRA_SHARED_LIBS += \
 	-L$(DIST)/lib \
 	-lnss3 \
 	-L$(NSSUTIL_LIB_DIR) \
 	-lnssutil3 \
 	-L$(NSPR_LIB_DIR) \
 	-lplc4 \
--- a/lib/ssl/manifest.mn
+++ b/lib/ssl/manifest.mn
@@ -14,17 +14,16 @@ EXPORTS = \
         sslt.h \
         sslerr.h \
         sslexp.h \
         sslproto.h \
         preenc.h \
         $(NULL)
 
 MODULE = nss
-MAPFILE = $(OBJDIR)/ssl.def
 
 CSRCS = \
         dtlscon.c \
         dtls13con.c \
         prelib.c \
         ssl3con.c \
         ssl3gthr.c \
         sslauth.c \
@@ -61,11 +60,12 @@ CSRCS = \
         sslgrp.c \
         sslprimitive.c \
         tls13esni.c \
         tls13subcerts.c \
         $(NULL)
 
 LIBRARY_NAME = ssl
 LIBRARY_VERSION = 3
+MAPFILE = $(OBJDIR)/$(LIBRARY_NAME).def
 
 # This part of the code, including all sub-dirs, can be optimized for size
 export ALLOW_OPT_CODE_SIZE = 1
--- a/lib/sysinit/config.mk
+++ b/lib/sysinit/config.mk
@@ -6,23 +6,16 @@
 #
 #  Override TARGETS variable so that only static libraries
 #  are specifed as dependencies within rules.mk.
 #
 
 # can't do this in manifest.mn because OS_TARGET isn't defined there.
 ifeq (,$(filter-out WIN%,$(OS_TARGET)))
 
-# don't want the 32 in the shared library name
-SHARED_LIBRARY = $(OBJDIR)/$(DLL_PREFIX)$(LIBRARY_NAME)$(LIBRARY_VERSION).$(DLL_SUFFIX)
-IMPORT_LIBRARY = $(OBJDIR)/$(IMPORT_LIB_PREFIX)$(LIBRARY_NAME)$(LIBRARY_VERSION)$(IMPORT_LIB_SUFFIX)
-
-RES = $(OBJDIR)/$(LIBRARY_NAME).res
-RESNAME = $(LIBRARY_NAME).rc
-
 ifdef NS_USE_GCC
 EXTRA_SHARED_LIBS += \
 	-L$(DIST)/lib \
 	-L$(NSSUTIL_LIB_DIR) \
 	-lnssutil3 \
 	-L$(NSPR_LIB_DIR) \
 	-lplc4 \
 	-lplds4 \
--- a/lib/sysinit/manifest.mn
+++ b/lib/sysinit/manifest.mn
@@ -6,12 +6,12 @@ CORE_DEPTH = ../..
 
 MODULE = nss 
 
 CSRCS = \
       nsssysinit.c \
       $(NULL)
 
 LIBRARY_NAME = nsssysinit
-MAPFILE = $(OBJDIR)/nsssysinit.def
+MAPFILE = $(OBJDIR)/$(LIBRARY_NAME).def
 
 # This part of the code, including all sub-dirs, can be optimized for size
 export ALLOW_OPT_CODE_SIZE = 1
--- a/lib/util/config.mk
+++ b/lib/util/config.mk
@@ -1,23 +1,16 @@
 #
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 # can't do this in manifest.mn because OS_TARGET isn't defined there.
 ifeq (,$(filter-out WIN%,$(OS_TARGET)))
 
-# don't want the 32 in the shared library name
-SHARED_LIBRARY = $(OBJDIR)/$(DLL_PREFIX)$(LIBRARY_NAME)$(LIBRARY_VERSION).$(DLL_SUFFIX)
-IMPORT_LIBRARY = $(OBJDIR)/$(IMPORT_LIB_PREFIX)$(LIBRARY_NAME)$(LIBRARY_VERSION)$(IMPORT_LIB_SUFFIX)
-
-RES = $(OBJDIR)/$(LIBRARY_NAME).res
-RESNAME = $(LIBRARY_NAME).rc
-
 ifdef NS_USE_GCC
 EXTRA_SHARED_LIBS += \
 	-L$(DIST)/lib \
 	-L$(NSPR_LIB_DIR) \
 	-lplc4 \
 	-lplds4 \
 	-lnspr4\
 	$(NULL)
--- a/lib/util/manifest.mn
+++ b/lib/util/manifest.mn
@@ -77,16 +77,14 @@ CSRCS = \
 	utf8.c \
 	utilmod.c \
 	utilpars.c \
 	pkcs11uri.c \
 	$(NULL)
 
 MODULE = nss
 
-# don't duplicate module name in REQUIRES
-MAPFILE = $(OBJDIR)/nssutil.def
-
 LIBRARY_NAME = nssutil
 LIBRARY_VERSION = 3
+MAPFILE = $(OBJDIR)/$(LIBRARY_NAME).def
 
 # This part of the code, including all sub-dirs, can be optimized for size
 export ALLOW_OPT_CODE_SIZE = 1