Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | # |
michael@0 | 2 | # This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | # License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | # file, You can obtain one at http://mozilla.org/MPL/2.0/. |
michael@0 | 5 | |
michael@0 | 6 | # |
michael@0 | 7 | # Configuration common to all versions of Windows NT |
michael@0 | 8 | # and Windows 95 |
michael@0 | 9 | # |
michael@0 | 10 | |
michael@0 | 11 | DEFAULT_COMPILER = cl |
michael@0 | 12 | |
michael@0 | 13 | ifdef NS_USE_GCC |
michael@0 | 14 | CC = gcc |
michael@0 | 15 | CCC = g++ |
michael@0 | 16 | LINK = ld |
michael@0 | 17 | AR = ar |
michael@0 | 18 | AR += cr $@ |
michael@0 | 19 | RANLIB = ranlib |
michael@0 | 20 | BSDECHO = echo |
michael@0 | 21 | RC = windres.exe -O coff --use-temp-file |
michael@0 | 22 | LINK_DLL = $(CC) $(OS_DLLFLAGS) $(DLLFLAGS) |
michael@0 | 23 | else |
michael@0 | 24 | CC = cl |
michael@0 | 25 | CCC = cl |
michael@0 | 26 | LINK = link |
michael@0 | 27 | AR = lib |
michael@0 | 28 | AR += -NOLOGO -OUT:$@ |
michael@0 | 29 | RANLIB = echo |
michael@0 | 30 | BSDECHO = echo |
michael@0 | 31 | RC = rc.exe |
michael@0 | 32 | MT = mt.exe |
michael@0 | 33 | # Determine compiler version |
michael@0 | 34 | CC_VERSION := $(shell $(CC) 2>&1 | sed -ne \ |
michael@0 | 35 | 's|.* \([0-9]\+\.[0-9]\+\.[0-9]\+\(\.[0-9]\+\)\?\).*|\1|p') |
michael@0 | 36 | # Change the dots to spaces. |
michael@0 | 37 | _CC_VERSION_WORDS := $(subst ., ,$(CC_VERSION)) |
michael@0 | 38 | _CC_VMAJOR := $(word 1,$(_CC_VERSION_WORDS)) |
michael@0 | 39 | _CC_VMINOR := $(word 2,$(_CC_VERSION_WORDS)) |
michael@0 | 40 | _CC_RELEASE := $(word 3,$(_CC_VERSION_WORDS)) |
michael@0 | 41 | _CC_BUILD := $(word 4,$(_CC_VERSION_WORDS)) |
michael@0 | 42 | _MSC_VER = $(_CC_VMAJOR)$(_CC_VMINOR) |
michael@0 | 43 | _MSC_VER_6 = 1200 |
michael@0 | 44 | # VC10 (2010) is 16.00.30319.01, VC10SP1 is 16.00.40219.01. |
michael@0 | 45 | _MSC_VER_GE_10SP1 := $(shell expr $(_MSC_VER) \> 1600 \| \ |
michael@0 | 46 | $(_MSC_VER) = 1600 \& $(_CC_RELEASE) \>= 40219) |
michael@0 | 47 | # VC12 (2013). |
michael@0 | 48 | _MSC_VER_GE_12 := $(shell expr $(_MSC_VER) \>= 1800) |
michael@0 | 49 | ifeq ($(_CC_VMAJOR),14) |
michael@0 | 50 | # -DYNAMICBASE is only supported on VC8SP1 or newer, |
michael@0 | 51 | # so be very specific here! |
michael@0 | 52 | # VC8 is 14.00.50727.42, VC8SP1 is 14.00.50727.762 |
michael@0 | 53 | ifeq ($(_CC_RELEASE).$(_CC_BUILD),50727.42) |
michael@0 | 54 | USE_DYNAMICBASE = |
michael@0 | 55 | else |
michael@0 | 56 | ifeq ($(_CC_RELEASE).$(_CC_BUILD),50727.762) |
michael@0 | 57 | USE_DYNAMICBASE = 1 |
michael@0 | 58 | else |
michael@0 | 59 | _LOSER := $(error Unknown compiler version $(CC_VERSION)) |
michael@0 | 60 | endif |
michael@0 | 61 | endif |
michael@0 | 62 | endif |
michael@0 | 63 | # if $(_CC_VMAJOR) >= 15 |
michael@0 | 64 | # NOTE: 'sort' sorts the words in lexical order, so this test works |
michael@0 | 65 | # only if $(_CC_VMAJOR) is two digits. |
michael@0 | 66 | ifeq ($(firstword $(sort $(_CC_VMAJOR) 15)),15) |
michael@0 | 67 | USE_DYNAMICBASE = 1 |
michael@0 | 68 | endif |
michael@0 | 69 | endif |
michael@0 | 70 | |
michael@0 | 71 | ifdef BUILD_TREE |
michael@0 | 72 | NSINSTALL_DIR = $(BUILD_TREE)/nss |
michael@0 | 73 | else |
michael@0 | 74 | NSINSTALL_DIR = $(CORE_DEPTH)/coreconf/nsinstall |
michael@0 | 75 | endif |
michael@0 | 76 | NSINSTALL = nsinstall |
michael@0 | 77 | |
michael@0 | 78 | MKDEPEND_DIR = $(CORE_DEPTH)/coreconf/mkdepend |
michael@0 | 79 | MKDEPEND = $(MKDEPEND_DIR)/$(OBJDIR_NAME)/mkdepend.exe |
michael@0 | 80 | # Note: MKDEPENDENCIES __MUST__ be a relative pathname, not absolute. |
michael@0 | 81 | # If it is absolute, gmake will crash unless the named file exists. |
michael@0 | 82 | MKDEPENDENCIES = $(OBJDIR_NAME)/depend.mk |
michael@0 | 83 | |
michael@0 | 84 | INSTALL = $(NSINSTALL) |
michael@0 | 85 | MAKE_OBJDIR = mkdir |
michael@0 | 86 | MAKE_OBJDIR += $(OBJDIR) |
michael@0 | 87 | GARBAGE += $(OBJDIR)/vc20.pdb $(OBJDIR)/vc40.pdb |
michael@0 | 88 | XP_DEFINE += -DXP_PC |
michael@0 | 89 | ifdef NS_USE_GCC |
michael@0 | 90 | LIB_SUFFIX = a |
michael@0 | 91 | else |
michael@0 | 92 | LIB_SUFFIX = lib |
michael@0 | 93 | endif |
michael@0 | 94 | DLL_SUFFIX = dll |
michael@0 | 95 | |
michael@0 | 96 | ifdef NS_USE_GCC |
michael@0 | 97 | # The -mnop-fun-dllimport flag allows us to avoid a drawback of |
michael@0 | 98 | # the dllimport attribute that a pointer to a function marked as |
michael@0 | 99 | # dllimport cannot be used as as a constant address. |
michael@0 | 100 | OS_CFLAGS += -mwindows -mms-bitfields -mnop-fun-dllimport |
michael@0 | 101 | _GEN_IMPORT_LIB=-Wl,--out-implib,$(IMPORT_LIBRARY) |
michael@0 | 102 | DLLFLAGS += -mwindows -o $@ -shared -Wl,--export-all-symbols $(if $(IMPORT_LIBRARY),$(_GEN_IMPORT_LIB)) |
michael@0 | 103 | ifdef BUILD_OPT |
michael@0 | 104 | ifeq (11,$(ALLOW_OPT_CODE_SIZE)$(OPT_CODE_SIZE)) |
michael@0 | 105 | OPTIMIZER += -Os |
michael@0 | 106 | else |
michael@0 | 107 | OPTIMIZER += -O2 |
michael@0 | 108 | endif |
michael@0 | 109 | DEFINES += -UDEBUG -U_DEBUG -DNDEBUG |
michael@0 | 110 | else |
michael@0 | 111 | OPTIMIZER += -g |
michael@0 | 112 | NULLSTRING := |
michael@0 | 113 | SPACE := $(NULLSTRING) # end of the line |
michael@0 | 114 | USERNAME := $(subst $(SPACE),_,$(USERNAME)) |
michael@0 | 115 | USERNAME := $(subst -,_,$(USERNAME)) |
michael@0 | 116 | DEFINES += -DDEBUG -D_DEBUG -UNDEBUG -DDEBUG_$(USERNAME) |
michael@0 | 117 | endif |
michael@0 | 118 | else # !NS_USE_GCC |
michael@0 | 119 | OS_CFLAGS += -W3 -nologo -D_CRT_SECURE_NO_WARNINGS \ |
michael@0 | 120 | -D_CRT_NONSTDC_NO_WARNINGS |
michael@0 | 121 | OS_DLLFLAGS += -nologo -DLL -SUBSYSTEM:WINDOWS |
michael@0 | 122 | ifeq ($(_MSC_VER),$(_MSC_VER_6)) |
michael@0 | 123 | ifndef MOZ_DEBUG_SYMBOLS |
michael@0 | 124 | OS_DLLFLAGS += -PDB:NONE |
michael@0 | 125 | endif |
michael@0 | 126 | endif |
michael@0 | 127 | ifdef USE_DYNAMICBASE |
michael@0 | 128 | OS_DLLFLAGS += -DYNAMICBASE |
michael@0 | 129 | endif |
michael@0 | 130 | ifdef BUILD_OPT |
michael@0 | 131 | OS_CFLAGS += -MD |
michael@0 | 132 | ifeq (11,$(ALLOW_OPT_CODE_SIZE)$(OPT_CODE_SIZE)) |
michael@0 | 133 | OPTIMIZER += -O1 |
michael@0 | 134 | else |
michael@0 | 135 | OPTIMIZER += -O2 |
michael@0 | 136 | endif |
michael@0 | 137 | DEFINES += -UDEBUG -U_DEBUG -DNDEBUG |
michael@0 | 138 | DLLFLAGS += -OUT:$@ |
michael@0 | 139 | ifdef MOZ_DEBUG_SYMBOLS |
michael@0 | 140 | ifdef MOZ_DEBUG_FLAGS |
michael@0 | 141 | OPTIMIZER += $(MOZ_DEBUG_FLAGS) -Fd$(OBJDIR)/ |
michael@0 | 142 | else |
michael@0 | 143 | OPTIMIZER += -Zi -Fd$(OBJDIR)/ |
michael@0 | 144 | endif |
michael@0 | 145 | DLLFLAGS += -DEBUG -OPT:REF |
michael@0 | 146 | LDFLAGS += -DEBUG -OPT:REF |
michael@0 | 147 | endif |
michael@0 | 148 | else |
michael@0 | 149 | # |
michael@0 | 150 | # Define USE_DEBUG_RTL if you want to use the debug runtime library |
michael@0 | 151 | # (RTL) in the debug build |
michael@0 | 152 | # |
michael@0 | 153 | ifdef USE_DEBUG_RTL |
michael@0 | 154 | OS_CFLAGS += -MDd -D_CRTDBG_MAP_ALLOC |
michael@0 | 155 | else |
michael@0 | 156 | OS_CFLAGS += -MD |
michael@0 | 157 | endif |
michael@0 | 158 | OPTIMIZER += -Zi -Fd$(OBJDIR)/ -Od |
michael@0 | 159 | NULLSTRING := |
michael@0 | 160 | SPACE := $(NULLSTRING) # end of the line |
michael@0 | 161 | USERNAME := $(subst $(SPACE),_,$(USERNAME)) |
michael@0 | 162 | USERNAME := $(subst -,_,$(USERNAME)) |
michael@0 | 163 | DEFINES += -DDEBUG -D_DEBUG -UNDEBUG -DDEBUG_$(USERNAME) |
michael@0 | 164 | DLLFLAGS += -DEBUG -OUT:$@ |
michael@0 | 165 | LDFLAGS += -DEBUG |
michael@0 | 166 | ifeq ($(_MSC_VER),$(_MSC_VER_6)) |
michael@0 | 167 | ifndef MOZ_DEBUG_SYMBOLS |
michael@0 | 168 | LDFLAGS += -PDB:NONE |
michael@0 | 169 | endif |
michael@0 | 170 | endif |
michael@0 | 171 | # Purify requires /FIXED:NO when linking EXEs. |
michael@0 | 172 | LDFLAGS += /FIXED:NO |
michael@0 | 173 | endif |
michael@0 | 174 | ifneq ($(_MSC_VER),$(_MSC_VER_6)) |
michael@0 | 175 | # Convert certain deadly warnings to errors (see list at end of file) |
michael@0 | 176 | OS_CFLAGS += -we4002 -we4003 -we4004 -we4006 -we4009 -we4013 \ |
michael@0 | 177 | -we4015 -we4028 -we4033 -we4035 -we4045 -we4047 -we4053 -we4054 -we4063 \ |
michael@0 | 178 | -we4064 -we4078 -we4087 -we4090 -we4098 -we4390 -we4551 -we4553 -we4715 |
michael@0 | 179 | |
michael@0 | 180 | ifeq ($(_MSC_VER_GE_12),1) |
michael@0 | 181 | OS_CFLAGS += -FS |
michael@0 | 182 | endif |
michael@0 | 183 | endif # !MSVC6 |
michael@0 | 184 | endif # NS_USE_GCC |
michael@0 | 185 | |
michael@0 | 186 | ifdef USE_64 |
michael@0 | 187 | DEFINES += -DWIN64 |
michael@0 | 188 | else |
michael@0 | 189 | DEFINES += -DWIN32 |
michael@0 | 190 | endif |
michael@0 | 191 | |
michael@0 | 192 | ifeq (,$(filter-out x386 x86_64,$(CPU_ARCH))) |
michael@0 | 193 | ifdef USE_64 |
michael@0 | 194 | DEFINES += -D_AMD64_ |
michael@0 | 195 | else |
michael@0 | 196 | DEFINES += -D_X86_ |
michael@0 | 197 | endif |
michael@0 | 198 | endif |
michael@0 | 199 | ifeq ($(CPU_ARCH), ALPHA) |
michael@0 | 200 | DEFINES += -D_ALPHA_=1 |
michael@0 | 201 | endif |
michael@0 | 202 | |
michael@0 | 203 | ifdef MAPFILE |
michael@0 | 204 | ifndef NS_USE_GCC |
michael@0 | 205 | DLLFLAGS += -DEF:$(MAPFILE) |
michael@0 | 206 | endif |
michael@0 | 207 | endif |
michael@0 | 208 | # Change PROCESS to put the mapfile in the correct format for this platform |
michael@0 | 209 | PROCESS_MAP_FILE = cp $< $@ |
michael@0 | 210 | |
michael@0 | 211 | |
michael@0 | 212 | # |
michael@0 | 213 | # The following is NOT needed for the NSPR 2.0 library. |
michael@0 | 214 | # |
michael@0 | 215 | |
michael@0 | 216 | DEFINES += -D_WINDOWS |
michael@0 | 217 | |
michael@0 | 218 | # override default, which is ASFLAGS = CFLAGS |
michael@0 | 219 | ifdef NS_USE_GCC |
michael@0 | 220 | AS = $(CC) |
michael@0 | 221 | ASFLAGS = $(INCLUDES) |
michael@0 | 222 | else |
michael@0 | 223 | ifdef USE_64 |
michael@0 | 224 | AS = ml64.exe |
michael@0 | 225 | ASFLAGS = -nologo -Cp -Sn -Zi $(INCLUDES) |
michael@0 | 226 | else |
michael@0 | 227 | AS = ml.exe |
michael@0 | 228 | ASFLAGS = -nologo -Cp -Sn -Zi -coff $(INCLUDES) |
michael@0 | 229 | endif |
michael@0 | 230 | endif |
michael@0 | 231 | |
michael@0 | 232 | # |
michael@0 | 233 | # override the definitions of RELEASE_TREE found in tree.mk |
michael@0 | 234 | # |
michael@0 | 235 | ifndef RELEASE_TREE |
michael@0 | 236 | ifdef BUILD_SHIP |
michael@0 | 237 | ifdef USE_SHIPS |
michael@0 | 238 | RELEASE_TREE = $(NTBUILD_SHIP) |
michael@0 | 239 | else |
michael@0 | 240 | RELEASE_TREE = //redbuild/components |
michael@0 | 241 | endif |
michael@0 | 242 | else |
michael@0 | 243 | RELEASE_TREE = //redbuild/components |
michael@0 | 244 | endif |
michael@0 | 245 | endif |
michael@0 | 246 | |
michael@0 | 247 | # |
michael@0 | 248 | # override the definitions of IMPORT_LIB_PREFIX, LIB_PREFIX, and |
michael@0 | 249 | # DLL_PREFIX in prefix.mk |
michael@0 | 250 | # |
michael@0 | 251 | |
michael@0 | 252 | ifndef IMPORT_LIB_PREFIX |
michael@0 | 253 | ifdef NS_USE_GCC |
michael@0 | 254 | IMPORT_LIB_PREFIX = lib |
michael@0 | 255 | else |
michael@0 | 256 | IMPORT_LIB_PREFIX = $(NULL) |
michael@0 | 257 | endif |
michael@0 | 258 | endif |
michael@0 | 259 | |
michael@0 | 260 | ifndef LIB_PREFIX |
michael@0 | 261 | ifdef NS_USE_GCC |
michael@0 | 262 | LIB_PREFIX = lib |
michael@0 | 263 | else |
michael@0 | 264 | LIB_PREFIX = $(NULL) |
michael@0 | 265 | endif |
michael@0 | 266 | endif |
michael@0 | 267 | |
michael@0 | 268 | ifndef DLL_PREFIX |
michael@0 | 269 | DLL_PREFIX = $(NULL) |
michael@0 | 270 | endif |
michael@0 | 271 | |
michael@0 | 272 | # |
michael@0 | 273 | # override the definitions of various _SUFFIX symbols in suffix.mk |
michael@0 | 274 | # |
michael@0 | 275 | |
michael@0 | 276 | # |
michael@0 | 277 | # Object suffixes |
michael@0 | 278 | # |
michael@0 | 279 | ifndef OBJ_SUFFIX |
michael@0 | 280 | ifdef NS_USE_GCC |
michael@0 | 281 | OBJ_SUFFIX = .o |
michael@0 | 282 | else |
michael@0 | 283 | OBJ_SUFFIX = .obj |
michael@0 | 284 | endif |
michael@0 | 285 | endif |
michael@0 | 286 | |
michael@0 | 287 | # |
michael@0 | 288 | # Assembler source suffixes |
michael@0 | 289 | # |
michael@0 | 290 | ifndef ASM_SUFFIX |
michael@0 | 291 | ifdef NS_USE_GCC |
michael@0 | 292 | ASM_SUFFIX = .s |
michael@0 | 293 | else |
michael@0 | 294 | ASM_SUFFIX = .asm |
michael@0 | 295 | endif |
michael@0 | 296 | endif |
michael@0 | 297 | |
michael@0 | 298 | # |
michael@0 | 299 | # Library suffixes |
michael@0 | 300 | # |
michael@0 | 301 | |
michael@0 | 302 | ifndef IMPORT_LIB_SUFFIX |
michael@0 | 303 | IMPORT_LIB_SUFFIX = .$(LIB_SUFFIX) |
michael@0 | 304 | endif |
michael@0 | 305 | |
michael@0 | 306 | ifndef DYNAMIC_LIB_SUFFIX_FOR_LINKING |
michael@0 | 307 | DYNAMIC_LIB_SUFFIX_FOR_LINKING = $(IMPORT_LIB_SUFFIX) |
michael@0 | 308 | endif |
michael@0 | 309 | |
michael@0 | 310 | # |
michael@0 | 311 | # Program suffixes |
michael@0 | 312 | # |
michael@0 | 313 | ifndef PROG_SUFFIX |
michael@0 | 314 | PROG_SUFFIX = .exe |
michael@0 | 315 | endif |
michael@0 | 316 | |
michael@0 | 317 | # |
michael@0 | 318 | # When the processor is NOT 386-based on Windows NT, override the |
michael@0 | 319 | # value of $(CPU_TAG). For WinNT, 95, 16, not CE. |
michael@0 | 320 | # |
michael@0 | 321 | ifneq ($(CPU_ARCH),x386) |
michael@0 | 322 | CPU_TAG = _$(CPU_ARCH) |
michael@0 | 323 | endif |
michael@0 | 324 | |
michael@0 | 325 | # |
michael@0 | 326 | # override ruleset.mk, removing the "lib" prefix for library names, and |
michael@0 | 327 | # adding the "32" after the LIBRARY_VERSION. |
michael@0 | 328 | # |
michael@0 | 329 | ifdef LIBRARY_NAME |
michael@0 | 330 | SHARED_LIBRARY = $(OBJDIR)/$(LIBRARY_NAME)$(LIBRARY_VERSION)32$(JDK_DEBUG_SUFFIX).dll |
michael@0 | 331 | IMPORT_LIBRARY = $(OBJDIR)/$(LIBRARY_NAME)$(LIBRARY_VERSION)32$(JDK_DEBUG_SUFFIX).lib |
michael@0 | 332 | endif |
michael@0 | 333 | |
michael@0 | 334 | # |
michael@0 | 335 | # override the TARGETS defined in ruleset.mk, adding IMPORT_LIBRARY |
michael@0 | 336 | # |
michael@0 | 337 | ifndef TARGETS |
michael@0 | 338 | TARGETS = $(LIBRARY) $(SHARED_LIBRARY) $(IMPORT_LIBRARY) $(PROGRAM) |
michael@0 | 339 | endif |
michael@0 | 340 | |
michael@0 | 341 | # list of MSVC warnings converted to errors above: |
michael@0 | 342 | # 4002: too many actual parameters for macro 'identifier' |
michael@0 | 343 | # 4003: not enough actual parameters for macro 'identifier' |
michael@0 | 344 | # 4004: incorrect construction after 'defined' |
michael@0 | 345 | # 4006: #undef expected an identifier |
michael@0 | 346 | # 4009: string too big; trailing characters truncated |
michael@0 | 347 | # 4015: 'identifier' : type of bit field must be integral |
michael@0 | 348 | # 4028: formal parameter different from declaration |
michael@0 | 349 | # 4033: 'function' must return a value |
michael@0 | 350 | # 4035: 'function' : no return value |
michael@0 | 351 | # 4045: 'identifier' : array bounds overflow |
michael@0 | 352 | # 4047: 'function' : 'type 1' differs in levels of indirection from 'type 2' |
michael@0 | 353 | # 4053: one void operand for '?:' |
michael@0 | 354 | # 4054: 'conversion' : from function pointer 'type1' to data pointer 'type2' |
michael@0 | 355 | # 4059: pascal string too big, length byte is length % 256 |
michael@0 | 356 | # 4063: case 'identifier' is not a valid value for switch of enum 'identifier' |
michael@0 | 357 | # 4064: switch of incomplete enum 'identifier' |
michael@0 | 358 | # 4078: case constant 'value' too big for the type of the switch expression |
michael@0 | 359 | # 4087: 'function' : declared with 'void' parameter list |
michael@0 | 360 | # 4090: 'function' : different 'const' qualifiers |
michael@0 | 361 | # 4098: 'function' : void function returning a value |
michael@0 | 362 | # 4390: ';' : empty controlled statement found; is this the intent? |
michael@0 | 363 | # 4541: RTTI train wreck |
michael@0 | 364 | # 4715: not all control paths return a value |
michael@0 | 365 | # 4013: function undefined; assuming extern returning int |
michael@0 | 366 | # 4553: '==' : operator has no effect; did you intend '='? |
michael@0 | 367 | # 4551: function call missing argument list |
michael@0 | 368 |