• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#***************************************************************************
2#                                  _   _ ____  _
3#  Project                     ___| | | |  _ \| |
4#                             / __| | | | |_) | |
5#                            | (__| |_| |  _ <| |___
6#                             \___|\___/|_| \_\_____|
7#
8# Copyright (C) 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# SPDX-License-Identifier: curl
22#
23#***************************************************************************
24
25!MESSAGE
26!MESSAGE WARNING:
27!MESSAGE
28!MESSAGE The winbuild build system is deprecated and will be removed in
29!MESSAGE September 2025 in favor of the CMake build system.
30!MESSAGE
31!MESSAGE Please see docs/INSTALL-CMAKE.md : "Migrating from winbuild builds"
32!MESSAGE
33!MESSAGE To use the winbuild build system you must acknowledge this warning by
34!MESSAGE setting command line option WINBUILD_ACKNOWLEDGE_DEPRECATED=yes
35!MESSAGE
36!IF "$(WINBUILD_ACKNOWLEDGE_DEPRECATED)"!="yes"
37!ERROR The user must acknowledge the deprecation warning to continue.
38!ENDIF
39
40!IF "$(MODE)"=="static"
41TARGET = $(LIB_NAME_STATIC)
42AS_DLL = false
43CFGSET=true
44!ELSEIF "$(MODE)"=="dll"
45TARGET = $(LIB_NAME_DLL)
46AS_DLL = true
47CFGSET=true
48!ELSE
49!MESSAGE Invalid mode: $(MODE)
50
51#######################
52# Usage
53#
54
55!MESSAGE See winbuild/README.md for usage
56!ERROR please choose a valid mode
57
58!ENDIF
59
60!INCLUDE "../lib/Makefile.inc"
61LIBCURL_OBJS=$(CSOURCES:.c=.obj)
62
63!INCLUDE "../src/Makefile.inc"
64CURL_OBJS=$(CURL_CFILES:.c=.obj)
65
66
67# backwards compatible check for USE_SSPI
68!IFDEF USE_SSPI
69ENABLE_SSPI = $(USE_SSPI)
70!ENDIF
71
72# default options
73
74!IFNDEF MACHINE
75# Note: nmake magically changes the value of PROCESSOR_ARCHITECTURE from "AMD64"
76# to "x86" when building in a 32 bit build environment on a 64 bit machine.
77!IF "$(PROCESSOR_ARCHITECTURE)"=="AMD64"
78MACHINE = x64
79!ELSE
80MACHINE = x86
81!ENDIF
82!ENDIF
83
84!IFNDEF ENABLE_IDN
85USE_IDN = true
86!ELSEIF "$(ENABLE_IDN)"=="yes"
87USE_IDN = true
88!ELSEIF "$(ENABLE_IDN)"=="no"
89USE_IDN = false
90!ENDIF
91
92!IFNDEF ENABLE_IPV6
93USE_IPV6 = true
94!ELSEIF "$(ENABLE_IPV6)"=="yes"
95USE_IPV6 = true
96!ELSEIF "$(ENABLE_IPV6)"=="no"
97USE_IPV6 = false
98!ENDIF
99
100!IFNDEF ENABLE_SSPI
101USE_SSPI = true
102!ELSEIF "$(ENABLE_SSPI)"=="yes"
103USE_SSPI = true
104!ELSEIF "$(ENABLE_SSPI)"=="no"
105USE_SSPI = false
106!ENDIF
107
108!IFNDEF ENABLE_SCHANNEL
109!IF DEFINED(WITH_SSL) || DEFINED(WITH_MBEDTLS) || DEFINED(WITH_WOLFSSL)
110USE_SCHANNEL = false
111!ELSE
112USE_SCHANNEL = $(USE_SSPI)
113!ENDIF
114!ELSEIF "$(ENABLE_SCHANNEL)"=="yes"
115USE_SCHANNEL = true
116!ELSEIF "$(ENABLE_SCHANNEL)"=="no"
117USE_SCHANNEL = false
118!ENDIF
119
120!IFNDEF ENABLE_OPENSSL_AUTO_LOAD_CONFIG
121ENABLE_OPENSSL_AUTO_LOAD_CONFIG = true
122!ELSEIF "$(ENABLE_OPENSSL_AUTO_LOAD_CONFIG)"=="yes"
123!UNDEF ENABLE_OPENSSL_AUTO_LOAD_CONFIG
124ENABLE_OPENSSL_AUTO_LOAD_CONFIG = true
125!ELSEIF "$(ENABLE_OPENSSL_AUTO_LOAD_CONFIG)"=="no"
126!UNDEF ENABLE_OPENSSL_AUTO_LOAD_CONFIG
127ENABLE_OPENSSL_AUTO_LOAD_CONFIG = false
128!ENDIF
129
130!IFNDEF ENABLE_UNICODE
131USE_UNICODE = false
132!ELSEIF "$(ENABLE_UNICODE)"=="yes"
133USE_UNICODE = true
134!ELSEIF "$(ENABLE_UNICODE)"=="no"
135USE_UNICODE = false
136!ENDIF
137
138CONFIG_NAME_LIB = libcurl
139
140!IF "$(WITH_SSL)"=="dll"
141USE_SSL = true
142SSL     = dll
143!ELSEIF "$(WITH_SSL)"=="static"
144USE_SSL = true
145SSL     = static
146!ENDIF
147
148!IF "$(ENABLE_NGHTTP2)"=="yes"
149# compatibility bit, WITH_NGHTTP2 is the correct flag
150WITH_NGHTTP2 = dll
151USE_NGHTTP2  = true
152NGHTTP2      = dll
153!ELSEIF "$(WITH_NGHTTP2)"=="dll"
154USE_NGHTTP2 = true
155NGHTTP2     = dll
156!ELSEIF "$(WITH_NGHTTP2)"=="static"
157USE_NGHTTP2 = true
158NGHTTP2     = static
159!ENDIF
160
161!IFNDEF USE_NGHTTP2
162USE_NGHTTP2 = false
163!ENDIF
164
165!IF "$(ENABLE_MSH3)"=="yes"
166# compatibility bit, WITH_MSH3 is the correct flag
167WITH_MSH3    = dll
168USE_MSH3     = true
169MSH3         = dll
170!ELSEIF "$(WITH_MSH3)"=="dll"
171USE_MSH3     = true
172MSH3         = dll
173!ELSEIF "$(WITH_MSH3)"=="static"
174USE_MSH3     = true
175MSH3         = static
176!ENDIF
177
178!IFNDEF USE_MSH3
179USE_MSH3 = false
180!ENDIF
181
182!IF "$(WITH_MBEDTLS)"=="dll" || "$(WITH_MBEDTLS)"=="static"
183USE_MBEDTLS = true
184MBEDTLS     = $(WITH_MBEDTLS)
185!ENDIF
186
187!IF "$(WITH_WOLFSSL)"=="dll" || "$(WITH_WOLFSSL)"=="static"
188USE_WOLFSSL = true
189WOLFSSL     = $(WITH_WOLFSSL)
190!ENDIF
191
192!IF "$(WITH_CARES)"=="dll"
193USE_CARES = true
194CARES     = dll
195!ELSEIF "$(WITH_CARES)"=="static"
196USE_CARES = true
197CARES     = static
198!ENDIF
199
200!IF "$(WITH_ZLIB)"=="dll"
201USE_ZLIB = true
202ZLIB     = dll
203!ELSEIF "$(WITH_ZLIB)"=="static"
204USE_ZLIB = true
205ZLIB     = static
206!ENDIF
207
208!IF "$(WITH_SSH2)"=="dll"
209USE_SSH2 = true
210SSH2     = dll
211!ELSEIF "$(WITH_SSH2)"=="static"
212USE_SSH2 = true
213SSH2     = static
214!ENDIF
215
216!IF "$(WITH_SSH)"=="dll"
217USE_SSH = true
218SSH     = dll
219!ELSEIF "$(WITH_SSH)"=="static"
220USE_SSH = true
221SSH     = static
222!ENDIF
223
224CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-vc$(VC)-$(MACHINE)
225
226!IF "$(DEBUG)"=="yes"
227CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-debug
228!ELSE
229CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-release
230!ENDIF
231
232!IF "$(AS_DLL)"=="true"
233CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-dll
234!ELSE
235CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-static
236!ENDIF
237
238!IF "$(USE_SSL)"=="true"
239CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-ssl-$(SSL)
240!ENDIF
241
242!IF "$(USE_MBEDTLS)"=="true"
243CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-mbedtls-$(MBEDTLS)
244!ENDIF
245
246!IF "$(USE_WOLFSSL)"=="true"
247CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-wolfssl-$(WOLFSSL)
248!ENDIF
249
250!IF "$(USE_CARES)"=="true"
251CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-cares-$(CARES)
252!ENDIF
253
254!IF "$(USE_ZLIB)"=="true"
255CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-zlib-$(ZLIB)
256!ENDIF
257
258!IF "$(USE_SSH2)"=="true"
259CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-ssh2-$(SSH2)
260!ENDIF
261
262!IF "$(USE_SSH)"=="true"
263CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-ssh-$(SSH)
264!ENDIF
265
266!IF "$(USE_IPV6)"=="true"
267CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-ipv6
268!ENDIF
269
270!IF "$(USE_SSPI)"=="true"
271CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-sspi
272!ENDIF
273
274!IF "$(USE_SCHANNEL)"=="true"
275CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-schannel
276!ENDIF
277
278!IF "$(USE_NGHTTP2)"=="true"
279CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-nghttp2-$(NGHTTP2)
280!ENDIF
281
282!IF "$(USE_MSH3)"=="true"
283CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-msh3
284!ENDIF
285
286!MESSAGE configuration name: $(CONFIG_NAME_LIB)
287
288# Note these directories are removed by this makefile's 'clean' so they should
289# not be changed to point to user-specified directories that may contain other
290# data. MakefileBuild.vc uses the same variable names but allows some user
291# changes and therefore does not remove the directories.
292BUILD_DIR=../builds/$(CONFIG_NAME_LIB)
293LIBCURL_DIROBJ = ..\builds\$(CONFIG_NAME_LIB)-obj-lib
294CURL_DIROBJ = ..\builds\$(CONFIG_NAME_LIB)-obj-curl
295DIRDIST = ..\builds\$(CONFIG_NAME_LIB)\
296
297$(MODE):
298	@echo LIBCURL_OBJS = \> LIBCURL_OBJS.inc
299	@for %%i in ($(LIBCURL_OBJS)) do @echo $(LIBCURL_DIROBJ)/%%i \>> LIBCURL_OBJS.inc
300	@echo. >> LIBCURL_OBJS.inc
301
302	@echo CURL_OBJS = \> CURL_OBJS.inc
303	@for %%i in ($(CURL_OBJS)) do @echo $(CURL_DIROBJ)/%%i \>> CURL_OBJS.inc
304	@echo. >> CURL_OBJS.inc
305
306	@SET CONFIG_NAME_LIB=$(CONFIG_NAME_LIB)
307	@SET MACHINE=$(MACHINE)
308	@SET USE_NGHTTP2=$(USE_NGHTTP2)
309	@SET USE_MSH3=$(USE_MSH3)
310	@SET USE_IDN=$(USE_IDN)
311	@SET USE_IPV6=$(USE_IPV6)
312	@SET USE_SSPI=$(USE_SSPI)
313	@SET USE_SCHANNEL=$(USE_SCHANNEL)
314	@SET USE_UNICODE=$(USE_UNICODE)
315# compatibility bit
316	@SET WITH_NGHTTP2=$(WITH_NGHTTP2)
317
318	@$(MAKE) /NOLOGO /F MakefileBuild.vc
319
320copy_from_lib:
321	echo copying .c...
322	FOR %%i IN ($(CURLX_CFILES:/=\)) DO copy %%i ..\src\
323
324clean:
325	@if exist $(LIBCURL_DIROBJ) rd /s /q $(LIBCURL_DIROBJ)
326	@if exist $(CURL_DIROBJ) rd /s /q $(CURL_DIROBJ)
327	@if exist $(DIRDIST) rd /s /q $(DIRDIST)
328	$(MAKE) /NOLOGO /F MakefileBuild.vc $@
329