Imported Upstream version 7.53.1
[platform/upstream/curl.git] / winbuild / Makefile.vc
1 !IF "$(MODE)"=="static"
2 TARGET = $(LIB_NAME_STATIC)
3 AS_DLL = false
4 CFGSET=true
5 !ELSEIF "$(MODE)"=="dll"
6 TARGET = $(LIB_NAME_DLL)
7 AS_DLL = true
8 CFGSET=true
9 !ELSE
10 !MESSAGE Invalid mode: $(MODE)
11
12 #######################
13 # Usage
14 #
15
16 !MESSAGE Usage: nmake /f Makefile.vc mode=<static or dll> <options>
17 !MESSAGE where <options> is one or many of:
18 !MESSAGE   VC=<6,7,8,9,10,11,12,14>     - VC versions
19 !MESSAGE   WITH_DEVEL=<path>            - Paths for the development files (SSL, zlib, etc.)
20 !MESSAGE                                  Defaults to sibbling directory deps: ../deps
21 !MESSAGE                                  Libraries can be fetched at http://pecl2.php.net/downloads/php-windows-builds/
22 !MESSAGE                                  Uncompress them into the deps folder.
23 !MESSAGE   WITH_SSL=<dll or static>     - Enable OpenSSL support, DLL or static
24 !MESSAGE   ENABLE_NGHTTP2=<yes or no>   - Enable HTTP/2 support, defaults to no
25 !MESSAGE                                  Requires OpenSSL
26 !MESSAGE   WITH_CARES=<dll or static>   - Enable c-ares support, DLL or static
27 !MESSAGE   WITH_ZLIB=<dll or static>    - Enable zlib support, DLL or static
28 !MESSAGE   WITH_SSH2=<dll or static>    - Enable libSSH2 support, DLL or static
29 !MESSAGE   WITH_MBEDTLS=<dll or static> - Enable mbedTLS support, DLL or static
30 !MESSAGE   ENABLE_IDN=<yes or no>       - Enable use of Windows IDN APIs, defaults to yes
31 !MESSAGE                                  Requires Windows Vista or later, or installation from:
32 !MESSAGE                                  https://www.microsoft.com/en-us/download/details.aspx?id=734
33 !MESSAGE   ENABLE_IPV6=<yes or no>      - Enable IPv6, defaults to yes
34 !MESSAGE   ENABLE_SSPI=<yes or no>      - Enable SSPI support, defaults to yes
35 !MESSAGE   ENABLE_WINSSL=<yes or no>    - Enable native Windows SSL support, defaults to yes
36 !MESSAGE   GEN_PDB=<yes or no>          - Generate Program Database (debug symbols for release build)
37 !MESSAGE   DEBUG=<yes or no>            - Debug builds
38 !MESSAGE   MACHINE=<x86 or x64>         - Target architecture (default x64 on AMD64, x86 on others)
39 !ERROR please choose a valid mode
40
41 !ENDIF
42
43 !INCLUDE "../lib/Makefile.inc"
44 LIBCURL_OBJS=$(CSOURCES:.c=.obj)
45
46 !INCLUDE "../src/Makefile.inc"
47
48 # tool_hugehelp has a special rule
49 CURL_OBJS=$(CURL_CFILES:tool_hugehelp.c=)
50
51 CURL_OBJS=$(CURL_OBJS:.c=.obj)
52
53
54 # backwards compatible check for USE_SSPI
55 !IFDEF USE_SSPI
56 ENABLE_SSPI = $(USE_SSPI)
57 !ENDIF
58
59 # default options
60
61 !IFNDEF MACHINE
62 # Note: nmake magically changes the value of PROCESSOR_ARCHITECTURE from "AMD64"
63 # to "x86" when building in a 32 bit build environment on a 64 bit machine.
64 !IF "$(PROCESSOR_ARCHITECTURE)"=="AMD64"
65 MACHINE = x64
66 !ELSE
67 MACHINE = x86
68 !ENDIF
69 !ENDIF
70
71 !IFNDEF ENABLE_IDN
72 USE_IDN = true
73 !ELSEIF "$(ENABLE_IDN)"=="yes"
74 USE_IDN = true
75 !ELSEIF "$(ENABLE_IDN)"=="no"
76 USE_IDN = false
77 !ENDIF
78
79 !IFNDEF ENABLE_IPV6
80 USE_IPV6 = true
81 !ELSEIF "$(ENABLE_IPV6)"=="yes"
82 USE_IPV6 = true
83 !ELSEIF "$(ENABLE_IPV6)"=="no"
84 USE_IPV6 = false
85 !ENDIF
86
87 !IFNDEF ENABLE_SSPI
88 USE_SSPI = true
89 !ELSEIF "$(ENABLE_SSPI)"=="yes"
90 USE_SSPI = true
91 !ELSEIF "$(ENABLE_SSPI)"=="no"
92 USE_SSPI = false
93 !ENDIF
94
95 !IFNDEF ENABLE_WINSSL
96 !IF DEFINED(WITH_SSL) || DEFINED(WITH_MBEDTLS)
97 USE_WINSSL = false
98 !ELSE
99 USE_WINSSL = $(USE_SSPI)
100 !ENDIF
101 !ELSEIF "$(ENABLE_WINSSL)"=="yes"
102 USE_WINSSL = true
103 !ELSEIF "$(ENABLE_WINSSL)"=="no"
104 USE_WINSSL = false
105 !ENDIF
106
107 CONFIG_NAME_LIB = libcurl
108
109 !IF "$(WITH_SSL)"=="dll"
110 USE_SSL = true
111 SSL     = dll
112 !ELSEIF "$(WITH_SSL)"=="static"
113 USE_SSL = true
114 SSL     = static
115 !ENDIF
116
117 !IF "$(USE_SSL)"=="true"
118 !IF "$(ENABLE_NGHTTP2)"=="yes"
119 USE_NGHTTP2 = true
120 !ENDIF
121 !ENDIF
122
123 !IFNDEF USE_NGHTTP2
124 USE_NGHTTP2 = false
125 !ENDIF
126
127 !IF "$(WITH_MBEDTLS)"=="dll" || "$(WITH_MBEDTLS)"=="static"
128 USE_MBEDTLS = true
129 MBEDTLS     = $(WITH_MBEDTLS)
130 !ENDIF
131
132 !IF ( "$(USE_SSL)"=="true" && "$(USE_WINSSL)"=="true" ) \
133  || ( "$(USE_SSL)"=="true" && "$(USE_MBEDTLS)"=="true" ) \
134  || ( "$(USE_MBEDTLS)"=="true" && "$(USE_WINSSL)"=="true" )
135 !ERROR SSL, MBEDTLS and WINSSL are mutual exclusive options.
136 !ENDIF
137
138 !IF "$(WITH_CARES)"=="dll"
139 USE_CARES = true
140 CARES     = dll
141 !ELSEIF "$(WITH_CARES)"=="static"
142 USE_CARES = true
143 CARES     = static
144 !ENDIF
145
146 !IF "$(WITH_ZLIB)"=="dll"
147 USE_ZLIB = true
148 ZLIB     = dll
149 !ELSEIF "$(WITH_ZLIB)"=="static"
150 USE_ZLIB = true
151 ZLIB     = static
152 !ENDIF
153
154 !IF "$(WITH_SSH2)"=="dll"
155 USE_SSH2 = true
156 SSH2     = dll
157 !ELSEIF "$(WITH_SSH2)"=="static"
158 USE_SSH2 = true
159 SSH2     = static
160 !ENDIF
161
162 CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-vc$(VC)-$(MACHINE)
163
164 !IF "$(DEBUG)"=="yes"
165 CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-debug
166 !ELSE
167 CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-release
168 !ENDIF
169
170 !IF "$(AS_DLL)"=="true"
171 CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-dll
172 !ELSE
173 CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-static
174 !ENDIF
175
176 !IF "$(USE_SSL)"=="true"
177 CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-ssl-$(SSL)
178 !ENDIF
179
180 !IF "$(USE_MBEDTLS)"=="true"
181 CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-mbedtls-$(MBEDTLS)
182 !ENDIF
183
184 !IF "$(USE_CARES)"=="true"
185 CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-cares-$(CARES)
186 !ENDIF
187
188 !IF "$(USE_ZLIB)"=="true"
189 CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-zlib-$(ZLIB)
190 !ENDIF
191
192 !IF "$(USE_SSH2)"=="true"
193 CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-ssh2-$(SSH2)
194 !ENDIF
195
196 !IF "$(USE_IPV6)"=="true"
197 CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-ipv6
198 !ENDIF
199
200 !IF "$(USE_SSPI)"=="true"
201 CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-sspi
202 !ENDIF
203
204 !IF "$(USE_WINSSL)"=="true"
205 CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-winssl
206 !ENDIF
207
208 !MESSAGE configuration name: $(CONFIG_NAME_LIB)
209
210 BUILD_DIR=../builds/$(CONFIG_NAME_LIB)
211 LIBCURL_DIROBJ = ..\builds\$(CONFIG_NAME_LIB)-obj-lib
212 CURL_DIROBJ = ..\builds\$(CONFIG_NAME_LIB)-obj-curl
213 DIRDIST = ..\builds\$(CONFIG_NAME_LIB)\
214
215 $(MODE):
216         @IF NOT EXIST ..\include\curl\curlbuild.h ( \
217            CALL ..\buildconf.bat \
218         )
219         @SET DIROBJ=$(LIBCURL_DIROBJ)
220         @SET MACRO_NAME=LIBCURL_OBJS
221         @SET OUTFILE=LIBCURL_OBJS.inc
222         @gen_resp_file.bat $(LIBCURL_OBJS)
223
224         @SET DIROBJ=$(CURL_DIROBJ)
225         @SET MACRO_NAME=CURL_OBJS
226         @SET OUTFILE=CURL_OBJS.inc
227         @gen_resp_file.bat $(CURL_OBJS)
228
229         @SET CONFIG_NAME_LIB=$(CONFIG_NAME_LIB)
230         @SET MACHINE=$(MACHINE)
231         @SET USE_NGHTTP2=$(USE_NGHTTP2)
232         @SET USE_IDN=$(USE_IDN)
233         @SET USE_IPV6=$(USE_IPV6)
234         @SET USE_SSPI=$(USE_SSPI)
235         @SET USE_WINSSL=$(USE_WINSSL)
236         @$(MAKE) /NOLOGO /F MakefileBuild.vc
237
238 copy_from_lib:
239         echo copying .c...
240         FOR %%i IN ($(CURLX_CFILES:/=\)) DO copy %%i ..\src\