• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#***************************************************************************
2#                                  _   _ ____  _
3#  Project                     ___| | | |  _ \| |
4#                             / __| | | | |_) | |
5#                            | (__| |_| |  _ <| |___
6#                             \___|\___/|_| \_\_____|
7#
8# Copyright (C) 1999 - 2020, 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.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 See winbuild/README.md for usage
39!ERROR please choose a valid mode
40
41!ENDIF
42
43!INCLUDE "../lib/Makefile.inc"
44LIBCURL_OBJS=$(CSOURCES:.c=.obj)
45
46!INCLUDE "../src/Makefile.inc"
47
48# tool_hugehelp has a special rule
49CURL_OBJS=$(CURL_CFILES:tool_hugehelp.c=)
50
51CURL_OBJS=$(CURL_OBJS:.c=.obj)
52
53
54# backwards compatible check for USE_SSPI
55!IFDEF USE_SSPI
56ENABLE_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"
65MACHINE = x64
66!ELSE
67MACHINE = x86
68!ENDIF
69!ENDIF
70
71!IFNDEF ENABLE_IDN
72USE_IDN = true
73!ELSEIF "$(ENABLE_IDN)"=="yes"
74USE_IDN = true
75!ELSEIF "$(ENABLE_IDN)"=="no"
76USE_IDN = false
77!ENDIF
78
79!IFNDEF ENABLE_IPV6
80USE_IPV6 = true
81!ELSEIF "$(ENABLE_IPV6)"=="yes"
82USE_IPV6 = true
83!ELSEIF "$(ENABLE_IPV6)"=="no"
84USE_IPV6 = false
85!ENDIF
86
87!IFNDEF ENABLE_SSPI
88USE_SSPI = true
89!ELSEIF "$(ENABLE_SSPI)"=="yes"
90USE_SSPI = true
91!ELSEIF "$(ENABLE_SSPI)"=="no"
92USE_SSPI = false
93!ENDIF
94
95!IFNDEF ENABLE_SCHANNEL
96!IF DEFINED(WITH_SSL) || DEFINED(WITH_MBEDTLS)
97USE_SCHANNEL = false
98!ELSE
99USE_SCHANNEL = $(USE_SSPI)
100!ENDIF
101!ELSEIF "$(ENABLE_SCHANNEL)"=="yes"
102USE_SCHANNEL = true
103!ELSEIF "$(ENABLE_SCHANNEL)"=="no"
104USE_SCHANNEL = false
105!ENDIF
106
107!IFNDEF ENABLE_OPENSSL_AUTO_LOAD_CONFIG
108ENABLE_OPENSSL_AUTO_LOAD_CONFIG = true
109!ELSEIF "$(ENABLE_OPENSSL_AUTO_LOAD_CONFIG)"=="yes"
110!UNDEF ENABLE_OPENSSL_AUTO_LOAD_CONFIG
111ENABLE_OPENSSL_AUTO_LOAD_CONFIG = true
112!ELSEIF "$(ENABLE_OPENSSL_AUTO_LOAD_CONFIG)"=="no"
113!UNDEF ENABLE_OPENSSL_AUTO_LOAD_CONFIG
114ENABLE_OPENSSL_AUTO_LOAD_CONFIG = false
115!ENDIF
116
117!IFNDEF ENABLE_UNICODE
118USE_UNICODE = false
119!ELSEIF "$(ENABLE_UNICODE)"=="yes"
120USE_UNICODE = true
121!ELSEIF "$(ENABLE_UNICODE)"=="no"
122USE_UNICODE = false
123!ENDIF
124
125CONFIG_NAME_LIB = libcurl
126
127!IF "$(WITH_SSL)"=="dll"
128USE_SSL = true
129SSL     = dll
130!ELSEIF "$(WITH_SSL)"=="static"
131USE_SSL = true
132SSL     = static
133!ENDIF
134
135!IF "$(ENABLE_NGHTTP2)"=="yes"
136# compatibility bit, WITH_NGHTTP2 is the correct flag
137WITH_NGHTTP2 = dll
138USE_NGHTTP2  = true
139NGHTTP2      = dll
140!ELSEIF "$(WITH_NGHTTP2)"=="dll"
141USE_NGHTTP2 = true
142NGHTTP2     = dll
143!ELSEIF "$(WITH_NGHTTP2)"=="static"
144USE_NGHTTP2 = true
145NGHTTP2     = static
146!ENDIF
147
148!IFNDEF USE_NGHTTP2
149USE_NGHTTP2 = false
150!ENDIF
151
152!IF "$(WITH_MBEDTLS)"=="dll" || "$(WITH_MBEDTLS)"=="static"
153USE_MBEDTLS = true
154MBEDTLS     = $(WITH_MBEDTLS)
155!ENDIF
156
157!IF "$(WITH_CARES)"=="dll"
158USE_CARES = true
159CARES     = dll
160!ELSEIF "$(WITH_CARES)"=="static"
161USE_CARES = true
162CARES     = static
163!ENDIF
164
165!IF "$(WITH_ZLIB)"=="dll"
166USE_ZLIB = true
167ZLIB     = dll
168!ELSEIF "$(WITH_ZLIB)"=="static"
169USE_ZLIB = true
170ZLIB     = static
171!ENDIF
172
173!IF "$(WITH_SSH2)"=="dll"
174USE_SSH2 = true
175SSH2     = dll
176!ELSEIF "$(WITH_SSH2)"=="static"
177USE_SSH2 = true
178SSH2     = static
179!ENDIF
180
181CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-vc$(VC)-$(MACHINE)
182
183!IF "$(DEBUG)"=="yes"
184CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-debug
185!ELSE
186CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-release
187!ENDIF
188
189!IF "$(AS_DLL)"=="true"
190CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-dll
191!ELSE
192CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-static
193!ENDIF
194
195!IF "$(USE_SSL)"=="true"
196CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-ssl-$(SSL)
197!ENDIF
198
199!IF "$(USE_MBEDTLS)"=="true"
200CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-mbedtls-$(MBEDTLS)
201!ENDIF
202
203!IF "$(USE_CARES)"=="true"
204CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-cares-$(CARES)
205!ENDIF
206
207!IF "$(USE_ZLIB)"=="true"
208CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-zlib-$(ZLIB)
209!ENDIF
210
211!IF "$(USE_SSH2)"=="true"
212CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-ssh2-$(SSH2)
213!ENDIF
214
215!IF "$(USE_IPV6)"=="true"
216CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-ipv6
217!ENDIF
218
219!IF "$(USE_SSPI)"=="true"
220CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-sspi
221!ENDIF
222
223!IF "$(USE_SCHANNEL)"=="true"
224CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-schannel
225!ENDIF
226
227!IF "$(USE_NGHTTP2)"=="true"
228CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-nghttp2-$(NGHTTP2)
229!ENDIF
230
231!MESSAGE configuration name: $(CONFIG_NAME_LIB)
232
233BUILD_DIR=../builds/$(CONFIG_NAME_LIB)
234LIBCURL_DIROBJ = ..\builds\$(CONFIG_NAME_LIB)-obj-lib
235CURL_DIROBJ = ..\builds\$(CONFIG_NAME_LIB)-obj-curl
236DIRDIST = ..\builds\$(CONFIG_NAME_LIB)\
237
238$(MODE):
239	@SET DIROBJ=$(LIBCURL_DIROBJ)
240	@SET MACRO_NAME=LIBCURL_OBJS
241	@SET OUTFILE=LIBCURL_OBJS.inc
242	@CALL gen_resp_file.bat $(LIBCURL_OBJS)
243
244	@SET DIROBJ=$(CURL_DIROBJ)
245	@SET MACRO_NAME=CURL_OBJS
246	@SET OUTFILE=CURL_OBJS.inc
247	@CALL gen_resp_file.bat $(CURL_OBJS)
248
249	@SET CONFIG_NAME_LIB=$(CONFIG_NAME_LIB)
250	@SET MACHINE=$(MACHINE)
251	@SET USE_NGHTTP2=$(USE_NGHTTP2)
252	@SET USE_IDN=$(USE_IDN)
253	@SET USE_IPV6=$(USE_IPV6)
254	@SET USE_SSPI=$(USE_SSPI)
255	@SET USE_SCHANNEL=$(USE_SCHANNEL)
256	@SET USE_UNICODE=$(USE_UNICODE)
257# compatibility bit
258	@SET WITH_NGHTTP2=$(WITH_NGHTTP2)
259
260	@$(MAKE) /NOLOGO /F MakefileBuild.vc
261
262copy_from_lib:
263	echo copying .c...
264	FOR %%i IN ($(CURLX_CFILES:/=\)) DO copy %%i ..\src\
265
266clean:
267	$(MAKE) /NOLOGO /F MakefileBuild.vc $@
268