blob: 96c64c80a04f28b539d50687bd74e45ac48cfe0f [file] [log] [blame]
Igor Sysoevc0edbcc2004-10-21 15:34:38 +00001
2# Copyright (C) Igor Sysoev
3
4
Igor Sysoev0ebcba52007-11-15 11:00:06 +00005# MSVC 6.0 SP2, MSVC Toolkit 2003 (7.1), MSVC 2005 Express Edition SP1 (8.0)
Igor Sysoevc0edbcc2004-10-21 15:34:38 +00006
7# optimizations
8
Igor Sysoev899b44e2005-05-12 14:58:06 +00009# maximize speed, equivalent to -Og -Oi -Ot -Oy -Ob2 -Gs -GF -Gy
Igor Sysoevc0edbcc2004-10-21 15:34:38 +000010CFLAGS="$CFLAGS -O2"
Igor Sysoev899b44e2005-05-12 14:58:06 +000011
Igor Sysoevc0edbcc2004-10-21 15:34:38 +000012# enable global optimization
Igor Sysoev899b44e2005-05-12 14:58:06 +000013#CFLAGS="$CFLAGS -Og"
Igor Sysoevc0edbcc2004-10-21 15:34:38 +000014# enable intrinsic functions
Igor Sysoev899b44e2005-05-12 14:58:06 +000015#CFLAGS="$CFLAGS -Oi"
16
17# disable inline expansion
18#CFLAGS="$CFLAGS -Ob0"
19# explicit inline expansion
20#CFLAGS="$CFLAGS -Ob1"
21# explicit and implicit inline expansion
22#CFLAGS="$CFLAGS -Ob2"
23
Igor Sysoevc0edbcc2004-10-21 15:34:38 +000024# enable frame pointer omission
Igor Sysoev899b44e2005-05-12 14:58:06 +000025#CFLAGS="$CFLAGS -Oy"
Igor Sysoevc0edbcc2004-10-21 15:34:38 +000026# disable stack checking calls
Igor Sysoev899b44e2005-05-12 14:58:06 +000027#CFLAGS="$CFLAGS -Gs"
28
29# pools strings as read/write
30#CFLAGS="$CFLAGS -Gf"
31# pools strings as read-only
32#CFLAGS="$CFLAGS -GF"
33
Igor Sysoevc0edbcc2004-10-21 15:34:38 +000034
35case $CPU in
36 pentium)
37 # optimize for Pentium and Athlon
38 CPU_OPT="-G5"
39 ;;
40
41 pentiumpro)
42 # optimize for Pentium Pro, Pentium II and Pentium III
43 CPU_OPT="-G6"
44 ;;
45
46 pentium4)
Igor Sysoev1b735832004-11-11 14:07:14 +000047 # optimize for Pentium 4, MSVC 7
48 CPU_OPT="-G7"
Igor Sysoevc0edbcc2004-10-21 15:34:38 +000049 ;;
50esac
51
Igor Sysoevafd7ec52006-05-29 17:28:12 +000052# __cdecl, use with OpenSSL, md5 asm, and sha1 asm
Igor Sysoevd3283ff2005-12-05 13:18:09 +000053#CPU_OPT="$CPU_OPT -Gd"
Igor Sysoev4d656dc2005-03-22 16:02:46 +000054# __stdcall
55#CPU_OPT="$CPU_OPT -Gz"
56# __fastcall
57CPU_OPT="$CPU_OPT -Gr"
58
59
Igor Sysoevc0edbcc2004-10-21 15:34:38 +000060CFLAGS="$CFLAGS $CPU_OPT"
61
62
63# warnings
64
Igor Sysoevc0edbcc2004-10-21 15:34:38 +000065CFLAGS="$CFLAGS -W4"
66
67# stop on warning
68CFLAGS="$CFLAGS -WX"
69
Igor Sysoevc0edbcc2004-10-21 15:34:38 +000070# disable logo
71CFLAGS="$CFLAGS -nologo"
72
Igor Sysoev1b735832004-11-11 14:07:14 +000073
Igor Sysoevc0edbcc2004-10-21 15:34:38 +000074LINK="\$(CC)"
75
Igor Sysoev1b735832004-11-11 14:07:14 +000076# the link flags
Igor Sysoevc0edbcc2004-10-21 15:34:38 +000077CORE_LINK="$CORE_LINK -link -verbose:lib"
78
Igor Sysoev1b735832004-11-11 14:07:14 +000079if [ $NGX_CC_NAME = msvc7 ]; then
80 # link with libcmt.lib, multithreaded
81 LIBC="-MT"
82else
83 # link with msvcrt.dll
84 LIBC="-MD"
85fi
86
87CFLAGS="$CFLAGS $LIBC"
88
89# Win32 GUI mode application
90CORE_LIBS="$CORE_LIBS kernel32.lib user32.lib"
91CORE_LINK="$CORE_LINK -subsystem:windows -entry:mainCRTStartup"
92
Igor Sysoevc0edbcc2004-10-21 15:34:38 +000093# debug
Igor Sysoeva7e01da2007-11-15 14:22:12 +000094if [ $NGX_CC_NAME != msvc8 ]; then
95 CFLAGS="$CFLAGS -Zi"
96 CORE_LINK="$CORE_LINK -debug"
97fi
Igor Sysoevc0edbcc2004-10-21 15:34:38 +000098
Igor Sysoev1b735832004-11-11 14:07:14 +000099
Igor Sysoevc0edbcc2004-10-21 15:34:38 +0000100# precompiled headers
Igor Sysoeva1010482007-11-15 10:25:30 +0000101CORE_DEPS="$CORE_DEPS $NGX_OBJS/ngx_config.pch"
102NGX_PCH="$NGX_OBJS/ngx_config.pch"
103NGX_BUILD_PCH="-Ycngx_config.h -Fp$NGX_OBJS/ngx_config.pch"
104NGX_USE_PCH="-Yungx_config.h -Fp$NGX_OBJS/ngx_config.pch"
Igor Sysoev1b735832004-11-11 14:07:14 +0000105
106
107# the resource file
Igor Sysoevf6906042004-11-25 16:17:31 +0000108NGX_RES="$NGX_OBJS/nginx.res"
Igor Sysoev1b735832004-11-11 14:07:14 +0000109NGX_RCC="rc -fo$NGX_RES \$(CORE_INCS) $NGX_WIN32_RC"
110CORE_LINK="$NGX_RES $CORE_LINK"
111
Igor Sysoevc0edbcc2004-10-21 15:34:38 +0000112
113ngx_objout="-Fo"
114ngx_binout="-Fe"
115ngx_objext="obj"
116ngx_binext=".exe"
117
Igor Sysoev8a2b2fb2006-04-14 09:53:38 +0000118if [ "$BMAKE" = nmake ]; then
119 # MS nmake
Igor Sysoev94e32ce2006-04-07 14:08:04 +0000120
Igor Sysoev8a2b2fb2006-04-14 09:53:38 +0000121 ngx_long_start='@<<
Igor Sysoev09c684b2005-11-09 17:25:55 +0000122 '
Igor Sysoev8a2b2fb2006-04-14 09:53:38 +0000123 ngx_long_end='<<'
124 ngx_long_regex_cont=' \
Igor Sysoev09c684b2005-11-09 17:25:55 +0000125 '
Igor Sysoev8a2b2fb2006-04-14 09:53:38 +0000126 ngx_long_cont='
Igor Sysoev09c684b2005-11-09 17:25:55 +0000127 '
Igor Sysoev8a2b2fb2006-04-14 09:53:38 +0000128
129else
130 # Borland make
131
132 ngx_long_start='@&&|
133 '
134 ngx_long_end='|'
135fi
136
Igor Sysoev94e32ce2006-04-07 14:08:04 +0000137# MSVC understand / in path
Igor Sysoevc0edbcc2004-10-21 15:34:38 +0000138#ngx_regex_dirsep='\\'
139#ngx_dirsep="\\"