michael@0: # michael@0: # This Source Code Form is subject to the terms of the Mozilla Public michael@0: # License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: # file, You can obtain one at http://mozilla.org/MPL/2.0/. michael@0: michael@0: # michael@0: # Configuration common to all versions of Windows NT michael@0: # and Windows 95 michael@0: # michael@0: michael@0: DEFAULT_COMPILER = cl michael@0: michael@0: ifdef NS_USE_GCC michael@0: CC = gcc michael@0: CCC = g++ michael@0: LINK = ld michael@0: AR = ar michael@0: AR += cr $@ michael@0: RANLIB = ranlib michael@0: BSDECHO = echo michael@0: RC = windres.exe -O coff --use-temp-file michael@0: LINK_DLL = $(CC) $(OS_DLLFLAGS) $(DLLFLAGS) michael@0: else michael@0: CC = cl michael@0: CCC = cl michael@0: LINK = link michael@0: AR = lib michael@0: AR += -NOLOGO -OUT:$@ michael@0: RANLIB = echo michael@0: BSDECHO = echo michael@0: RC = rc.exe michael@0: MT = mt.exe michael@0: # Determine compiler version michael@0: CC_VERSION := $(shell $(CC) 2>&1 | sed -ne \ michael@0: 's|.* \([0-9]\+\.[0-9]\+\.[0-9]\+\(\.[0-9]\+\)\?\).*|\1|p') michael@0: # Change the dots to spaces. michael@0: _CC_VERSION_WORDS := $(subst ., ,$(CC_VERSION)) michael@0: _CC_VMAJOR := $(word 1,$(_CC_VERSION_WORDS)) michael@0: _CC_VMINOR := $(word 2,$(_CC_VERSION_WORDS)) michael@0: _CC_RELEASE := $(word 3,$(_CC_VERSION_WORDS)) michael@0: _CC_BUILD := $(word 4,$(_CC_VERSION_WORDS)) michael@0: _MSC_VER = $(_CC_VMAJOR)$(_CC_VMINOR) michael@0: _MSC_VER_6 = 1200 michael@0: # VC10 (2010) is 16.00.30319.01, VC10SP1 is 16.00.40219.01. michael@0: _MSC_VER_GE_10SP1 := $(shell expr $(_MSC_VER) \> 1600 \| \ michael@0: $(_MSC_VER) = 1600 \& $(_CC_RELEASE) \>= 40219) michael@0: # VC12 (2013). michael@0: _MSC_VER_GE_12 := $(shell expr $(_MSC_VER) \>= 1800) michael@0: ifeq ($(_CC_VMAJOR),14) michael@0: # -DYNAMICBASE is only supported on VC8SP1 or newer, michael@0: # so be very specific here! michael@0: # VC8 is 14.00.50727.42, VC8SP1 is 14.00.50727.762 michael@0: ifeq ($(_CC_RELEASE).$(_CC_BUILD),50727.42) michael@0: USE_DYNAMICBASE = michael@0: else michael@0: ifeq ($(_CC_RELEASE).$(_CC_BUILD),50727.762) michael@0: USE_DYNAMICBASE = 1 michael@0: else michael@0: _LOSER := $(error Unknown compiler version $(CC_VERSION)) michael@0: endif michael@0: endif michael@0: endif michael@0: # if $(_CC_VMAJOR) >= 15 michael@0: # NOTE: 'sort' sorts the words in lexical order, so this test works michael@0: # only if $(_CC_VMAJOR) is two digits. michael@0: ifeq ($(firstword $(sort $(_CC_VMAJOR) 15)),15) michael@0: USE_DYNAMICBASE = 1 michael@0: endif michael@0: endif michael@0: michael@0: ifdef BUILD_TREE michael@0: NSINSTALL_DIR = $(BUILD_TREE)/nss michael@0: else michael@0: NSINSTALL_DIR = $(CORE_DEPTH)/coreconf/nsinstall michael@0: endif michael@0: NSINSTALL = nsinstall michael@0: michael@0: MKDEPEND_DIR = $(CORE_DEPTH)/coreconf/mkdepend michael@0: MKDEPEND = $(MKDEPEND_DIR)/$(OBJDIR_NAME)/mkdepend.exe michael@0: # Note: MKDEPENDENCIES __MUST__ be a relative pathname, not absolute. michael@0: # If it is absolute, gmake will crash unless the named file exists. michael@0: MKDEPENDENCIES = $(OBJDIR_NAME)/depend.mk michael@0: michael@0: INSTALL = $(NSINSTALL) michael@0: MAKE_OBJDIR = mkdir michael@0: MAKE_OBJDIR += $(OBJDIR) michael@0: GARBAGE += $(OBJDIR)/vc20.pdb $(OBJDIR)/vc40.pdb michael@0: XP_DEFINE += -DXP_PC michael@0: ifdef NS_USE_GCC michael@0: LIB_SUFFIX = a michael@0: else michael@0: LIB_SUFFIX = lib michael@0: endif michael@0: DLL_SUFFIX = dll michael@0: michael@0: ifdef NS_USE_GCC michael@0: # The -mnop-fun-dllimport flag allows us to avoid a drawback of michael@0: # the dllimport attribute that a pointer to a function marked as michael@0: # dllimport cannot be used as as a constant address. michael@0: OS_CFLAGS += -mwindows -mms-bitfields -mnop-fun-dllimport michael@0: _GEN_IMPORT_LIB=-Wl,--out-implib,$(IMPORT_LIBRARY) michael@0: DLLFLAGS += -mwindows -o $@ -shared -Wl,--export-all-symbols $(if $(IMPORT_LIBRARY),$(_GEN_IMPORT_LIB)) michael@0: ifdef BUILD_OPT michael@0: ifeq (11,$(ALLOW_OPT_CODE_SIZE)$(OPT_CODE_SIZE)) michael@0: OPTIMIZER += -Os michael@0: else michael@0: OPTIMIZER += -O2 michael@0: endif michael@0: DEFINES += -UDEBUG -U_DEBUG -DNDEBUG michael@0: else michael@0: OPTIMIZER += -g michael@0: NULLSTRING := michael@0: SPACE := $(NULLSTRING) # end of the line michael@0: USERNAME := $(subst $(SPACE),_,$(USERNAME)) michael@0: USERNAME := $(subst -,_,$(USERNAME)) michael@0: DEFINES += -DDEBUG -D_DEBUG -UNDEBUG -DDEBUG_$(USERNAME) michael@0: endif michael@0: else # !NS_USE_GCC michael@0: OS_CFLAGS += -W3 -nologo -D_CRT_SECURE_NO_WARNINGS \ michael@0: -D_CRT_NONSTDC_NO_WARNINGS michael@0: OS_DLLFLAGS += -nologo -DLL -SUBSYSTEM:WINDOWS michael@0: ifeq ($(_MSC_VER),$(_MSC_VER_6)) michael@0: ifndef MOZ_DEBUG_SYMBOLS michael@0: OS_DLLFLAGS += -PDB:NONE michael@0: endif michael@0: endif michael@0: ifdef USE_DYNAMICBASE michael@0: OS_DLLFLAGS += -DYNAMICBASE michael@0: endif michael@0: ifdef BUILD_OPT michael@0: OS_CFLAGS += -MD michael@0: ifeq (11,$(ALLOW_OPT_CODE_SIZE)$(OPT_CODE_SIZE)) michael@0: OPTIMIZER += -O1 michael@0: else michael@0: OPTIMIZER += -O2 michael@0: endif michael@0: DEFINES += -UDEBUG -U_DEBUG -DNDEBUG michael@0: DLLFLAGS += -OUT:$@ michael@0: ifdef MOZ_DEBUG_SYMBOLS michael@0: ifdef MOZ_DEBUG_FLAGS michael@0: OPTIMIZER += $(MOZ_DEBUG_FLAGS) -Fd$(OBJDIR)/ michael@0: else michael@0: OPTIMIZER += -Zi -Fd$(OBJDIR)/ michael@0: endif michael@0: DLLFLAGS += -DEBUG -OPT:REF michael@0: LDFLAGS += -DEBUG -OPT:REF michael@0: endif michael@0: else michael@0: # michael@0: # Define USE_DEBUG_RTL if you want to use the debug runtime library michael@0: # (RTL) in the debug build michael@0: # michael@0: ifdef USE_DEBUG_RTL michael@0: OS_CFLAGS += -MDd -D_CRTDBG_MAP_ALLOC michael@0: else michael@0: OS_CFLAGS += -MD michael@0: endif michael@0: OPTIMIZER += -Zi -Fd$(OBJDIR)/ -Od michael@0: NULLSTRING := michael@0: SPACE := $(NULLSTRING) # end of the line michael@0: USERNAME := $(subst $(SPACE),_,$(USERNAME)) michael@0: USERNAME := $(subst -,_,$(USERNAME)) michael@0: DEFINES += -DDEBUG -D_DEBUG -UNDEBUG -DDEBUG_$(USERNAME) michael@0: DLLFLAGS += -DEBUG -OUT:$@ michael@0: LDFLAGS += -DEBUG michael@0: ifeq ($(_MSC_VER),$(_MSC_VER_6)) michael@0: ifndef MOZ_DEBUG_SYMBOLS michael@0: LDFLAGS += -PDB:NONE michael@0: endif michael@0: endif michael@0: # Purify requires /FIXED:NO when linking EXEs. michael@0: LDFLAGS += /FIXED:NO michael@0: endif michael@0: ifneq ($(_MSC_VER),$(_MSC_VER_6)) michael@0: # Convert certain deadly warnings to errors (see list at end of file) michael@0: OS_CFLAGS += -we4002 -we4003 -we4004 -we4006 -we4009 -we4013 \ michael@0: -we4015 -we4028 -we4033 -we4035 -we4045 -we4047 -we4053 -we4054 -we4063 \ michael@0: -we4064 -we4078 -we4087 -we4090 -we4098 -we4390 -we4551 -we4553 -we4715 michael@0: michael@0: ifeq ($(_MSC_VER_GE_12),1) michael@0: OS_CFLAGS += -FS michael@0: endif michael@0: endif # !MSVC6 michael@0: endif # NS_USE_GCC michael@0: michael@0: ifdef USE_64 michael@0: DEFINES += -DWIN64 michael@0: else michael@0: DEFINES += -DWIN32 michael@0: endif michael@0: michael@0: ifeq (,$(filter-out x386 x86_64,$(CPU_ARCH))) michael@0: ifdef USE_64 michael@0: DEFINES += -D_AMD64_ michael@0: else michael@0: DEFINES += -D_X86_ michael@0: endif michael@0: endif michael@0: ifeq ($(CPU_ARCH), ALPHA) michael@0: DEFINES += -D_ALPHA_=1 michael@0: endif michael@0: michael@0: ifdef MAPFILE michael@0: ifndef NS_USE_GCC michael@0: DLLFLAGS += -DEF:$(MAPFILE) michael@0: endif michael@0: endif michael@0: # Change PROCESS to put the mapfile in the correct format for this platform michael@0: PROCESS_MAP_FILE = cp $< $@ michael@0: michael@0: michael@0: # michael@0: # The following is NOT needed for the NSPR 2.0 library. michael@0: # michael@0: michael@0: DEFINES += -D_WINDOWS michael@0: michael@0: # override default, which is ASFLAGS = CFLAGS michael@0: ifdef NS_USE_GCC michael@0: AS = $(CC) michael@0: ASFLAGS = $(INCLUDES) michael@0: else michael@0: ifdef USE_64 michael@0: AS = ml64.exe michael@0: ASFLAGS = -nologo -Cp -Sn -Zi $(INCLUDES) michael@0: else michael@0: AS = ml.exe michael@0: ASFLAGS = -nologo -Cp -Sn -Zi -coff $(INCLUDES) michael@0: endif michael@0: endif michael@0: michael@0: # michael@0: # override the definitions of RELEASE_TREE found in tree.mk michael@0: # michael@0: ifndef RELEASE_TREE michael@0: ifdef BUILD_SHIP michael@0: ifdef USE_SHIPS michael@0: RELEASE_TREE = $(NTBUILD_SHIP) michael@0: else michael@0: RELEASE_TREE = //redbuild/components michael@0: endif michael@0: else michael@0: RELEASE_TREE = //redbuild/components michael@0: endif michael@0: endif michael@0: michael@0: # michael@0: # override the definitions of IMPORT_LIB_PREFIX, LIB_PREFIX, and michael@0: # DLL_PREFIX in prefix.mk michael@0: # michael@0: michael@0: ifndef IMPORT_LIB_PREFIX michael@0: ifdef NS_USE_GCC michael@0: IMPORT_LIB_PREFIX = lib michael@0: else michael@0: IMPORT_LIB_PREFIX = $(NULL) michael@0: endif michael@0: endif michael@0: michael@0: ifndef LIB_PREFIX michael@0: ifdef NS_USE_GCC michael@0: LIB_PREFIX = lib michael@0: else michael@0: LIB_PREFIX = $(NULL) michael@0: endif michael@0: endif michael@0: michael@0: ifndef DLL_PREFIX michael@0: DLL_PREFIX = $(NULL) michael@0: endif michael@0: michael@0: # michael@0: # override the definitions of various _SUFFIX symbols in suffix.mk michael@0: # michael@0: michael@0: # michael@0: # Object suffixes michael@0: # michael@0: ifndef OBJ_SUFFIX michael@0: ifdef NS_USE_GCC michael@0: OBJ_SUFFIX = .o michael@0: else michael@0: OBJ_SUFFIX = .obj michael@0: endif michael@0: endif michael@0: michael@0: # michael@0: # Assembler source suffixes michael@0: # michael@0: ifndef ASM_SUFFIX michael@0: ifdef NS_USE_GCC michael@0: ASM_SUFFIX = .s michael@0: else michael@0: ASM_SUFFIX = .asm michael@0: endif michael@0: endif michael@0: michael@0: # michael@0: # Library suffixes michael@0: # michael@0: michael@0: ifndef IMPORT_LIB_SUFFIX michael@0: IMPORT_LIB_SUFFIX = .$(LIB_SUFFIX) michael@0: endif michael@0: michael@0: ifndef DYNAMIC_LIB_SUFFIX_FOR_LINKING michael@0: DYNAMIC_LIB_SUFFIX_FOR_LINKING = $(IMPORT_LIB_SUFFIX) michael@0: endif michael@0: michael@0: # michael@0: # Program suffixes michael@0: # michael@0: ifndef PROG_SUFFIX michael@0: PROG_SUFFIX = .exe michael@0: endif michael@0: michael@0: # michael@0: # When the processor is NOT 386-based on Windows NT, override the michael@0: # value of $(CPU_TAG). For WinNT, 95, 16, not CE. michael@0: # michael@0: ifneq ($(CPU_ARCH),x386) michael@0: CPU_TAG = _$(CPU_ARCH) michael@0: endif michael@0: michael@0: # michael@0: # override ruleset.mk, removing the "lib" prefix for library names, and michael@0: # adding the "32" after the LIBRARY_VERSION. michael@0: # michael@0: ifdef LIBRARY_NAME michael@0: SHARED_LIBRARY = $(OBJDIR)/$(LIBRARY_NAME)$(LIBRARY_VERSION)32$(JDK_DEBUG_SUFFIX).dll michael@0: IMPORT_LIBRARY = $(OBJDIR)/$(LIBRARY_NAME)$(LIBRARY_VERSION)32$(JDK_DEBUG_SUFFIX).lib michael@0: endif michael@0: michael@0: # michael@0: # override the TARGETS defined in ruleset.mk, adding IMPORT_LIBRARY michael@0: # michael@0: ifndef TARGETS michael@0: TARGETS = $(LIBRARY) $(SHARED_LIBRARY) $(IMPORT_LIBRARY) $(PROGRAM) michael@0: endif michael@0: michael@0: # list of MSVC warnings converted to errors above: michael@0: # 4002: too many actual parameters for macro 'identifier' michael@0: # 4003: not enough actual parameters for macro 'identifier' michael@0: # 4004: incorrect construction after 'defined' michael@0: # 4006: #undef expected an identifier michael@0: # 4009: string too big; trailing characters truncated michael@0: # 4015: 'identifier' : type of bit field must be integral michael@0: # 4028: formal parameter different from declaration michael@0: # 4033: 'function' must return a value michael@0: # 4035: 'function' : no return value michael@0: # 4045: 'identifier' : array bounds overflow michael@0: # 4047: 'function' : 'type 1' differs in levels of indirection from 'type 2' michael@0: # 4053: one void operand for '?:' michael@0: # 4054: 'conversion' : from function pointer 'type1' to data pointer 'type2' michael@0: # 4059: pascal string too big, length byte is length % 256 michael@0: # 4063: case 'identifier' is not a valid value for switch of enum 'identifier' michael@0: # 4064: switch of incomplete enum 'identifier' michael@0: # 4078: case constant 'value' too big for the type of the switch expression michael@0: # 4087: 'function' : declared with 'void' parameter list michael@0: # 4090: 'function' : different 'const' qualifiers michael@0: # 4098: 'function' : void function returning a value michael@0: # 4390: ';' : empty controlled statement found; is this the intent? michael@0: # 4541: RTTI train wreck michael@0: # 4715: not all control paths return a value michael@0: # 4013: function undefined; assuming extern returning int michael@0: # 4553: '==' : operator has no effect; did you intend '='? michael@0: # 4551: function call missing argument list michael@0: