bd5c8e0323f4f876fb4726db84cca025b004f547
[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   WITH_CARES=<dll or static>   - Enable c-ares support, DLL or static
25 !MESSAGE   WITH_ZLIB=<dll or static>    - Enable zlib support, DLL or static
26 !MESSAGE   WITH_SSH2=<dll or static>    - Enable libSSH2 support, DLL or static
27 !MESSAGE   WITH_MBEDTLS=<dll or static> - Enable mbedTLS support, DLL or static
28 !MESSAGE   ENABLE_IDN=<yes or no>       - Enable use of Windows IDN APIs, defaults to yes
29 !MESSAGE                                  Requires Windows Vista or later, or installation from:
30 !MESSAGE                                  https://www.microsoft.com/en-us/download/details.aspx?id=734
31 !MESSAGE   ENABLE_IPV6=<yes or no>      - Enable IPv6, defaults to yes
32 !MESSAGE   ENABLE_SSPI=<yes or no>      - Enable SSPI support, defaults to yes
33 !MESSAGE   ENABLE_WINSSL=<yes or no>    - Enable native Windows SSL support, defaults to yes
34 !MESSAGE   GEN_PDB=<yes or no>          - Generate Program Database (debug symbols for release build)
35 !MESSAGE   DEBUG=<yes or no>            - Debug builds
36 !MESSAGE   MACHINE=<x86 or x64>         - Target architecture (default x64 on AMD64, x86 on others)
37 !ERROR please choose a valid mode
38
39 !ENDIF
40
41 !INCLUDE "../lib/Makefile.inc"
42 LIBCURL_OBJS=$(CSOURCES:.c=.obj)
43
44 !INCLUDE "../src/Makefile.inc"
45
46 # tool_hugehelp has a special rule
47 CURL_OBJS=$(CURL_CFILES:tool_hugehelp.c=)
48
49 CURL_OBJS=$(CURL_OBJS:.c=.obj)
50
51
52 # backwards compatible check for USE_SSPI
53 !IFDEF USE_SSPI
54 ENABLE_SSPI = $(USE_SSPI)
55 !ENDIF
56
57 # default options
58 !IFNDEF MACHINE
59 !IF "$(PROCESSOR_ARCHITECTURE)"=="AMD64"
60 MACHINE = x64
61 !ELSE
62 MACHINE = x86
63 !ENDIF
64 !ENDIF
65
66 !IFNDEF ENABLE_IDN
67 USE_IDN = true
68 !ELSEIF "$(ENABLE_IDN)"=="yes"
69 USE_IDN = true
70 !ELSEIF "$(ENABLE_IDN)"=="no"
71 USE_IDN = false
72 !ENDIF
73
74 !IFNDEF ENABLE_IPV6
75 USE_IPV6 = true
76 !ELSEIF "$(ENABLE_IPV6)"=="yes"
77 USE_IPV6 = true
78 !ELSEIF "$(ENABLE_IPV6)"=="no"
79 USE_IPV6 = false
80 !ENDIF
81
82 !IFNDEF ENABLE_SSPI
83 USE_SSPI = true
84 !ELSEIF "$(ENABLE_SSPI)"=="yes"
85 USE_SSPI = true
86 !ELSEIF "$(ENABLE_SSPI)"=="no"
87 USE_SSPI = false
88 !ENDIF
89
90 !IFNDEF ENABLE_WINSSL
91 !IF DEFINED(WITH_SSL) || DEFINED(WITH_MBEDTLS)
92 USE_WINSSL = false
93 !ELSE
94 USE_WINSSL = $(USE_SSPI)
95 !ENDIF
96 !ELSEIF "$(ENABLE_WINSSL)"=="yes"
97 USE_WINSSL = true
98 !ELSEIF "$(ENABLE_WINSSL)"=="no"
99 USE_WINSSL = false
100 !ENDIF
101
102 CONFIG_NAME_LIB = libcurl
103
104 !IF "$(WITH_SSL)"=="dll"
105 USE_SSL = true
106 SSL     = dll
107 !ELSEIF "$(WITH_SSL)"=="static"
108 USE_SSL = true
109 SSL     = static
110 !ENDIF
111
112 !IF "$(WITH_MBEDTLS)"=="dll" || "$(WITH_MBEDTLS)"=="static"
113 USE_MBEDTLS = true
114 MBEDTLS     = $(WITH_MBEDTLS)
115 !ENDIF
116
117 !IF ( "$(USE_SSL)"=="true" && "$(USE_WINSSL)"=="true" ) \
118  || ( "$(USE_SSL)"=="true" && "$(USE_MBEDTLS)"=="true" ) \
119  || ( "$(USE_MBEDTLS)"=="true" && "$(USE_WINSSL)"=="true" )
120 !ERROR SSL, MBEDTLS and WINSSL are mutual exclusive options.
121 !ENDIF
122
123 !IF "$(WITH_CARES)"=="dll"
124 USE_CARES = true
125 CARES     = dll
126 !ELSEIF "$(WITH_CARES)"=="static"
127 USE_CARES = true
128 CARES     = static
129 !ENDIF
130
131 !IF "$(WITH_ZLIB)"=="dll"
132 USE_ZLIB = true
133 ZLIB     = dll
134 !ELSEIF "$(WITH_ZLIB)"=="static"
135 USE_ZLIB = true
136 ZLIB     = static
137 !ENDIF
138
139 !IF "$(WITH_SSH2)"=="dll"
140 USE_SSH2 = true
141 SSH2     = dll
142 !ELSEIF "$(WITH_SSH2)"=="static"
143 USE_SSH2 = true
144 SSH2     = static
145 !ENDIF
146
147 CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-vc$(VC)-$(MACHINE)
148
149 !IF "$(DEBUG)"=="yes"
150 CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-debug
151 !ELSE
152 CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-release
153 !ENDIF
154
155 !IF "$(AS_DLL)"=="true"
156 CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-dll
157 !ELSE
158 CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-static
159 !ENDIF
160
161 !IF "$(USE_SSL)"=="true"
162 CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-ssl-$(SSL)
163 !ENDIF
164
165 !IF "$(USE_MBEDTLS)"=="true"
166 CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-mbedtls-$(MBEDTLS)
167 !ENDIF
168
169 !IF "$(USE_CARES)"=="true"
170 CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-cares-$(CARES)
171 !ENDIF
172
173 !IF "$(USE_ZLIB)"=="true"
174 CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-zlib-$(ZLIB)
175 !ENDIF
176
177 !IF "$(USE_SSH2)"=="true"
178 CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-ssh2-$(SSH2)
179 !ENDIF
180
181 !IF "$(USE_IPV6)"=="true"
182 CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-ipv6
183 !ENDIF
184
185 !IF "$(USE_SSPI)"=="true"
186 CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-sspi
187 !ENDIF
188
189 !IF "$(USE_WINSSL)"=="true"
190 CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-winssl
191 !ENDIF
192
193 !MESSAGE configuration name: $(CONFIG_NAME_LIB)
194
195 BUILD_DIR=../builds/$(CONFIG_NAME_LIB)
196 LIBCURL_DIROBJ = ..\builds\$(CONFIG_NAME_LIB)-obj-lib
197 CURL_DIROBJ = ..\builds\$(CONFIG_NAME_LIB)-obj-curl
198 DIRDIST = ..\builds\$(CONFIG_NAME_LIB)\
199
200 $(MODE):
201         @IF NOT EXIST ..\include\curl\curlbuild.h ( \
202            CALL ..\buildconf.bat \
203         )
204         @SET DIROBJ=$(LIBCURL_DIROBJ)
205         @SET MACRO_NAME=LIBCURL_OBJS
206         @SET OUTFILE=LIBCURL_OBJS.inc
207         @gen_resp_file.bat $(LIBCURL_OBJS)
208
209         @SET DIROBJ=$(CURL_DIROBJ)
210         @SET MACRO_NAME=CURL_OBJS
211         @SET OUTFILE=CURL_OBJS.inc
212         @gen_resp_file.bat $(CURL_OBJS)
213
214         @SET CONFIG_NAME_LIB=$(CONFIG_NAME_LIB)
215         @SET MACHINE=$(MACHINE)
216         @SET USE_IDN=$(USE_IDN)
217         @SET USE_IPV6=$(USE_IPV6)
218         @SET USE_SSPI=$(USE_SSPI)
219         @SET USE_WINSSL=$(USE_WINSSL)
220         @$(MAKE) /NOLOGO /F MakefileBuild.vc
221
222 copy_from_lib:
223         echo copying .c...
224         FOR %%i IN ($(CURLX_CFILES:/=\)) DO copy %%i ..\src\