Commit 147d3feb authored by Jan-Marek Glogowski's avatar Jan-Marek Glogowski

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

--HG--
extra : moz-landing-system : lando
parent 2cef8ee5
......@@ -5,11 +5,4 @@
# 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 =
......@@ -140,6 +140,10 @@ 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
#
......@@ -147,8 +151,3 @@ 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
......@@ -364,15 +364,6 @@ 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
#
......
......@@ -79,20 +79,54 @@ endif
# - (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
......
......@@ -40,11 +40,6 @@ 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)
......
......@@ -20,8 +20,6 @@ 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). #
......
......@@ -7,6 +7,7 @@ DEPTH = ../..
MODULE = nss
LIBRARY_NAME = gtestutil
SHARED_LIBRARY = $(NULL)
ifeq ($(NSS_BUILD_UTIL_ONLY),1)
CPPSRCS = gtests-util.cc
......
......@@ -20,8 +20,6 @@ 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). #
......
......@@ -8,6 +8,7 @@ DEPTH = ../..
MODULE = gtest
LIBRARY_NAME = gtest
SHARED_LIBRARY = $(NULL)
INCLUDES += -Igtest/include/ -Igtest
......
......@@ -20,14 +20,11 @@ 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) #
......
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.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
......@@ -14,9 +14,10 @@ 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)
......@@ -13,12 +13,6 @@ 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
......
......@@ -8,7 +8,6 @@ CORE_DEPTH = ../../..
DIRS = testlib
MODULE = nss
MAPFILE = $(OBJDIR)/nssckbi.def
EXPORTS = \
nssckbi.h \
......@@ -30,3 +29,4 @@ CSRCS = \
REQUIRES = nspr
LIBRARY_NAME = nssckbi
MAPFILE = $(OBJDIR)/$(LIBRARY_NAME).def
......@@ -13,12 +13,6 @@ 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
......
......@@ -13,12 +13,6 @@ 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
......
......@@ -6,7 +6,6 @@
CORE_DEPTH = ../../../..
MODULE = nss
MAPFILE = $(OBJDIR)/nsscapi.def
EXPORTS = \
nsscapi.h \
......@@ -29,5 +28,6 @@ CSRCS = \
REQUIRES = nspr
LIBRARY_NAME = nsscapi
MAPFILE = $(OBJDIR)/$(LIBRARY_NAME).def
#EXTRA_SHARED_LIBS = -L$(DIST)/lib -lnssckfw -lnssb -lplc4 -lplds4
......@@ -47,10 +47,6 @@ 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
......
......@@ -6,13 +6,6 @@
# 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 \
......
......@@ -22,10 +22,9 @@ CSRCS = \
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
......@@ -7,13 +7,6 @@ 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 \
......
......@@ -17,7 +17,6 @@ PRIVATE_EXPORTS = \
$(NULL)
MODULE = nss
MAPFILE = $(OBJDIR)/smime.def
CSRCS = \
cmsarray.c \
......@@ -46,6 +45,7 @@ CSRCS = \
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
......@@ -13,13 +13,6 @@ EXTRA_LIBS += \
# 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) \
......
......@@ -14,13 +14,6 @@ EXTRA_LIBS += \
# 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 \
......
......@@ -10,7 +10,7 @@ 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))\"
......
......@@ -9,7 +9,7 @@ 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)\"
......
......@@ -3,18 +3,6 @@
# License, v. 2.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
......
......@@ -8,7 +8,9 @@ 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 = \
......
......@@ -9,13 +9,6 @@ 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 \
......
......@@ -19,7 +19,6 @@ EXPORTS = \
$(NULL)
MODULE = nss
MAPFILE = $(OBJDIR)/ssl.def
CSRCS = \
dtlscon.c \
......@@ -66,6 +65,7 @@ CSRCS = \
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
......@@ -11,13 +11,6 @@
# 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 \
......
......@@ -11,7 +11,7 @@ CSRCS = \
$(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
......@@ -6,13 +6,6 @@
# 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 \
......
......@@ -82,11 +82,9 @@ CSRCS = \
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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment