| xf.li | 6c8fc1e | 2023-08-12 00:11:09 -0700 | [diff] [blame] | 1 | #***************************************************************************
|
| 2 | # _ _ ____ _
|
| 3 | # Project ___| | | | _ \| |
|
| 4 | # / __| | | | |_) | |
|
| 5 | # | (__| |_| | _ <| |___
|
| 6 | # \___|\___/|_| \_\_____|
|
| 7 | #
|
| 8 | # Copyright (C) 1999 - 2022, 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 | ###########################################################################
|
| 26 | #
|
| 27 | # Makefile for building libcurl with MSVC
|
| 28 | #
|
| 29 | # Usage: see README.md
|
| 30 | #
|
| 31 | ##############################################################
|
| 32 |
|
| 33 | CFGSET=FALSE
|
| 34 | WINBUILD_DIR=`cd`
|
| 35 |
|
| 36 | # Utilities.
|
| 37 | # If a path is required that contains characters such as space, quote the path.
|
| 38 | MT = mt.exe
|
| 39 | RC = rc.exe
|
| 40 | ZIP = zip.exe
|
| 41 |
|
| 42 | # Allow changing C compiler via environment variable CC (default cl.exe)
|
| 43 | # This command macro is not set by default: https://msdn.microsoft.com/en-us/library/ms933742.aspx
|
| 44 | !If "$(CC)" == ""
|
| 45 | CC = cl.exe
|
| 46 | !Endif
|
| 47 |
|
| 48 | !IF "$(VC)"=="6"
|
| 49 | CC_NODEBUG = $(CC) /O2 /DNDEBUG
|
| 50 | CC_DEBUG = $(CC) /Od /Gm /Zi /D_DEBUG /GZ
|
| 51 | CFLAGS = /I. /I../lib /I../include /nologo /W4 /GX /DWIN32 /YX /FD /c /DBUILDING_LIBCURL
|
| 52 | !ELSE
|
| 53 | CC_NODEBUG = $(CC) /O2 /DNDEBUG
|
| 54 | CC_DEBUG = $(CC) /Od /D_DEBUG /RTC1 /Z7 /LDd
|
| 55 | CFLAGS = /I. /I ../lib /I../include /nologo /W4 /EHsc /DWIN32 /FD /c /DBUILDING_LIBCURL
|
| 56 | !ENDIF
|
| 57 |
|
| 58 | LFLAGS = /nologo /machine:$(MACHINE)
|
| 59 | LNKDLL = link.exe /DLL
|
| 60 | # Use lib.exe instead of link.exe as link.exe /lib has the following bad habits:
|
| 61 | # - optimizing options like /opt:ref raises warnings (at least in Visual Studio 2015)
|
| 62 | # - all (including Windows) dependencies are aggregated (as static parts)
|
| 63 | # - link.exe /lib is not documented (anymore) at MSDN
|
| 64 | # Instead of id: just create an archive, that contains all objects
|
| 65 | LNKLIB = lib.exe
|
| 66 |
|
| 67 | CFLAGS_PDB = /Zi
|
| 68 | LFLAGS_PDB = /incremental:no /opt:ref,icf /DEBUG
|
| 69 |
|
| 70 | CFLAGS_LIBCURL_STATIC = /DCURL_STATICLIB
|
| 71 |
|
| 72 | WIN_LIBS = ws2_32.lib wldap32.lib advapi32.lib crypt32.lib
|
| 73 |
|
| 74 | BASE_NAME = libcurl
|
| 75 | BASE_NAME_DEBUG = $(BASE_NAME)_debug
|
| 76 | BASE_NAME_STATIC = $(BASE_NAME)_a
|
| 77 | BASE_NAME_STATIC_DEBUG = $(BASE_NAME_STATIC)_debug
|
| 78 |
|
| 79 | LIB_NAME_STATIC = $(BASE_NAME_STATIC).lib
|
| 80 | LIB_NAME_STATIC_DEBUG = $(BASE_NAME_STATIC_DEBUG).lib
|
| 81 | LIB_NAME_DLL = $(BASE_NAME).dll
|
| 82 | LIB_NAME_IMP = $(BASE_NAME).lib
|
| 83 | LIB_NAME_DLL_DEBUG = $(BASE_NAME_DEBUG).dll
|
| 84 | LIB_NAME_IMP_DEBUG = $(BASE_NAME_DEBUG).lib
|
| 85 |
|
| 86 | PDB_NAME_STATIC = $(BASE_NAME_STATIC).pdb
|
| 87 | PDB_NAME_STATIC_DEBUG = $(BASE_NAME_STATIC_DEBUG).pdb
|
| 88 | PDB_NAME_DLL = $(BASE_NAME).pdb
|
| 89 | PDB_NAME_DLL_DEBUG = $(BASE_NAME_DEBUG).pdb
|
| 90 |
|
| 91 | # CURL Command section
|
| 92 | PROGRAM_NAME = curl.exe
|
| 93 | CURL_CFLAGS = /I../lib /I../include /nologo /W4 /EHsc /DWIN32 /FD /c
|
| 94 | CURL_LFLAGS = /out:$(DIRDIST)\bin\$(PROGRAM_NAME) /subsystem:console $(LFLAGS)
|
| 95 | CURL_RESFLAGS = /i../include
|
| 96 |
|
| 97 | #############################################################
|
| 98 | ## Nothing more to do below this line!
|
| 99 | LIBCURL_SRC_DIR = ..\lib
|
| 100 | CURL_SRC_DIR = ..\src
|
| 101 |
|
| 102 | !IFNDEF WITH_DEVEL
|
| 103 | WITH_DEVEL = ../../deps
|
| 104 | !ENDIF
|
| 105 | DEVEL_INCLUDE= $(WITH_DEVEL)/include
|
| 106 | DEVEL_LIB = $(WITH_DEVEL)/lib
|
| 107 |
|
| 108 | !IF EXISTS("$(DEVEL_INCLUDE)")
|
| 109 | CFLAGS = $(CFLAGS) /I"$(DEVEL_INCLUDE)"
|
| 110 | !ENDIF
|
| 111 | !IF EXISTS("$(DEVEL_LIB)")
|
| 112 | LFLAGS = $(LFLAGS) "/LIBPATH:$(DEVEL_LIB)"
|
| 113 | !ENDIF
|
| 114 |
|
| 115 | !IFDEF SSL_PATH
|
| 116 | SSL_INC_DIR = $(SSL_PATH)\include
|
| 117 | SSL_LIB_DIR = $(SSL_PATH)\lib
|
| 118 | SSL_LFLAGS = $(SSL_LFLAGS) "/LIBPATH:$(SSL_LIB_DIR)"
|
| 119 | !ELSE
|
| 120 | SSL_INC_DIR=$(DEVEL_INCLUDE)\openssl
|
| 121 | SSL_LIB_DIR=$(DEVEL_LIB)
|
| 122 | !ENDIF
|
| 123 |
|
| 124 | !IF "$(WITH_SSL)"=="dll" || "$(WITH_SSL)"=="static"
|
| 125 | !IF EXISTS("$(SSL_LIB_DIR)\libssl.lib")
|
| 126 | SSL_LIBS = libssl.lib libcrypto.lib
|
| 127 | !ELSE
|
| 128 | SSL_LIBS = libeay32.lib ssleay32.lib
|
| 129 | !ENDIF
|
| 130 | USE_SSL = true
|
| 131 | SSL = $(WITH_SSL)
|
| 132 | !IF "$(WITH_SSL)"=="static"
|
| 133 | WIN_LIBS = $(WIN_LIBS) gdi32.lib user32.lib crypt32.lib
|
| 134 | !ENDIF
|
| 135 | !ENDIF
|
| 136 |
|
| 137 | !IFDEF USE_SSL
|
| 138 | SSL_CFLAGS = /DUSE_OPENSSL /I"$(SSL_INC_DIR)"
|
| 139 | !IF EXISTS("$(SSL_INC_DIR)\is_boringssl.h")
|
| 140 | SSL_CFLAGS = $(SSL_CFLAGS) /DHAVE_BORINGSSL
|
| 141 | !ENDIF
|
| 142 | !IF "$(ENABLE_OPENSSL_AUTO_LOAD_CONFIG)"=="false"
|
| 143 | SSL_CFLAGS = $(SSL_CFLAGS) /DCURL_DISABLE_OPENSSL_AUTO_LOAD_CONFIG
|
| 144 | !ENDIF
|
| 145 | !ENDIF
|
| 146 |
|
| 147 |
|
| 148 | !IFDEF NGHTTP2_PATH
|
| 149 | NGHTTP2_INC_DIR = $(NGHTTP2_PATH)\include
|
| 150 | NGHTTP2_LIB_DIR = $(NGHTTP2_PATH)\lib
|
| 151 | NGHTTP2_LFLAGS = $(NGHTTP2_LFLAGS) "/LIBPATH:$(NGHTTP2_LIB_DIR)"
|
| 152 | !ELSE
|
| 153 | NGHTTP2_INC_DIR = $(DEVEL_INCLUDE)
|
| 154 | NGHTTP2_LIB_DIR = $(DEVEL_LIB)
|
| 155 | !ENDIF
|
| 156 |
|
| 157 | !IF "$(WITH_NGHTTP2)"=="dll"
|
| 158 | NGHTTP2_CFLAGS = /DUSE_NGHTTP2 /I"$(NGHTTP2_INC_DIR)"
|
| 159 | NGHTTP2_LIBS = nghttp2.lib
|
| 160 | !ELSEIF "$(WITH_NGHTTP2)"=="static"
|
| 161 | NGHTTP2_CFLAGS = /DUSE_NGHTTP2 /DNGHTTP2_STATICLIB /I"$(NGHTTP2_INC_DIR)"
|
| 162 | !IF EXISTS("$(NGHTTP2_LIB_DIR)\nghttp2_static.lib")
|
| 163 | NGHTTP2_LIBS = nghttp2_static.lib
|
| 164 | !ELSE
|
| 165 | NGHTTP2_LIBS = nghttp2.lib
|
| 166 | !ENDIF
|
| 167 | !ENDIF
|
| 168 |
|
| 169 | !IFDEF MSH3_PATH
|
| 170 | MSH3_INC_DIR = $(MSH3_PATH)\include
|
| 171 | MSH3_LIB_DIR = $(MSH3_PATH)\lib
|
| 172 | MSH3_LFLAGS = $(MSH3_LFLAGS) "/LIBPATH:$(MSH3_LIB_DIR)"
|
| 173 | !ELSE
|
| 174 | MSH3_INC_DIR = $(DEVEL_INCLUDE)
|
| 175 | MSH3_LIB_DIR = $(DEVEL_LIB)
|
| 176 | !ENDIF
|
| 177 |
|
| 178 | !IF "$(WITH_MSH3)"=="dll"
|
| 179 | MSH3_CFLAGS = /DUSE_MSH3 /I"$(MSH3_INC_DIR)"
|
| 180 | MSH3_LIBS = msh3.lib
|
| 181 | !ELSEIF "$(WITH_MSH3)"=="static"
|
| 182 | MSH3_CFLAGS = /DUSE_MSH3 /DMSH3_STATICLIB /I"$(MSH3_INC_DIR)"
|
| 183 | !IF EXISTS("$(NGHTTP2_LIB_DIR)\msh3_static.lib")
|
| 184 | MSH3_LIBS = msh3_static.lib
|
| 185 | !ELSE
|
| 186 | MSH3_LIBS = msh3.lib
|
| 187 | !ENDIF
|
| 188 | !ENDIF
|
| 189 |
|
| 190 | !IFDEF MBEDTLS_PATH
|
| 191 | MBEDTLS_INC_DIR = $(MBEDTLS_PATH)\include
|
| 192 | MBEDTLS_LIB_DIR = $(MBEDTLS_PATH)\lib
|
| 193 | MBEDTLS_LFLAGS = $(MBEDTLS_LFLAGS) "/LIBPATH:$(MBEDTLS_LIB_DIR)"
|
| 194 | !ELSE
|
| 195 | MBEDTLS_INC_DIR = $(DEVEL_INCLUDE)
|
| 196 | MBEDTLS_LIB_DIR = $(DEVEL_LIB)
|
| 197 | !ENDIF
|
| 198 |
|
| 199 | !IF "$(WITH_MBEDTLS)"=="dll" || "$(WITH_MBEDTLS)"=="static"
|
| 200 | USE_MBEDTLS = true
|
| 201 | MBEDTLS = $(WITH_MBEDTLS)
|
| 202 | MBEDTLS_CFLAGS = /DUSE_MBEDTLS /I"$(MBEDTLS_INC_DIR)"
|
| 203 | MBEDTLS_LIBS = mbedtls.lib mbedcrypto.lib mbedx509.lib
|
| 204 | !ENDIF
|
| 205 |
|
| 206 |
|
| 207 | !IFDEF CARES_PATH
|
| 208 | CARES_INC_DIR = $(CARES_PATH)\include
|
| 209 | CARES_LIB_DIR = $(CARES_PATH)\lib
|
| 210 | CARES_LFLAGS = $(CARES_LFLAGS) "/LIBPATH:$(CARES_LIB_DIR)"
|
| 211 | !ELSE
|
| 212 | CARES_INC_DIR = $(DEVEL_INCLUDE)/cares
|
| 213 | CARES_LIB_DIR = $(DEVEL_LIB)
|
| 214 | !ENDIF
|
| 215 |
|
| 216 | !IF "$(WITH_CARES)"=="dll"
|
| 217 | !IF "$(DEBUG)"=="yes"
|
| 218 | CARES_LIBS = caresd.lib
|
| 219 | !ELSE
|
| 220 | CARES_LIBS = cares.lib
|
| 221 | !ENDIF
|
| 222 | USE_CARES = true
|
| 223 | CARES = dll
|
| 224 | !ELSEIF "$(WITH_CARES)"=="static"
|
| 225 | !IF "$(DEBUG)"=="yes"
|
| 226 | CARES_LIBS = libcaresd.lib
|
| 227 | !ELSE
|
| 228 | CARES_LIBS = libcares.lib
|
| 229 | !ENDIF
|
| 230 | USE_CARES = true
|
| 231 | CARES = static
|
| 232 | !ENDIF
|
| 233 |
|
| 234 | !IFDEF USE_CARES
|
| 235 | CARES_CFLAGS = /DUSE_ARES /I"$(CARES_INC_DIR)"
|
| 236 | !IF "$(CARES)"=="static"
|
| 237 | CARES_CFLAGS = $(CARES_CFLAGS) /DCARES_STATICLIB
|
| 238 | !ENDIF
|
| 239 | !ENDIF
|
| 240 |
|
| 241 |
|
| 242 | !IFDEF ZLIB_PATH
|
| 243 | ZLIB_INC_DIR = $(ZLIB_PATH)\include
|
| 244 | ZLIB_LIB_DIR = $(ZLIB_PATH)\lib
|
| 245 | ZLIB_LFLAGS = $(ZLIB_LFLAGS) "/LIBPATH:$(ZLIB_LIB_DIR)"
|
| 246 | !ELSE
|
| 247 | ZLIB_INC_DIR = $(DEVEL_INCLUDE)
|
| 248 | ZLIB_LIB_DIR = $(DEVEL_LIB)
|
| 249 | !ENDIF
|
| 250 |
|
| 251 | # Depending on how zlib is built the libraries have different names, we
|
| 252 | # try to handle them all.
|
| 253 | !IF "$(WITH_ZLIB)"=="dll"
|
| 254 | !IF EXISTS("$(ZLIB_LIB_DIR)\zlibwapi.lib")
|
| 255 | ZLIB_LIBS = zlibwapi.lib
|
| 256 | ADDITIONAL_ZLIB_CFLAGS = /DZLIB_WINAPI
|
| 257 | !ELSEIF EXISTS("$(ZLIB_LIB_DIR)\zdll.lib")
|
| 258 | ZLIB_LIBS = zdll.lib
|
| 259 | !ELSE
|
| 260 | ZLIB_LIBS = zlib.lib
|
| 261 | !ENDIF
|
| 262 | USE_ZLIB = true
|
| 263 | ZLIB = dll
|
| 264 | !ELSEIF "$(WITH_ZLIB)"=="static"
|
| 265 | !IF EXISTS("$(ZLIB_LIB_DIR)\zlibstat.lib")
|
| 266 | ZLIB_LIBS = zlibstat.lib
|
| 267 | ADDITIONAL_ZLIB_CFLAGS = /DZLIB_WINAPI
|
| 268 | !ELSEIF EXISTS("$(ZLIB_LIB_DIR)\zlib.lib")
|
| 269 | ZLIB_LIBS = zlib.lib
|
| 270 | !ELSE
|
| 271 | ZLIB_LIBS = zlib_a.lib
|
| 272 | !ENDIF
|
| 273 | USE_ZLIB = true
|
| 274 | ZLIB = static
|
| 275 | !ENDIF
|
| 276 |
|
| 277 | !IFDEF USE_ZLIB
|
| 278 | ZLIB_CFLAGS = /DHAVE_LIBZ $(ADDITIONAL_ZLIB_CFLAGS) /I"$(ZLIB_INC_DIR)"
|
| 279 | !ENDIF
|
| 280 |
|
| 281 |
|
| 282 | !IFDEF SSH2_PATH
|
| 283 | SSH2_INC_DIR= $(SSH2_PATH)\include
|
| 284 | SSH2_LIB_DIR= $(SSH2_PATH)\lib
|
| 285 | SSH2_LFLAGS = $(SSH2_LFLAGS) "/LIBPATH:$(SSH2_LIB_DIR)"
|
| 286 | !ELSE
|
| 287 | SSH2_LIB_DIR= $(DEVEL_LIB)
|
| 288 | SSH2_INC_DIR= $(DEVEL_INCLUDE)/libssh2
|
| 289 | !ENDIF
|
| 290 |
|
| 291 | !IF "$(WITH_SSH2)"=="dll"
|
| 292 | SSH2_LIBS = libssh2.lib
|
| 293 | USE_SSH2 = true
|
| 294 | SSH2 = dll
|
| 295 | !ELSEIF "$(WITH_SSH2)"=="static"
|
| 296 | # libssh2 NMakefile on Windows at default creates a static library without _a suffix
|
| 297 | !IF EXISTS("$(SSH2_LIB_DIR)\libssh2.lib")
|
| 298 | SSH2_LIBS = libssh2.lib
|
| 299 | !ELSE
|
| 300 | SSH2_LIBS = libssh2_a.lib
|
| 301 | !ENDIF
|
| 302 | WIN_LIBS = $(WIN_LIBS) user32.lib
|
| 303 | USE_SSH2 = true
|
| 304 | SSH2 = static
|
| 305 | !ENDIF
|
| 306 |
|
| 307 | !IFDEF USE_SSH2
|
| 308 | SSH2_CFLAGS = /DUSE_LIBSSH2
|
| 309 | SSH2_CFLAGS = $(SSH2_CFLAGS) /I"$(SSH2_INC_DIR)"
|
| 310 | !ENDIF
|
| 311 |
|
| 312 |
|
| 313 | !IFDEF SSH_PATH
|
| 314 | SSH_INC_DIR= $(SSH_PATH)\include
|
| 315 | SSH_LIB_DIR= $(SSH_PATH)\lib
|
| 316 | SSH_LFLAGS = $(SSH_LFLAGS) "/LIBPATH:$(SSH_LIB_DIR)"
|
| 317 | !ELSE
|
| 318 | SSH_LIB_DIR= $(DEVEL_LIB)
|
| 319 | SSH_INC_DIR= $(DEVEL_INCLUDE)
|
| 320 | !ENDIF
|
| 321 |
|
| 322 | !IF "$(WITH_SSH)"=="dll" || "$(WITH_SSH)"=="static"
|
| 323 | SSH_LIBS = ssh.lib
|
| 324 | USE_SSH = true
|
| 325 | SSH = $(WITH_SSH)
|
| 326 | !ENDIF
|
| 327 |
|
| 328 | !IFDEF USE_SSH
|
| 329 | SSH_CFLAGS = /DUSE_LIBSSH
|
| 330 | SSH_CFLAGS = $(SSH_CFLAGS) /I"$(SSH_INC_DIR)"
|
| 331 | !ENDIF
|
| 332 |
|
| 333 |
|
| 334 | !IFNDEF USE_IDN
|
| 335 | USE_IDN = true
|
| 336 | !ELSEIF "$(USE_IDN)"=="yes"
|
| 337 | USE_IDN = true
|
| 338 | !ENDIF
|
| 339 |
|
| 340 | !IF "$(USE_IDN)"=="true"
|
| 341 | IDN_CFLAGS = $(IDN_CFLAGS) /DUSE_WIN32_IDN /DWANT_IDN_PROTOTYPES
|
| 342 | WIN_LIBS = $(WIN_LIBS) Normaliz.lib
|
| 343 | !ENDIF
|
| 344 |
|
| 345 |
|
| 346 | !IFNDEF USE_IPV6
|
| 347 | USE_IPV6 = true
|
| 348 | !ELSEIF "$(USE_IPV6)"=="yes"
|
| 349 | USE_IPV6 = true
|
| 350 | !ENDIF
|
| 351 |
|
| 352 | !IF "$(USE_IPV6)"=="true"
|
| 353 | IPV6_CFLAGS = $(IPV6_CFLAGS) /DUSE_IPV6
|
| 354 | !ENDIF
|
| 355 |
|
| 356 |
|
| 357 | !IFNDEF USE_SSPI
|
| 358 | USE_SSPI = true
|
| 359 | !ELSEIF "$(USE_SSPI)"=="yes"
|
| 360 | USE_SSPI = true
|
| 361 | !ENDIF
|
| 362 |
|
| 363 | !IF "$(USE_SSPI)"=="true"
|
| 364 | SSPI_CFLAGS = $(SSPI_CFLAGS) /DUSE_WINDOWS_SSPI
|
| 365 | !ENDIF
|
| 366 |
|
| 367 |
|
| 368 | !IFNDEF USE_SCHANNEL
|
| 369 | !IF "$(USE_SSL)"=="true"
|
| 370 | USE_SCHANNEL = false
|
| 371 | !ELSE
|
| 372 | USE_SCHANNEL = $(USE_SSPI)
|
| 373 | !ENDIF
|
| 374 | !ELSEIF "$(USE_SCHANNEL)"=="yes"
|
| 375 | USE_SCHANNEL = true
|
| 376 | !ENDIF
|
| 377 |
|
| 378 |
|
| 379 | !IF "$(USE_SCHANNEL)"=="true"
|
| 380 | !IF "$(USE_SSPI)"!="true"
|
| 381 | !ERROR cannot build with Schannel without SSPI
|
| 382 | !ENDIF
|
| 383 | SSPI_CFLAGS = $(SSPI_CFLAGS) /DUSE_SCHANNEL
|
| 384 | WIN_LIBS = $(WIN_LIBS) Crypt32.lib
|
| 385 | !ENDIF
|
| 386 |
|
| 387 |
|
| 388 | !IF "$(GEN_PDB)"=="yes"
|
| 389 | GEN_PDB = true
|
| 390 | !ENDIF
|
| 391 |
|
| 392 |
|
| 393 | !IFDEF EMBED_MANIFEST
|
| 394 | MANIFESTTOOL = $(MT) -manifest $(DIRDIST)\bin\$(PROGRAM_NAME).manifest -outputresource:$(DIRDIST)\bin\$(PROGRAM_NAME);1
|
| 395 | !ELSE
|
| 396 | CURL_RC_FLAGS = $(CURL_RC_FLAGS) /dCURL_EMBED_MANIFEST
|
| 397 | !ENDIF
|
| 398 |
|
| 399 | # Runtime library configuration
|
| 400 | !IF "$(RTLIBCFG)"=="static"
|
| 401 | RTLIB = /MT
|
| 402 | RTLIB_DEBUG = /MTd
|
| 403 | !ELSE
|
| 404 | RTLIB = /MD
|
| 405 | RTLIB_DEBUG = /MDd
|
| 406 | !ENDIF
|
| 407 |
|
| 408 | !IF "$(MODE)"=="static"
|
| 409 | TARGET = $(LIB_NAME_STATIC)
|
| 410 | CURL_LIBCURL_LIBNAME=$(LIB_NAME_STATIC)
|
| 411 | AS_DLL = false
|
| 412 | CFGSET = true
|
| 413 | !ELSEIF "$(MODE)"=="dll"
|
| 414 | TARGET = $(LIB_NAME_DLL)
|
| 415 | CURL_LIBCURL_LIBNAME=$(LIB_NAME_IMP)
|
| 416 | AS_DLL = true
|
| 417 | CFGSET = true
|
| 418 | !ENDIF
|
| 419 |
|
| 420 | !IF "$(CFGSET)" == "FALSE"
|
| 421 | !ERROR please choose a valid mode
|
| 422 | !ENDIF
|
| 423 |
|
| 424 |
|
| 425 |
|
| 426 | # CURL_XX macros are for the curl.exe command
|
| 427 |
|
| 428 | !IF "$(DEBUG)"=="yes"
|
| 429 | RC_FLAGS = /dDEBUGBUILD=1 /Fo $@ $(LIBCURL_SRC_DIR)\libcurl.rc
|
| 430 | CURL_CC = $(CC_DEBUG) $(RTLIB_DEBUG)
|
| 431 | CURL_RC_FLAGS = $(CURL_RC_FLAGS) /i../include /dDEBUGBUILD=1 /Fo $@ $(CURL_SRC_DIR)\curl.rc
|
| 432 | !ELSE
|
| 433 | RC_FLAGS = /dDEBUGBUILD=0 /Fo $@ $(LIBCURL_SRC_DIR)\libcurl.rc
|
| 434 | CURL_CC = $(CC_NODEBUG) $(RTLIB)
|
| 435 | CURL_RC_FLAGS = $(CURL_RC_FLAGS) /i../include /dDEBUGBUILD=0 /Fo $@ $(CURL_SRC_DIR)\curl.rc
|
| 436 | !ENDIF
|
| 437 |
|
| 438 | !IF "$(AS_DLL)" == "true"
|
| 439 |
|
| 440 | LNK = $(LNKDLL) $(LFLAGS) $(WIN_LIBS) /out:$(LIB_DIROBJ)\$(TARGET)
|
| 441 | !IF "$(DEBUG)"=="yes"
|
| 442 | TARGET = $(LIB_NAME_DLL_DEBUG)
|
| 443 | LNK = $(LNK) /DEBUG /IMPLIB:$(LIB_DIROBJ)\$(LIB_NAME_IMP_DEBUG)
|
| 444 | PDB = $(PDB_NAME_DLL_DEBUG)
|
| 445 | CURL_LIBS = /IMPLIB:$(LIB_DIROBJ)\$(LIB_NAME_IMP_DEBUG)
|
| 446 | !ELSE
|
| 447 | TARGET = $(LIB_NAME_DLL)
|
| 448 | LNK = $(LNK) /IMPLIB:$(LIB_DIROBJ)\$(LIB_NAME_IMP)
|
| 449 | PDB = $(PDB_NAME_DLL)
|
| 450 | CURL_LIBS = /IMPLIB:$(LIB_DIROBJ)\$(LIB_NAME_IMP)
|
| 451 | !ENDIF
|
| 452 | RESOURCE = $(LIB_DIROBJ)\libcurl.res
|
| 453 |
|
| 454 | # AS_DLL
|
| 455 | !ELSE
|
| 456 |
|
| 457 | !IF "$(DEBUG)"=="yes"
|
| 458 | TARGET = $(LIB_NAME_STATIC_DEBUG)
|
| 459 | PDB = $(PDB_NAME_STATIC_DEBUG)
|
| 460 | !ELSE
|
| 461 | TARGET = $(LIB_NAME_STATIC)
|
| 462 | PDB = $(PDB_NAME_STATIC)
|
| 463 | !ENDIF
|
| 464 | LNK = $(LNKLIB) /out:$(LIB_DIROBJ)\$(TARGET)
|
| 465 | CURL_CC = $(CURL_CC) $(CFLAGS_LIBCURL_STATIC)
|
| 466 |
|
| 467 | # AS_DLL
|
| 468 | !ENDIF
|
| 469 |
|
| 470 | !IF "$(USE_SSL)"=="true"
|
| 471 | CFLAGS = $(CFLAGS) $(SSL_CFLAGS)
|
| 472 | LFLAGS = $(LFLAGS) $(SSL_LFLAGS) $(SSL_LIBS)
|
| 473 | !ENDIF
|
| 474 |
|
| 475 | !IF "$(USE_MBEDTLS)"=="true"
|
| 476 | CFLAGS = $(CFLAGS) $(MBEDTLS_CFLAGS)
|
| 477 | LFLAGS = $(LFLAGS) $(MBEDTLS_LFLAGS) $(MBEDTLS_LIBS)
|
| 478 | !ENDIF
|
| 479 |
|
| 480 | !IF "$(USE_CARES)"=="true"
|
| 481 | CFLAGS = $(CFLAGS) $(CARES_CFLAGS)
|
| 482 | LFLAGS = $(LFLAGS) $(CARES_LFLAGS) $(CARES_LIBS)
|
| 483 | !ENDIF
|
| 484 |
|
| 485 | !IF "$(USE_ZLIB)"=="true"
|
| 486 | CFLAGS = $(CFLAGS) $(ZLIB_CFLAGS)
|
| 487 | LFLAGS = $(LFLAGS) $(ZLIB_LFLAGS) $(ZLIB_LIBS)
|
| 488 | !ENDIF
|
| 489 |
|
| 490 | !IF "$(USE_SSH2)"=="true"
|
| 491 | CFLAGS = $(CFLAGS) $(SSH2_CFLAGS)
|
| 492 | LFLAGS = $(LFLAGS) $(SSH2_LFLAGS) $(SSH2_LIBS)
|
| 493 | !ENDIF
|
| 494 |
|
| 495 | !IF "$(USE_SSH)"=="true"
|
| 496 | CFLAGS = $(CFLAGS) $(SSH_CFLAGS)
|
| 497 | LFLAGS = $(LFLAGS) $(SSH_LFLAGS) $(SSH_LIBS)
|
| 498 | !ENDIF
|
| 499 |
|
| 500 | !IF "$(USE_IDN)"=="true"
|
| 501 | CFLAGS = $(CFLAGS) $(IDN_CFLAGS)
|
| 502 | !ENDIF
|
| 503 |
|
| 504 | !IF "$(USE_IPV6)"=="true"
|
| 505 | CFLAGS = $(CFLAGS) $(IPV6_CFLAGS)
|
| 506 | !ENDIF
|
| 507 |
|
| 508 | !IF "$(USE_SSPI)"=="true"
|
| 509 | CFLAGS = $(CFLAGS) $(SSPI_CFLAGS)
|
| 510 | !ENDIF
|
| 511 |
|
| 512 | !IF "$(USE_NGHTTP2)"=="true"
|
| 513 | CFLAGS = $(CFLAGS) $(NGHTTP2_CFLAGS)
|
| 514 | LFLAGS = $(LFLAGS) $(NGHTTP2_LFLAGS) $(NGHTTP2_LIBS)
|
| 515 | !ENDIF
|
| 516 |
|
| 517 | !IF "$(USE_MSH3)"=="true"
|
| 518 | CFLAGS = $(CFLAGS) $(MSH3_CFLAGS)
|
| 519 | LFLAGS = $(LFLAGS) $(MSH3_LFLAGS) $(MSH3_LIBS)
|
| 520 | !ENDIF
|
| 521 |
|
| 522 | !IF "$(GEN_PDB)"=="true"
|
| 523 | CFLAGS = $(CFLAGS) $(CFLAGS_PDB) /Fd"$(LIB_DIROBJ)\$(PDB)"
|
| 524 | LFLAGS = $(LFLAGS) $(LFLAGS_PDB)
|
| 525 | !ENDIF
|
| 526 |
|
| 527 | !IF ( "$(USE_SSL)"=="true" && "$(USE_SCHANNEL)"=="true" ) \
|
| 528 | || ( "$(USE_SSL)"=="true" && "$(USE_MBEDTLS)"=="true" ) \
|
| 529 | || ( "$(USE_MBEDTLS)"=="true" && "$(USE_SCHANNEL)"=="true" )
|
| 530 | CFLAGS = $(CFLAGS) /DCURL_WITH_MULTI_SSL
|
| 531 | !ENDIF
|
| 532 |
|
| 533 | !IF "$(USE_UNICODE)"=="true"
|
| 534 | CFLAGS = $(CFLAGS) /DUNICODE /D_UNICODE
|
| 535 | !ENDIF
|
| 536 |
|
| 537 | LIB_DIROBJ = ..\builds\$(CONFIG_NAME_LIB)-obj-lib
|
| 538 | CURL_DIROBJ = ..\builds\$(CONFIG_NAME_LIB)-obj-curl
|
| 539 |
|
| 540 | !IFDEF WITH_PREFIX
|
| 541 | DIRDIST = $(WITH_PREFIX)
|
| 542 | !ELSE
|
| 543 | DIRDIST = ..\builds\$(CONFIG_NAME_LIB)\
|
| 544 | !ENDIF
|
| 545 |
|
| 546 | #
|
| 547 | # curl.exe
|
| 548 | #
|
| 549 | CURL_LINK = link.exe /incremental:no /libpath:"$(DIRDIST)\lib"
|
| 550 |
|
| 551 | !IF "$(CFGSET)" != "FALSE"
|
| 552 | # A mode was provided, so the library can be built.
|
| 553 | #
|
| 554 | !include CURL_OBJS.inc
|
| 555 | !include LIBCURL_OBJS.inc
|
| 556 |
|
| 557 | !IF "$(AS_DLL)" == "true"
|
| 558 | LIB_OBJS = $(LIBCURL_OBJS) $(RESOURCE)
|
| 559 | !ELSE
|
| 560 | LIB_OBJS = $(LIBCURL_OBJS)
|
| 561 | !ENDIF
|
| 562 |
|
| 563 | EXE_OBJS = $(CURL_OBJS) $(CURL_DIROBJ)\curl.res
|
| 564 |
|
| 565 | all : $(TARGET) $(PROGRAM_NAME)
|
| 566 |
|
| 567 | package: $(TARGET)
|
| 568 | @cd $(DIRDIST)
|
| 569 | @-$(ZIP) -9 -q -r ..\$(CONFIG_NAME_LIB).zip .>nul 2<&1
|
| 570 | @cd $(MAKEDIR)
|
| 571 |
|
| 572 | $(TARGET): $(LIB_OBJS) $(LIB_DIROBJ) $(DIRDIST)
|
| 573 | @echo Using SSL: $(USE_SSL)
|
| 574 | @echo Using NGHTTP2: $(USE_NGHTTP2)
|
| 575 | @echo Using MSH3: $(USE_MSH3)
|
| 576 | @echo Using c-ares: $(USE_CARES)
|
| 577 | @echo Using SSH2: $(USE_SSH2)
|
| 578 | @echo Using SSH: $(USE_SSH)
|
| 579 | @echo Using ZLIB: $(USE_ZLIB)
|
| 580 | @echo Using IDN: $(USE_IDN)
|
| 581 | @echo Using IPv6: $(USE_IPV6)
|
| 582 | @echo Using SSPI: $(USE_SSPI)
|
| 583 | @echo Using Schannel: $(USE_SCHANNEL)
|
| 584 | @echo CFLAGS: $(CFLAGS)
|
| 585 | @echo LFLAGS: $(LFLAGS)
|
| 586 | @echo GenPDB: $(GEN_PDB)
|
| 587 | @echo Debug: $(DEBUG)
|
| 588 | @echo Machine: $(MACHINE)
|
| 589 | $(LNK) $(LIB_OBJS)
|
| 590 | @echo Copying libs...
|
| 591 | @if exist $(LIB_DIROBJ)\$(LIB_NAME_DLL) copy $(LIB_DIROBJ)\$(LIB_NAME_DLL) $(DIRDIST)\bin\ /y >nul 2<&1
|
| 592 | @if exist $(LIB_DIROBJ)\$(LIB_NAME_STATIC) copy $(LIB_DIROBJ)\$(LIB_NAME_STATIC) $(DIRDIST)\lib\ /y >nul 2<&1
|
| 593 | @if exist $(LIB_DIROBJ)\$(LIB_NAME_DLL_DEBUG) copy $(LIB_DIROBJ)\$(LIB_NAME_DLL_DEBUG) $(DIRDIST)\bin\ /y >nul 2<&1
|
| 594 | @if exist $(LIB_DIROBJ)\$(LIB_NAME_STATIC_DEBUG) copy $(LIB_DIROBJ)\$(LIB_NAME_STATIC_DEBUG) $(DIRDIST)\lib\ /y >nul 2<&1
|
| 595 | @if exist $(LIB_DIROBJ)\$(LIB_NAME_IMP) copy $(LIB_DIROBJ)\$(LIB_NAME_IMP) $(DIRDIST)\lib\ /y >nul 2<&1
|
| 596 | @if exist $(LIB_DIROBJ)\$(LIB_NAME_IMP_DEBUG) copy $(LIB_DIROBJ)\$(LIB_NAME_IMP_DEBUG) $(DIRDIST)\lib >nul 2<&1
|
| 597 | @-copy $(LIB_DIROBJ)\*.exp $(DIRDIST)\lib /y >nul 2<&1
|
| 598 | @-copy $(LIB_DIROBJ)\*.pdb $(DIRDIST)\lib /y >nul 2<&1
|
| 599 | @-copy ..\include\curl\*.h $(DIRDIST)\include\curl\ /y >nul 2<&1
|
| 600 |
|
| 601 | $(LIB_OBJS): $(LIB_DIROBJ) $(DIRDIST)
|
| 602 |
|
| 603 | $(DIRDIST):
|
| 604 | @if not exist "$(DIRDIST)\bin" mkdir $(DIRDIST)\bin
|
| 605 | @if not exist "$(DIRDIST)\include" mkdir $(DIRDIST)\include
|
| 606 | @if not exist "$(DIRDIST)\include\curl" mkdir $(DIRDIST)\include\curl
|
| 607 | @if not exist "$(DIRDIST)\lib" mkdir $(DIRDIST)\lib
|
| 608 |
|
| 609 | $(LIB_DIROBJ):
|
| 610 | @if not exist "$(LIB_DIROBJ)" mkdir $(LIB_DIROBJ)
|
| 611 | @if not exist "$(LIB_DIROBJ)\vauth" mkdir $(LIB_DIROBJ)\vauth
|
| 612 | @if not exist "$(LIB_DIROBJ)\vtls" mkdir $(LIB_DIROBJ)\vtls
|
| 613 | @if not exist "$(LIB_DIROBJ)\vssh" mkdir $(LIB_DIROBJ)\vssh
|
| 614 | @if not exist "$(LIB_DIROBJ)\vquic" mkdir $(LIB_DIROBJ)\vquic
|
| 615 |
|
| 616 | $(CURL_DIROBJ):
|
| 617 | @if not exist "$(CURL_DIROBJ)" mkdir $(CURL_DIROBJ)
|
| 618 | # we need a lib dir for the portability functions from libcurl
|
| 619 | # we use the .c directly here
|
| 620 | @if not exist "$(CURL_DIROBJ)" mkdir $(CURL_DIROBJ)\lib
|
| 621 |
|
| 622 | .SUFFIXES: .c .obj .res
|
| 623 |
|
| 624 | {$(LIBCURL_SRC_DIR)\}.c{$(LIB_DIROBJ)\}.obj::
|
| 625 | $(CURL_CC) $(CFLAGS) /Fo"$(LIB_DIROBJ)\\" $<
|
| 626 |
|
| 627 | {$(LIBCURL_SRC_DIR)\vauth\}.c{$(LIB_DIROBJ)\vauth\}.obj::
|
| 628 | $(CURL_CC) $(CFLAGS) /Fo"$(LIB_DIROBJ)\vauth\\" $<
|
| 629 |
|
| 630 | {$(LIBCURL_SRC_DIR)\vtls\}.c{$(LIB_DIROBJ)\vtls\}.obj::
|
| 631 | $(CURL_CC) $(CFLAGS) /Fo"$(LIB_DIROBJ)\vtls\\" $<
|
| 632 |
|
| 633 | {$(LIBCURL_SRC_DIR)\vssh\}.c{$(LIB_DIROBJ)\vssh\}.obj::
|
| 634 | $(CURL_CC) $(CFLAGS) /Fo"$(LIB_DIROBJ)\vssh\\" $<
|
| 635 |
|
| 636 | {$(LIBCURL_SRC_DIR)\vquic\}.c{$(LIB_DIROBJ)\vquic\}.obj::
|
| 637 | $(CURL_CC) $(CFLAGS) /Fo"$(LIB_DIROBJ)\vquic\\" $<
|
| 638 |
|
| 639 | $(LIB_DIROBJ)\libcurl.res: $(LIBCURL_SRC_DIR)\libcurl.rc
|
| 640 | $(RC) $(RC_FLAGS)
|
| 641 |
|
| 642 | #
|
| 643 | # curl.exe
|
| 644 | #
|
| 645 |
|
| 646 |
|
| 647 | !IF "$(MODE)"=="static"
|
| 648 | !IF "$(DEBUG)"=="yes"
|
| 649 | CURL_LIBCURL_LIBNAME=$(LIB_NAME_STATIC_DEBUG)
|
| 650 | !ELSE
|
| 651 | CURL_LIBCURL_LIBNAME=$(LIB_NAME_STATIC)
|
| 652 | !ENDIF
|
| 653 | !ELSEIF "$(MODE)"=="dll"
|
| 654 | !IF "$(DEBUG)"=="yes"
|
| 655 | CURL_LIBCURL_LIBNAME=$(LIB_NAME_IMP_DEBUG)
|
| 656 | !ELSE
|
| 657 | CURL_LIBCURL_LIBNAME=$(LIB_NAME_IMP)
|
| 658 | !ENDIF
|
| 659 | !ENDIF
|
| 660 |
|
| 661 | CURL_FROM_LIBCURL=$(CURL_DIROBJ)\tool_hugehelp.obj \
|
| 662 | $(CURL_DIROBJ)\nonblock.obj \
|
| 663 | $(CURL_DIROBJ)\strtoofft.obj \
|
| 664 | $(CURL_DIROBJ)\warnless.obj \
|
| 665 | $(CURL_DIROBJ)\curl_multibyte.obj \
|
| 666 | $(CURL_DIROBJ)\version_win32.obj \
|
| 667 | $(CURL_DIROBJ)\dynbuf.obj
|
| 668 |
|
| 669 | $(PROGRAM_NAME): $(CURL_DIROBJ) $(CURL_FROM_LIBCURL) $(EXE_OBJS)
|
| 670 | $(CURL_LINK) $(CURL_LFLAGS) $(CURL_LIBCURL_LIBNAME) $(WIN_LIBS) $(CURL_FROM_LIBCURL) $(EXE_OBJS)
|
| 671 | $(MANIFESTTOOL)
|
| 672 |
|
| 673 | {$(CURL_SRC_DIR)\}.c{$(CURL_DIROBJ)\}.obj::
|
| 674 | $(CURL_CC) $(CURL_CFLAGS) /Fo"$(CURL_DIROBJ)\\" $<
|
| 675 |
|
| 676 | $(CURL_DIROBJ)\tool_hugehelp.obj: $(CURL_SRC_DIR)\tool_hugehelp.c
|
| 677 | $(CURL_CC) $(CURL_CFLAGS) /Zm200 /Fo"$@" $(CURL_SRC_DIR)\tool_hugehelp.c
|
| 678 | $(CURL_DIROBJ)\nonblock.obj: ../lib/nonblock.c
|
| 679 | $(CURL_CC) $(CURL_CFLAGS) /Fo"$@" ../lib/nonblock.c
|
| 680 | $(CURL_DIROBJ)\strtoofft.obj: ../lib/strtoofft.c
|
| 681 | $(CURL_CC) $(CURL_CFLAGS) /Fo"$@" ../lib/strtoofft.c
|
| 682 | $(CURL_DIROBJ)\warnless.obj: ../lib/warnless.c
|
| 683 | $(CURL_CC) $(CURL_CFLAGS) /Fo"$@" ../lib/warnless.c
|
| 684 | $(CURL_DIROBJ)\curl_multibyte.obj: ../lib/curl_multibyte.c
|
| 685 | $(CURL_CC) $(CURL_CFLAGS) /Fo"$@" ../lib/curl_multibyte.c
|
| 686 | $(CURL_DIROBJ)\version_win32.obj: ../lib/version_win32.c
|
| 687 | $(CURL_CC) $(CURL_CFLAGS) /Fo"$@" ../lib/version_win32.c
|
| 688 | $(CURL_DIROBJ)\dynbuf.obj: ../lib/dynbuf.c
|
| 689 | $(CURL_CC) $(CURL_CFLAGS) /Fo"$@" ../lib/dynbuf.c
|
| 690 | $(CURL_DIROBJ)\curl.res: $(CURL_SRC_DIR)\curl.rc
|
| 691 | rc $(CURL_RC_FLAGS)
|
| 692 |
|
| 693 | !ENDIF # End of case where a config was provided.
|
| 694 |
|
| 695 | clean:
|
| 696 | @-erase /s *.dll 2> NUL
|
| 697 | @-erase /s *.exp 2> NUL
|
| 698 | @-erase /s *.idb 2> NUL
|
| 699 | @-erase /s *.lib 2> NUL
|
| 700 | @-erase /s *.obj 2> NUL
|
| 701 | @-erase /s *.pch 2> NUL
|
| 702 | @-erase /s *.pdb 2> NUL
|
| 703 | @-erase /s *.res 2> NUL
|
| 704 | @if exist $(LIB_DIROBJ) rd /s/q $(LIB_DIROBJ)
|
| 705 | @if exist $(CURL_DIROBJ)rd /s/q $(CURL_DIROBJ)
|
| 706 | @if exist $(DIRDIST) rd /s/q $(DIRDIST)
|