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