• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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"
24TARGET = $(LIB_NAME_STATIC)
25AS_DLL = false
26CFGSET=true
27!ELSEIF "$(MODE)"=="dll"
28TARGET = $(LIB_NAME_DLL)
29AS_DLL = true
30CFGSET=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"
65LIBCURL_OBJS=$(CSOURCES:.c=.obj)
66
67!INCLUDE "../src/Makefile.inc"
68
69# tool_hugehelp has a special rule
70CURL_OBJS=$(CURL_CFILES:tool_hugehelp.c=)
71
72CURL_OBJS=$(CURL_OBJS:.c=.obj)
73
74
75# backwards compatible check for USE_SSPI
76!IFDEF USE_SSPI
77ENABLE_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"
86MACHINE = x64
87!ELSE
88MACHINE = x86
89!ENDIF
90!ENDIF
91
92!IFNDEF ENABLE_IDN
93USE_IDN = true
94!ELSEIF "$(ENABLE_IDN)"=="yes"
95USE_IDN = true
96!ELSEIF "$(ENABLE_IDN)"=="no"
97USE_IDN = false
98!ENDIF
99
100!IFNDEF ENABLE_IPV6
101USE_IPV6 = true
102!ELSEIF "$(ENABLE_IPV6)"=="yes"
103USE_IPV6 = true
104!ELSEIF "$(ENABLE_IPV6)"=="no"
105USE_IPV6 = false
106!ENDIF
107
108!IFNDEF ENABLE_SSPI
109USE_SSPI = true
110!ELSEIF "$(ENABLE_SSPI)"=="yes"
111USE_SSPI = true
112!ELSEIF "$(ENABLE_SSPI)"=="no"
113USE_SSPI = false
114!ENDIF
115
116!IFNDEF ENABLE_WINSSL
117!IF DEFINED(WITH_SSL) || DEFINED(WITH_MBEDTLS)
118USE_WINSSL = false
119!ELSE
120USE_WINSSL = $(USE_SSPI)
121!ENDIF
122!ELSEIF "$(ENABLE_WINSSL)"=="yes"
123USE_WINSSL = true
124!ELSEIF "$(ENABLE_WINSSL)"=="no"
125USE_WINSSL = false
126!ENDIF
127
128CONFIG_NAME_LIB = libcurl
129
130!IF "$(WITH_SSL)"=="dll"
131USE_SSL = true
132SSL     = dll
133!ELSEIF "$(WITH_SSL)"=="static"
134USE_SSL = true
135SSL     = static
136!ENDIF
137
138!IF "$(ENABLE_NGHTTP2)"=="yes"
139# compatibility bit, WITH_NGHTTP2 is the correct flag
140WITH_NGHTTP2 = dll
141USE_NGHTTP2  = true
142NGHTTP2      = dll
143!ELSEIF "$(WITH_NGHTTP2)"=="dll"
144USE_NGHTTP2 = true
145NGHTTP2     = dll
146!ELSEIF "$(WITH_NGHTTP2)"=="static"
147USE_NGHTTP2 = true
148NGHTTP2     = static
149!ENDIF
150
151!IFNDEF USE_NGHTTP2
152USE_NGHTTP2 = false
153!ENDIF
154
155!IF "$(WITH_MBEDTLS)"=="dll" || "$(WITH_MBEDTLS)"=="static"
156USE_MBEDTLS = true
157MBEDTLS     = $(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"
167USE_CARES = true
168CARES     = dll
169!ELSEIF "$(WITH_CARES)"=="static"
170USE_CARES = true
171CARES     = static
172!ENDIF
173
174!IF "$(WITH_ZLIB)"=="dll"
175USE_ZLIB = true
176ZLIB     = dll
177!ELSEIF "$(WITH_ZLIB)"=="static"
178USE_ZLIB = true
179ZLIB     = static
180!ENDIF
181
182!IF "$(WITH_SSH2)"=="dll"
183USE_SSH2 = true
184SSH2     = dll
185!ELSEIF "$(WITH_SSH2)"=="static"
186USE_SSH2 = true
187SSH2     = static
188!ENDIF
189
190CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-vc$(VC)-$(MACHINE)
191
192!IF "$(DEBUG)"=="yes"
193CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-debug
194!ELSE
195CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-release
196!ENDIF
197
198!IF "$(AS_DLL)"=="true"
199CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-dll
200!ELSE
201CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-static
202!ENDIF
203
204!IF "$(USE_SSL)"=="true"
205CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-ssl-$(SSL)
206!ENDIF
207
208!IF "$(USE_MBEDTLS)"=="true"
209CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-mbedtls-$(MBEDTLS)
210!ENDIF
211
212!IF "$(USE_CARES)"=="true"
213CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-cares-$(CARES)
214!ENDIF
215
216!IF "$(USE_ZLIB)"=="true"
217CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-zlib-$(ZLIB)
218!ENDIF
219
220!IF "$(USE_SSH2)"=="true"
221CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-ssh2-$(SSH2)
222!ENDIF
223
224!IF "$(USE_IPV6)"=="true"
225CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-ipv6
226!ENDIF
227
228!IF "$(USE_SSPI)"=="true"
229CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-sspi
230!ENDIF
231
232!IF "$(USE_WINSSL)"=="true"
233CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-winssl
234!ENDIF
235
236!IF "$(USE_NGHTTP2)"=="true"
237CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-nghttp2-$(NGHTTP2)
238!ENDIF
239
240!MESSAGE configuration name: $(CONFIG_NAME_LIB)
241
242BUILD_DIR=../builds/$(CONFIG_NAME_LIB)
243LIBCURL_DIROBJ = ..\builds\$(CONFIG_NAME_LIB)-obj-lib
244CURL_DIROBJ = ..\builds\$(CONFIG_NAME_LIB)-obj-curl
245DIRDIST = ..\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	@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	@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
270copy_from_lib:
271	echo copying .c...
272	FOR %%i IN ($(CURLX_CFILES:/=\)) DO copy %%i ..\src\
273