2 # This Source Code Form is subject to the terms of the Mozilla Public
3 # License, v. 2.0. If a copy of the MPL was not distributed with this
4 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 # Configuration common to all versions of Windows NT
21 RC = windres.exe -O coff --use-temp-file
22 LINK_DLL = $(CC) $(OS_DLLFLAGS) $(DLLFLAGS)
33 # Determine compiler version
34 CC_VERSION := $(shell $(CC) 2>&1 | sed -ne \
35 's|.* \([0-9]\+\.[0-9]\+\.[0-9]\+\(\.[0-9]\+\)\?\).*|\1|p')
36 # Change the dots to spaces.
37 _CC_VERSION_WORDS := $(subst ., ,$(CC_VERSION))
38 _CC_VMAJOR := $(word 1,$(_CC_VERSION_WORDS))
39 _CC_VMINOR := $(word 2,$(_CC_VERSION_WORDS))
40 _CC_RELEASE := $(word 3,$(_CC_VERSION_WORDS))
41 _CC_BUILD := $(word 4,$(_CC_VERSION_WORDS))
42 _MSC_VER = $(_CC_VMAJOR)$(_CC_VMINOR)
44 # VC10 (2010) is 16.00.30319.01, VC10SP1 is 16.00.40219.01.
45 _MSC_VER_GE_10SP1 := $(shell expr $(_MSC_VER) \> 1600 \| \
46 $(_MSC_VER) = 1600 \& $(_CC_RELEASE) \>= 40219)
48 _MSC_VER_GE_12 := $(shell expr $(_MSC_VER) \>= 1800)
49 ifeq ($(_CC_VMAJOR),14)
50 # -DYNAMICBASE is only supported on VC8SP1 or newer,
51 # so be very specific here!
52 # VC8 is 14.00.50727.42, VC8SP1 is 14.00.50727.762
53 ifeq ($(_CC_RELEASE).$(_CC_BUILD),50727.42)
56 ifeq ($(_CC_RELEASE).$(_CC_BUILD),50727.762)
59 _LOSER := $(error Unknown compiler version $(CC_VERSION))
63 # if $(_CC_VMAJOR) >= 15
64 # NOTE: 'sort' sorts the words in lexical order, so this test works
65 # only if $(_CC_VMAJOR) is two digits.
66 ifeq ($(firstword $(sort $(_CC_VMAJOR) 15)),15)
72 NSINSTALL_DIR = $(BUILD_TREE)/nss
74 NSINSTALL_DIR = $(CORE_DEPTH)/coreconf/nsinstall
78 MKDEPEND_DIR = $(CORE_DEPTH)/coreconf/mkdepend
79 MKDEPEND = $(MKDEPEND_DIR)/$(OBJDIR_NAME)/mkdepend.exe
80 # Note: MKDEPENDENCIES __MUST__ be a relative pathname, not absolute.
81 # If it is absolute, gmake will crash unless the named file exists.
82 MKDEPENDENCIES = $(OBJDIR_NAME)/depend.mk
84 INSTALL = $(NSINSTALL)
86 MAKE_OBJDIR += $(OBJDIR)
87 GARBAGE += $(OBJDIR)/vc20.pdb $(OBJDIR)/vc40.pdb
97 # The -mnop-fun-dllimport flag allows us to avoid a drawback of
98 # the dllimport attribute that a pointer to a function marked as
99 # dllimport cannot be used as as a constant address.
100 OS_CFLAGS += -mwindows -mms-bitfields -mnop-fun-dllimport
101 _GEN_IMPORT_LIB=-Wl,--out-implib,$(IMPORT_LIBRARY)
102 DLLFLAGS += -mwindows -o $@ -shared -Wl,--export-all-symbols $(if $(IMPORT_LIBRARY),$(_GEN_IMPORT_LIB))
104 ifeq (11,$(ALLOW_OPT_CODE_SIZE)$(OPT_CODE_SIZE))
109 DEFINES += -UDEBUG -U_DEBUG -DNDEBUG
113 SPACE := $(NULLSTRING) # end of the line
114 USERNAME := $(subst $(SPACE),_,$(USERNAME))
115 USERNAME := $(subst -,_,$(USERNAME))
116 DEFINES += -DDEBUG -D_DEBUG -UNDEBUG -DDEBUG_$(USERNAME)
119 OS_CFLAGS += -W3 -nologo -D_CRT_SECURE_NO_WARNINGS \
120 -D_CRT_NONSTDC_NO_WARNINGS
121 OS_DLLFLAGS += -nologo -DLL -SUBSYSTEM:WINDOWS
122 ifeq ($(_MSC_VER),$(_MSC_VER_6))
123 ifndef MOZ_DEBUG_SYMBOLS
124 OS_DLLFLAGS += -PDB:NONE
127 ifdef USE_DYNAMICBASE
128 OS_DLLFLAGS += -DYNAMICBASE
132 ifeq (11,$(ALLOW_OPT_CODE_SIZE)$(OPT_CODE_SIZE))
137 DEFINES += -UDEBUG -U_DEBUG -DNDEBUG
139 ifdef MOZ_DEBUG_SYMBOLS
140 ifdef MOZ_DEBUG_FLAGS
141 OPTIMIZER += $(MOZ_DEBUG_FLAGS) -Fd$(OBJDIR)/
143 OPTIMIZER += -Zi -Fd$(OBJDIR)/
145 DLLFLAGS += -DEBUG -OPT:REF
146 LDFLAGS += -DEBUG -OPT:REF
150 # Define USE_DEBUG_RTL if you want to use the debug runtime library
151 # (RTL) in the debug build
154 OS_CFLAGS += -MDd -D_CRTDBG_MAP_ALLOC
158 OPTIMIZER += -Zi -Fd$(OBJDIR)/ -Od
160 SPACE := $(NULLSTRING) # end of the line
161 USERNAME := $(subst $(SPACE),_,$(USERNAME))
162 USERNAME := $(subst -,_,$(USERNAME))
163 DEFINES += -DDEBUG -D_DEBUG -UNDEBUG -DDEBUG_$(USERNAME)
164 DLLFLAGS += -DEBUG -OUT:$@
166 ifeq ($(_MSC_VER),$(_MSC_VER_6))
167 ifndef MOZ_DEBUG_SYMBOLS
171 # Purify requires /FIXED:NO when linking EXEs.
174 ifneq ($(_MSC_VER),$(_MSC_VER_6))
175 # Convert certain deadly warnings to errors (see list at end of file)
176 OS_CFLAGS += -we4002 -we4003 -we4004 -we4006 -we4009 -we4013 \
177 -we4015 -we4028 -we4033 -we4035 -we4045 -we4047 -we4053 -we4054 -we4063 \
178 -we4064 -we4078 -we4087 -we4090 -we4098 -we4390 -we4551 -we4553 -we4715
180 ifeq ($(_MSC_VER_GE_12),1)
192 ifeq (,$(filter-out x386 x86_64,$(CPU_ARCH)))
199 ifeq ($(CPU_ARCH), ALPHA)
200 DEFINES += -D_ALPHA_=1
205 DLLFLAGS += -DEF:$(MAPFILE)
208 # Change PROCESS to put the mapfile in the correct format for this platform
209 PROCESS_MAP_FILE = cp $< $@
213 # The following is NOT needed for the NSPR 2.0 library.
216 DEFINES += -D_WINDOWS
218 # override default, which is ASFLAGS = CFLAGS
221 ASFLAGS = $(INCLUDES)
225 ASFLAGS = -nologo -Cp -Sn -Zi $(INCLUDES)
228 ASFLAGS = -nologo -Cp -Sn -Zi -coff $(INCLUDES)
233 # override the definitions of RELEASE_TREE found in tree.mk
238 RELEASE_TREE = $(NTBUILD_SHIP)
240 RELEASE_TREE = //redbuild/components
243 RELEASE_TREE = //redbuild/components
248 # override the definitions of IMPORT_LIB_PREFIX, LIB_PREFIX, and
249 # DLL_PREFIX in prefix.mk
252 ifndef IMPORT_LIB_PREFIX
254 IMPORT_LIB_PREFIX = lib
256 IMPORT_LIB_PREFIX = $(NULL)
273 # override the definitions of various _SUFFIX symbols in suffix.mk
288 # Assembler source suffixes
302 ifndef IMPORT_LIB_SUFFIX
303 IMPORT_LIB_SUFFIX = .$(LIB_SUFFIX)
306 ifndef DYNAMIC_LIB_SUFFIX_FOR_LINKING
307 DYNAMIC_LIB_SUFFIX_FOR_LINKING = $(IMPORT_LIB_SUFFIX)
318 # When the processor is NOT 386-based on Windows NT, override the
319 # value of $(CPU_TAG). For WinNT, 95, 16, not CE.
321 ifneq ($(CPU_ARCH),x386)
322 CPU_TAG = _$(CPU_ARCH)
326 # override ruleset.mk, removing the "lib" prefix for library names, and
327 # adding the "32" after the LIBRARY_VERSION.
330 SHARED_LIBRARY = $(OBJDIR)/$(LIBRARY_NAME)$(LIBRARY_VERSION)32$(JDK_DEBUG_SUFFIX).dll
331 IMPORT_LIBRARY = $(OBJDIR)/$(LIBRARY_NAME)$(LIBRARY_VERSION)32$(JDK_DEBUG_SUFFIX).lib
335 # override the TARGETS defined in ruleset.mk, adding IMPORT_LIBRARY
338 TARGETS = $(LIBRARY) $(SHARED_LIBRARY) $(IMPORT_LIBRARY) $(PROGRAM)
341 # list of MSVC warnings converted to errors above:
342 # 4002: too many actual parameters for macro 'identifier'
343 # 4003: not enough actual parameters for macro 'identifier'
344 # 4004: incorrect construction after 'defined'
345 # 4006: #undef expected an identifier
346 # 4009: string too big; trailing characters truncated
347 # 4015: 'identifier' : type of bit field must be integral
348 # 4028: formal parameter different from declaration
349 # 4033: 'function' must return a value
350 # 4035: 'function' : no return value
351 # 4045: 'identifier' : array bounds overflow
352 # 4047: 'function' : 'type 1' differs in levels of indirection from 'type 2'
353 # 4053: one void operand for '?:'
354 # 4054: 'conversion' : from function pointer 'type1' to data pointer 'type2'
355 # 4059: pascal string too big, length byte is length % 256
356 # 4063: case 'identifier' is not a valid value for switch of enum 'identifier'
357 # 4064: switch of incomplete enum 'identifier'
358 # 4078: case constant 'value' too big for the type of the switch expression
359 # 4087: 'function' : declared with 'void' parameter list
360 # 4090: 'function' : different 'const' qualifiers
361 # 4098: 'function' : void function returning a value
362 # 4390: ';' : empty controlled statement found; is this the intent?
363 # 4541: RTTI train wreck
364 # 4715: not all control paths return a value
365 # 4013: function undefined; assuming extern returning int
366 # 4553: '==' : operator has no effect; did you intend '='?
367 # 4551: function call missing argument list