msvc revision e18a033b
1
2# Copyright (C) Igor Sysoev
3# Copyright (C) Nginx, Inc.
4
5
6# MSVC 6.0 SP2                            cl 12.00
7# MSVC Toolkit 2003 (7.1)                 cl 13.10
8# MSVC 2005 Express Edition SP1 (8.0)     cl 14.00
9# MSVC 2008 Express Edition (9.0)         cl 15.00
10# MSVC 2010 (10.0)                        cl 16.00
11# MSVC 2015 (14.0)                        cl 19.00
12
13
14NGX_MSVC_VER=`$NGX_WINE $CC 2>&1 | grep 'Compiler Version' 2>&1 \
15                                 | sed -e 's/^.* Version \(.*\)/\1/'`
16
17echo " + cl version: $NGX_MSVC_VER"
18
19have=NGX_COMPILER value="\"cl $NGX_MSVC_VER\"" . auto/define
20
21
22ngx_msvc_ver=`echo $NGX_MSVC_VER | sed -e 's/^\([0-9]*\).*/\1/'`
23
24
25# optimizations
26
27# maximize speed, equivalent to -Og -Oi -Ot -Oy -Ob2 -Gs -GF -Gy
28CFLAGS="$CFLAGS -O2"
29
30# enable global optimization
31#CFLAGS="$CFLAGS -Og"
32# enable intrinsic functions
33#CFLAGS="$CFLAGS -Oi"
34
35# disable inline expansion
36#CFLAGS="$CFLAGS -Ob0"
37# explicit inline expansion
38#CFLAGS="$CFLAGS -Ob1"
39# explicit and implicit inline expansion
40#CFLAGS="$CFLAGS -Ob2"
41
42# enable frame pointer omission
43#CFLAGS="$CFLAGS -Oy"
44# disable stack checking calls
45#CFLAGS="$CFLAGS -Gs"
46
47# pools strings as read/write
48#CFLAGS="$CFLAGS -Gf"
49# pools strings as read-only
50#CFLAGS="$CFLAGS -GF"
51
52
53case $CPU in
54    pentium)
55        # optimize for Pentium and Athlon
56        CPU_OPT="-G5"
57    ;;
58
59    pentiumpro)
60        # optimize for Pentium Pro, Pentium II and Pentium III
61        CPU_OPT="-G6"
62    ;;
63
64    pentium4)
65        # optimize for Pentium 4, MSVC 7
66        CPU_OPT="-G7"
67    ;;
68esac
69
70# __cdecl, default, must be used with OpenSSL, md5 asm, and sha1 asm
71#CPU_OPT="$CPU_OPT -Gd"
72# __stdcall
73#CPU_OPT="$CPU_OPT -Gz"
74# __fastcall
75#CPU_OPT="$CPU_OPT -Gr"
76
77
78CFLAGS="$CFLAGS $CPU_OPT"
79
80
81# warnings
82
83CFLAGS="$CFLAGS -W4"
84
85# stop on warning
86CFLAGS="$CFLAGS -WX"
87
88# disable logo
89CFLAGS="$CFLAGS -nologo"
90
91# the link flags
92CORE_LINK="$CORE_LINK -link -verbose:lib"
93
94# link with libcmt.lib, multithreaded
95LIBC="-MT"
96# link with msvcrt.dll
97# however, MSVC Toolkit 2003 has no MSVCRT.LIB
98#LIBC="-MD"
99
100CFLAGS="$CFLAGS $LIBC"
101
102CORE_LIBS="$CORE_LIBS kernel32.lib user32.lib"
103
104# Win32 GUI mode application
105#CORE_LINK="$CORE_LINK -subsystem:windows -entry:mainCRTStartup"
106
107# debug
108# msvc under Wine issues
109# C1902: Program database manager mismatch; please check your installation
110if [ -z "$NGX_WINE" ]; then
111   CFLAGS="$CFLAGS -Zi"
112   CORE_LINK="$CORE_LINK -debug"
113fi
114
115
116# MSVC 2005 supports C99 variadic macros
117if [ "$ngx_msvc_ver" -ge 14 ]; then
118    have=NGX_HAVE_C99_VARIADIC_MACROS . auto/have
119fi
120
121
122# precompiled headers
123CORE_DEPS="$CORE_DEPS $NGX_OBJS/ngx_config.pch"
124CORE_LINK="$CORE_LINK $NGX_OBJS/ngx_pch.obj"
125NGX_PCH="$NGX_OBJS/ngx_config.pch"
126NGX_BUILD_PCH="-Ycngx_config.h -Fp$NGX_OBJS/ngx_config.pch"
127NGX_USE_PCH="-Yungx_config.h -Fp$NGX_OBJS/ngx_config.pch"
128
129
130# the resource file
131NGX_RES="$NGX_OBJS/nginx.res"
132NGX_RCC="rc -fo$NGX_RES \$(CORE_INCS) $NGX_WIN32_RC"
133CORE_LINK="$NGX_RES $CORE_LINK"
134
135
136# dynamic modules
137#MAIN_LINK="-link -def:$NGX_OBJS/nginx.def"
138#MODULE_LINK="-LD $NGX_OBJS/nginx.lib"
139
140
141ngx_pic_opt=
142ngx_objout="-Fo"
143ngx_binout="-Fe"
144ngx_objext="obj"
145ngx_binext=".exe"
146
147ngx_long_start='@<<
148	'
149ngx_long_end='<<'
150ngx_long_regex_cont=' \
151	'
152ngx_long_cont='
153	'
154
155# MSVC understand / in path
156#ngx_regex_dirsep='\\'
157#ngx_dirsep="\\"
158