1# ***************************************************************************
2#     HERC_FLAGS.msvc      (!INCLUDE ed by "makefile-dllmod.msvc")
3# --------------------------------------------------------------------------
4# (c) Copyright Roger Bowler, 2005-2007
5# --------------------------------------------------------------------------
6# $Id$
7#
8#  Sets additional Hercules-related compiler/linker flags & #defines...
9#
10# ***************************************************************************
11
12# Set some additional flags...
13
14ldebug = $(ldebug) $(MAPFILE)
15
16# user32.lib for the MessageBeep and MessageBox functions
17LIBS = $(LIBS) user32.lib
18
19# The following line makes all warnings into errors
20cflags = $(cflags) /WX
21
22!IFDEF ASSEMBLY_LISTINGS
23# /FAcs = source code, assembly code, and machine code
24cflags = $(cflags) /FAcs /Fa$(ASMDIR)\$(NULL)
25!ENDIF
26
27# PRERELEASE Flag support
28!IFDEF PRERELEASE
29rcflags = $(rcflags) -D PRERELEASE=1
30!ENDIF
31
32!IFDEF _WIN64
33rcflags = $(rcflags) -D _WIN64
34!ENDIF
35
36!IFNDEF MAX_CPU_ENGINES
37MAX_CPU_ENGINES = 8
38!ENDIF
39
40rcflags = $(rcflags) -D _MSVC_ -D VERSION=$(VERSION) -D V1=$(V1) -D V2=$(V2) -D V3=$(V3) -D V4=$(V4)
41
42cflags  = $(cflags)  /D _MSVC_ /D VERSION=$(VERSION) /D MAX_CPU_ENGINES=$(MAX_CPU_ENGINES)
43
44!IF DEFINED(CUSTOM_BUILD_STRING)
45cflags  = $(cflags)  /D CUSTOM_BUILD_STRING=\"$(CUSTOM_BUILD_STRING)\"
46!ENDIF
47
48# Allow version.c to display the name of the host CPU architecture
49cflags = $(cflags) /D HOST_ARCH=$(CPU)
50
51# The following instructs the declaration of DLL export symbols
52cflags = $(cflags) /D HDL_BUILD_SHARED /D OPTION_DYNAMIC_LOAD
53
54# Suppress some deprecation warnings that aren't really deprecation warnings
55cflags = $(cflags) -D _CRT_SECURE_NO_DEPRECATE
56cflags = $(cflags) -D _CRT_NONSTDC_NO_DEPRECATE
57
58# ... or that would unduly become promoted into errors due to option /WX
59!IF $(vsversion) >= 14
60cflags = $(cflags) /wd4996
61cflags = $(cflags) -D _WINSOCK_DEPRECATED_NO_WARNINGS
62!ENDIF
63
64ldebug = $(ldebug) /MANIFEST
65
66# Override win32.mak options for WIN64 to eliminate the following warnings
67# C4200: nonstandard extension used : zero-sized array in struct/union
68# C4127: conditional expression is constant
69cflags = $(cflags:-W4=-W3)
70cflags = $(cflags:/W4=/W3)
71
72# Suppress warning 4267 conversion from size_t to int possible loss of data
73cflags = $(cflags) /wd4267
74
75# D9035: option 'Wp64' has been deprecated and will be removed in a future release.
76cflags = $(cflags:-Wp64=)
77cflags = $(cflags:/Wp64=)
78
79# Enable "/MP (Build with Multiple Processes)" option
80# if the building host has more than one processor...
81!IF $(vsversion) >= 9 && $(NUMBER_OF_PROCESSORS) > 1
82cflags = $(cflags) /MP
83!ENDIF
84
85# Note: the "/Gm (Enable Minimal Rebuild)" option is incompatible
86# with the "/MP (Build with Multiple Processes)" option (and besides
87# that it's still somewhat buggy) so remove it if it's present...
88cdebug  = $(cdebug:-Gm=)
89cdebug  = $(cdebug:/Gm=)
90
91# Specify module base address directly via linker option
92# so we don't have to rely on user having rebase utility.
93ldebug = $(ldebug) /base:0x400000
94
95# Optimize for AMD64 CPU architecture
96!IF "$(CPU)" == "AMD64"
97!IF $(vsversion) < 14
98cflags = $(cflags) /favor:AMD64
99# ... unless we are under visual studio 2015 in whcih case we prefer INTEL64
100!ELSE
101cflags = $(cflags) /favor:INTEL64
102!ENDIF
103!ENDIF
104
105# Increase the sockets set size limit/default to be the
106# same value as used on most non-Windows platforms (1024)
107cflags  = $(cflags)  /D FD_SETSIZE=1024
108