smtp: use the upload buffer size for scratch buffer malloc
[platform/upstream/curl.git] / winbuild / Makefile.vc
1 #***************************************************************************
2 #                                  _   _ ____  _
3 #  Project                     ___| | | |  _ \| |
4 #                             / __| | | | |_) | |
5 #                            | (__| |_| |  _ <| |___
6 #                             \___|\___/|_| \_\_____|
7 #
8 # Copyright (C) 1999 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
9 #
10 # This software is licensed as described in the file COPYING, which
11 # you should have received as part of this distribution. The terms
12 # are also available at https://curl.haxx.se/docs/copyright.html.
13 #
14 # You may opt to use, copy, modify, merge, publish, distribute and/or sell
15 # copies of the Software, and permit persons to whom the Software is
16 # furnished to do so, under the terms of the COPYING file.
17 #
18 # This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19 # KIND, either express or implied.
20 #
21 #***************************************************************************
22
23 !IF "$(MODE)"=="static"
24 TARGET = $(LIB_NAME_STATIC)
25 AS_DLL = false
26 CFGSET=true
27 !ELSEIF "$(MODE)"=="dll"
28 TARGET = $(LIB_NAME_DLL)
29 AS_DLL = true
30 CFGSET=true
31 !ELSE
32 !MESSAGE Invalid mode: $(MODE)
33
34 #######################
35 # Usage
36 #
37
38 !MESSAGE Usage: nmake /f Makefile.vc mode=<static or dll> <options>
39 !MESSAGE where <options> is one or many of:
40 !MESSAGE   VC=<6,7,8,9,10,11,12,14,15>  - VC versions
41 !MESSAGE   WITH_DEVEL=<path>            - Paths for the development files (SSL, zlib, etc.)
42 !MESSAGE                                  Defaults to sibbling directory deps: ../deps
43 !MESSAGE                                  Libraries can be fetched at http://pecl2.php.net/downloads/php-windows-builds/
44 !MESSAGE                                  Uncompress them into the deps folder.
45 !MESSAGE   WITH_SSL=<dll or static>     - Enable OpenSSL support, DLL or static
46 !MESSAGE   WITH_NGHTTP2=<dll or static> - Enable HTTP/2 support, DLL or static
47 !MESSAGE   WITH_CARES=<dll or static>   - Enable c-ares support, DLL or static
48 !MESSAGE   WITH_ZLIB=<dll or static>    - Enable zlib support, DLL or static
49 !MESSAGE   WITH_SSH2=<dll or static>    - Enable libSSH2 support, DLL or static
50 !MESSAGE   WITH_MBEDTLS=<dll or static> - Enable mbedTLS support, DLL or static
51 !MESSAGE   ENABLE_IDN=<yes or no>       - Enable use of Windows IDN APIs, defaults to yes
52 !MESSAGE                                  Requires Windows Vista or later, or installation from:
53 !MESSAGE                                  https://www.microsoft.com/en-us/download/details.aspx?id=734
54 !MESSAGE   ENABLE_IPV6=<yes or no>      - Enable IPv6, defaults to yes
55 !MESSAGE   ENABLE_SSPI=<yes or no>      - Enable SSPI support, defaults to yes
56 !MESSAGE   ENABLE_WINSSL=<yes or no>    - Enable native Windows SSL support, defaults to yes
57 !MESSAGE   GEN_PDB=<yes or no>          - Generate Program Database (debug symbols for release build)
58 !MESSAGE   DEBUG=<yes or no>            - Debug builds
59 !MESSAGE   MACHINE=<x86 or x64>         - Target architecture (default x64 on AMD64, x86 on others)
60 !ERROR please choose a valid mode
61
62 !ENDIF
63
64 !INCLUDE "../lib/Makefile.inc"
65 LIBCURL_OBJS=$(CSOURCES:.c=.obj)
66
67 !INCLUDE "../src/Makefile.inc"
68
69 # tool_hugehelp has a special rule
70 CURL_OBJS=$(CURL_CFILES:tool_hugehelp.c=)
71
72 CURL_OBJS=$(CURL_OBJS:.c=.obj)
73
74
75 # backwards compatible check for USE_SSPI
76 !IFDEF USE_SSPI
77 ENABLE_SSPI = $(USE_SSPI)
78 !ENDIF
79
80 # default options
81
82 !IFNDEF MACHINE
83 # Note: nmake magically changes the value of PROCESSOR_ARCHITECTURE from "AMD64"
84 # to "x86" when building in a 32 bit build environment on a 64 bit machine.
85 !IF "$(PROCESSOR_ARCHITECTURE)"=="AMD64"
86 MACHINE = x64
87 !ELSE
88 MACHINE = x86
89 !ENDIF
90 !ENDIF
91
92 !IFNDEF ENABLE_IDN
93 USE_IDN = true
94 !ELSEIF "$(ENABLE_IDN)"=="yes"
95 USE_IDN = true
96 !ELSEIF "$(ENABLE_IDN)"=="no"
97 USE_IDN = false
98 !ENDIF
99
100 !IFNDEF ENABLE_IPV6
101 USE_IPV6 = true
102 !ELSEIF "$(ENABLE_IPV6)"=="yes"
103 USE_IPV6 = true
104 !ELSEIF "$(ENABLE_IPV6)"=="no"
105 USE_IPV6 = false
106 !ENDIF
107
108 !IFNDEF ENABLE_SSPI
109 USE_SSPI = true
110 !ELSEIF "$(ENABLE_SSPI)"=="yes"
111 USE_SSPI = true
112 !ELSEIF "$(ENABLE_SSPI)"=="no"
113 USE_SSPI = false
114 !ENDIF
115
116 !IFNDEF ENABLE_WINSSL
117 !IF DEFINED(WITH_SSL) || DEFINED(WITH_MBEDTLS)
118 USE_WINSSL = false
119 !ELSE
120 USE_WINSSL = $(USE_SSPI)
121 !ENDIF
122 !ELSEIF "$(ENABLE_WINSSL)"=="yes"
123 USE_WINSSL = true
124 !ELSEIF "$(ENABLE_WINSSL)"=="no"
125 USE_WINSSL = false
126 !ENDIF
127
128 CONFIG_NAME_LIB = libcurl
129
130 !IF "$(WITH_SSL)"=="dll"
131 USE_SSL = true
132 SSL     = dll
133 !ELSEIF "$(WITH_SSL)"=="static"
134 USE_SSL = true
135 SSL     = static
136 !ENDIF
137
138 !IF "$(ENABLE_NGHTTP2)"=="yes"
139 # compatibility bit, WITH_NGHTTP2 is the correct flag
140 WITH_NGHTTP2 = dll
141 USE_NGHTTP2  = true
142 NGHTTP2      = dll
143 !ELSEIF "$(WITH_NGHTTP2)"=="dll"
144 USE_NGHTTP2 = true
145 NGHTTP2     = dll
146 !ELSEIF "$(WITH_NGHTTP2)"=="static"
147 USE_NGHTTP2 = true
148 NGHTTP2     = static
149 !ENDIF
150
151 !IFNDEF USE_NGHTTP2
152 USE_NGHTTP2 = false
153 !ENDIF
154
155 !IF "$(WITH_MBEDTLS)"=="dll" || "$(WITH_MBEDTLS)"=="static"
156 USE_MBEDTLS = true
157 MBEDTLS     = $(WITH_MBEDTLS)
158 !ENDIF
159
160 !IF ( "$(USE_SSL)"=="true" && "$(USE_WINSSL)"=="true" ) \
161  || ( "$(USE_SSL)"=="true" && "$(USE_MBEDTLS)"=="true" ) \
162  || ( "$(USE_MBEDTLS)"=="true" && "$(USE_WINSSL)"=="true" )
163 !ERROR SSL, MBEDTLS and WINSSL are mutual exclusive options.
164 !ENDIF
165
166 !IF "$(WITH_CARES)"=="dll"
167 USE_CARES = true
168 CARES     = dll
169 !ELSEIF "$(WITH_CARES)"=="static"
170 USE_CARES = true
171 CARES     = static
172 !ENDIF
173
174 !IF "$(WITH_ZLIB)"=="dll"
175 USE_ZLIB = true
176 ZLIB     = dll
177 !ELSEIF "$(WITH_ZLIB)"=="static"
178 USE_ZLIB = true
179 ZLIB     = static
180 !ENDIF
181
182 !IF "$(WITH_SSH2)"=="dll"
183 USE_SSH2 = true
184 SSH2     = dll
185 !ELSEIF "$(WITH_SSH2)"=="static"
186 USE_SSH2 = true
187 SSH2     = static
188 !ENDIF
189
190 CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-vc$(VC)-$(MACHINE)
191
192 !IF "$(DEBUG)"=="yes"
193 CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-debug
194 !ELSE
195 CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-release
196 !ENDIF
197
198 !IF "$(AS_DLL)"=="true"
199 CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-dll
200 !ELSE
201 CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-static
202 !ENDIF
203
204 !IF "$(USE_SSL)"=="true"
205 CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-ssl-$(SSL)
206 !ENDIF
207
208 !IF "$(USE_MBEDTLS)"=="true"
209 CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-mbedtls-$(MBEDTLS)
210 !ENDIF
211
212 !IF "$(USE_CARES)"=="true"
213 CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-cares-$(CARES)
214 !ENDIF
215
216 !IF "$(USE_ZLIB)"=="true"
217 CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-zlib-$(ZLIB)
218 !ENDIF
219
220 !IF "$(USE_SSH2)"=="true"
221 CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-ssh2-$(SSH2)
222 !ENDIF
223
224 !IF "$(USE_IPV6)"=="true"
225 CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-ipv6
226 !ENDIF
227
228 !IF "$(USE_SSPI)"=="true"
229 CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-sspi
230 !ENDIF
231
232 !IF "$(USE_WINSSL)"=="true"
233 CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-winssl
234 !ENDIF
235
236 !IF "$(USE_NGHTTP2)"=="true"
237 CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-nghttp2-$(NGHTTP2)
238 !ENDIF
239
240 !MESSAGE configuration name: $(CONFIG_NAME_LIB)
241
242 BUILD_DIR=../builds/$(CONFIG_NAME_LIB)
243 LIBCURL_DIROBJ = ..\builds\$(CONFIG_NAME_LIB)-obj-lib
244 CURL_DIROBJ = ..\builds\$(CONFIG_NAME_LIB)-obj-curl
245 DIRDIST = ..\builds\$(CONFIG_NAME_LIB)\
246
247 $(MODE):
248         @SET DIROBJ=$(LIBCURL_DIROBJ)
249         @SET MACRO_NAME=LIBCURL_OBJS
250         @SET OUTFILE=LIBCURL_OBJS.inc
251         @CALL gen_resp_file.bat $(LIBCURL_OBJS)
252
253         @SET DIROBJ=$(CURL_DIROBJ)
254         @SET MACRO_NAME=CURL_OBJS
255         @SET OUTFILE=CURL_OBJS.inc
256         @CALL gen_resp_file.bat $(CURL_OBJS)
257
258         @SET CONFIG_NAME_LIB=$(CONFIG_NAME_LIB)
259         @SET MACHINE=$(MACHINE)
260         @SET USE_NGHTTP2=$(USE_NGHTTP2)
261         @SET USE_IDN=$(USE_IDN)
262         @SET USE_IPV6=$(USE_IPV6)
263         @SET USE_SSPI=$(USE_SSPI)
264         @SET USE_WINSSL=$(USE_WINSSL)
265 # compatibility bit
266         @SET WITH_NGHTTP2=$(WITH_NGHTTP2)
267
268         @$(MAKE) /NOLOGO /F MakefileBuild.vc
269
270 copy_from_lib:
271         echo copying .c...
272         FOR %%i IN ($(CURLX_CFILES:/=\)) DO copy %%i ..\src\