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 /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 /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 /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!IF "$(DISABLE_WEBSOCKETS)"=="true" 145CFLAGS = $(CFLAGS) /DCURL_DISABLE_WEBSOCKETS=1 146!ENDIF 147 148!IFDEF NGHTTP2_PATH 149NGHTTP2_INC_DIR = $(NGHTTP2_PATH)\include 150NGHTTP2_LIB_DIR = $(NGHTTP2_PATH)\lib 151NGHTTP2_LFLAGS = $(NGHTTP2_LFLAGS) "/LIBPATH:$(NGHTTP2_LIB_DIR)" 152!ELSE 153NGHTTP2_INC_DIR = $(DEVEL_INCLUDE) 154NGHTTP2_LIB_DIR = $(DEVEL_LIB) 155!ENDIF 156 157!IF "$(WITH_NGHTTP2)"=="dll" 158NGHTTP2_CFLAGS = /DUSE_NGHTTP2 /I"$(NGHTTP2_INC_DIR)" 159NGHTTP2_LIBS = nghttp2.lib 160!ELSEIF "$(WITH_NGHTTP2)"=="static" 161NGHTTP2_CFLAGS = /DUSE_NGHTTP2 /DNGHTTP2_STATICLIB /I"$(NGHTTP2_INC_DIR)" 162!IF EXISTS("$(NGHTTP2_LIB_DIR)\nghttp2_static.lib") 163NGHTTP2_LIBS = nghttp2_static.lib 164!ELSE 165NGHTTP2_LIBS = nghttp2.lib 166!ENDIF 167!ENDIF 168 169!IFDEF MSH3_PATH 170MSH3_INC_DIR = $(MSH3_PATH)\include 171MSH3_LIB_DIR = $(MSH3_PATH)\lib 172MSH3_LFLAGS = $(MSH3_LFLAGS) "/LIBPATH:$(MSH3_LIB_DIR)" 173!ELSE 174MSH3_INC_DIR = $(DEVEL_INCLUDE) 175MSH3_LIB_DIR = $(DEVEL_LIB) 176!ENDIF 177 178!IF "$(WITH_MSH3)"=="dll" 179MSH3_CFLAGS = /DUSE_MSH3 /I"$(MSH3_INC_DIR)" 180MSH3_LIBS = msh3.lib 181!ELSEIF "$(WITH_MSH3)"=="static" 182MSH3_CFLAGS = /DUSE_MSH3 /DMSH3_STATICLIB /I"$(MSH3_INC_DIR)" 183!IF EXISTS("$(NGHTTP2_LIB_DIR)\msh3_static.lib") 184MSH3_LIBS = msh3_static.lib 185!ELSE 186MSH3_LIBS = msh3.lib 187!ENDIF 188!ENDIF 189 190!IFDEF MBEDTLS_PATH 191MBEDTLS_INC_DIR = $(MBEDTLS_PATH)\include 192MBEDTLS_LIB_DIR = $(MBEDTLS_PATH)\lib 193MBEDTLS_LFLAGS = $(MBEDTLS_LFLAGS) "/LIBPATH:$(MBEDTLS_LIB_DIR)" 194!ELSE 195MBEDTLS_INC_DIR = $(DEVEL_INCLUDE) 196MBEDTLS_LIB_DIR = $(DEVEL_LIB) 197!ENDIF 198 199!IF "$(WITH_MBEDTLS)"=="dll" || "$(WITH_MBEDTLS)"=="static" 200USE_MBEDTLS = true 201MBEDTLS = $(WITH_MBEDTLS) 202MBEDTLS_CFLAGS = /DUSE_MBEDTLS /I"$(MBEDTLS_INC_DIR)" 203MBEDTLS_LIBS = mbedtls.lib mbedcrypto.lib mbedx509.lib 204!ENDIF 205 206!IFDEF WOLFSSL_PATH 207WOLFSSL_INC_DIR = $(WOLFSSL_PATH)\include 208WOLFSSL_LIB_DIR = $(WOLFSSL_PATH)\lib 209WOLFSSL_LFLAGS = $(WOLFSSL_LFLAGS) "/LIBPATH:$(WOLFSSL_LIB_DIR)" 210!ELSE 211WOLFSSL_INC_DIR = $(DEVEL_INCLUDE) 212WOLFSSL_LIB_DIR = $(DEVEL_LIB) 213!ENDIF 214 215!IF "$(WITH_WOLFSSL)"=="dll" || "$(WITH_WOLFSSL)"=="static" 216USE_WOLFSSL = true 217WOLFSSL = $(WITH_WOLFSSL) 218WOLFSSL_CFLAGS = /DUSE_WOLFSSL /I"$(WOLFSSL_INC_DIR)" 219WOLFSSL_LIBS = wolfssl.lib 220!ENDIF 221 222 223!IFDEF CARES_PATH 224CARES_INC_DIR = $(CARES_PATH)\include 225CARES_LIB_DIR = $(CARES_PATH)\lib 226CARES_LFLAGS = $(CARES_LFLAGS) "/LIBPATH:$(CARES_LIB_DIR)" 227!ELSE 228CARES_INC_DIR = $(DEVEL_INCLUDE)/cares 229CARES_LIB_DIR = $(DEVEL_LIB) 230!ENDIF 231 232!IF "$(WITH_CARES)"=="dll" 233!IF "$(DEBUG)"=="yes" 234CARES_LIBS = caresd.lib 235!ELSE 236CARES_LIBS = cares.lib 237!ENDIF 238USE_CARES = true 239CARES = dll 240!ELSEIF "$(WITH_CARES)"=="static" 241!IF "$(DEBUG)"=="yes" 242CARES_LIBS = libcaresd.lib 243!ELSE 244CARES_LIBS = libcares.lib 245!ENDIF 246USE_CARES = true 247CARES = static 248!ENDIF 249 250!IFDEF USE_CARES 251CARES_CFLAGS = /DUSE_ARES /I"$(CARES_INC_DIR)" 252!IF "$(CARES)"=="static" 253CARES_CFLAGS = $(CARES_CFLAGS) /DCARES_STATICLIB 254!ENDIF 255!ENDIF 256 257 258!IFDEF ZLIB_PATH 259ZLIB_INC_DIR = $(ZLIB_PATH)\include 260ZLIB_LIB_DIR = $(ZLIB_PATH)\lib 261ZLIB_LFLAGS = $(ZLIB_LFLAGS) "/LIBPATH:$(ZLIB_LIB_DIR)" 262!ELSE 263ZLIB_INC_DIR = $(DEVEL_INCLUDE) 264ZLIB_LIB_DIR = $(DEVEL_LIB) 265!ENDIF 266 267# Depending on how zlib is built the libraries have different names, we 268# try to handle them all. 269!IF "$(WITH_ZLIB)"=="dll" 270!IF EXISTS("$(ZLIB_LIB_DIR)\zlibwapi.lib") 271ZLIB_LIBS = zlibwapi.lib 272ADDITIONAL_ZLIB_CFLAGS = /DZLIB_WINAPI 273!ELSEIF EXISTS("$(ZLIB_LIB_DIR)\zdll.lib") 274ZLIB_LIBS = zdll.lib 275!ELSE 276ZLIB_LIBS = zlib.lib 277!ENDIF 278USE_ZLIB = true 279ZLIB = dll 280!ELSEIF "$(WITH_ZLIB)"=="static" 281!IF EXISTS("$(ZLIB_LIB_DIR)\zlibstat.lib") 282ZLIB_LIBS = zlibstat.lib 283ADDITIONAL_ZLIB_CFLAGS = /DZLIB_WINAPI 284!ELSEIF EXISTS("$(ZLIB_LIB_DIR)\zlibstatic.lib") 285ZLIB_LIBS = zlibstatic.lib 286!ELSEIF EXISTS("$(ZLIB_LIB_DIR)\zlib.lib") 287ZLIB_LIBS = zlib.lib 288!ELSE 289ZLIB_LIBS = zlib_a.lib 290!ENDIF 291USE_ZLIB = true 292ZLIB = static 293!ENDIF 294 295!IFDEF USE_ZLIB 296ZLIB_CFLAGS = /DHAVE_LIBZ $(ADDITIONAL_ZLIB_CFLAGS) /I"$(ZLIB_INC_DIR)" 297!ENDIF 298 299 300!IFDEF SSH2_PATH 301SSH2_INC_DIR= $(SSH2_PATH)\include 302SSH2_LIB_DIR= $(SSH2_PATH)\lib 303SSH2_LFLAGS = $(SSH2_LFLAGS) "/LIBPATH:$(SSH2_LIB_DIR)" 304!ELSE 305SSH2_LIB_DIR= $(DEVEL_LIB) 306SSH2_INC_DIR= $(DEVEL_INCLUDE)/libssh2 307!ENDIF 308 309!IF "$(WITH_SSH2)"=="dll" 310SSH2_LIBS = libssh2.lib 311USE_SSH2 = true 312SSH2 = dll 313!ELSEIF "$(WITH_SSH2)"=="static" 314# libssh2 NMakefile on Windows at default creates a static library without _a suffix 315!IF EXISTS("$(SSH2_LIB_DIR)\libssh2.lib") 316SSH2_LIBS = libssh2.lib 317!ELSE 318SSH2_LIBS = libssh2_a.lib 319!ENDIF 320WIN_LIBS = $(WIN_LIBS) user32.lib 321USE_SSH2 = true 322SSH2 = static 323!ENDIF 324 325!IFDEF USE_SSH2 326SSH2_CFLAGS = /DUSE_LIBSSH2 327SSH2_CFLAGS = $(SSH2_CFLAGS) /I"$(SSH2_INC_DIR)" 328!ENDIF 329 330 331!IFDEF SSH_PATH 332SSH_INC_DIR= $(SSH_PATH)\include 333SSH_LIB_DIR= $(SSH_PATH)\lib 334SSH_LFLAGS = $(SSH_LFLAGS) "/LIBPATH:$(SSH_LIB_DIR)" 335!ELSE 336SSH_LIB_DIR= $(DEVEL_LIB) 337SSH_INC_DIR= $(DEVEL_INCLUDE) 338!ENDIF 339 340!IF "$(WITH_SSH)"=="dll" || "$(WITH_SSH)"=="static" 341SSH_LIBS = ssh.lib 342USE_SSH = true 343SSH = $(WITH_SSH) 344!ENDIF 345 346!IFDEF USE_SSH 347SSH_CFLAGS = /DUSE_LIBSSH 348SSH_CFLAGS = $(SSH_CFLAGS) /I"$(SSH_INC_DIR)" 349!ENDIF 350 351 352!IFNDEF USE_IDN 353USE_IDN = true 354!ELSEIF "$(USE_IDN)"=="yes" 355USE_IDN = true 356!ENDIF 357 358!IF "$(USE_IDN)"=="true" 359IDN_CFLAGS = $(IDN_CFLAGS) /DUSE_WIN32_IDN 360WIN_LIBS = $(WIN_LIBS) Normaliz.lib 361!ENDIF 362 363 364!IFNDEF USE_IPV6 365USE_IPV6 = true 366!ELSEIF "$(USE_IPV6)"=="yes" 367USE_IPV6 = true 368!ENDIF 369 370!IF "$(USE_IPV6)"=="true" 371IPV6_CFLAGS = $(IPV6_CFLAGS) /DUSE_IPV6 372!ENDIF 373 374 375!IFNDEF USE_SSPI 376USE_SSPI = true 377!ELSEIF "$(USE_SSPI)"=="yes" 378USE_SSPI = true 379!ENDIF 380 381!IF "$(USE_SSPI)"=="true" 382SSPI_CFLAGS = $(SSPI_CFLAGS) /DUSE_WINDOWS_SSPI 383!ENDIF 384 385 386!IFNDEF USE_SCHANNEL 387!IF "$(USE_SSL)"=="true" 388USE_SCHANNEL = false 389!ELSE 390USE_SCHANNEL = $(USE_SSPI) 391!ENDIF 392!ELSEIF "$(USE_SCHANNEL)"=="yes" 393USE_SCHANNEL = true 394!ENDIF 395 396 397!IF "$(USE_SCHANNEL)"=="true" 398!IF "$(USE_SSPI)"!="true" 399!ERROR cannot build with Schannel without SSPI 400!ENDIF 401SSPI_CFLAGS = $(SSPI_CFLAGS) /DUSE_SCHANNEL 402WIN_LIBS = $(WIN_LIBS) Crypt32.lib 403!ENDIF 404 405 406!IF "$(GEN_PDB)"=="yes" 407GEN_PDB = true 408!ENDIF 409 410 411!IFDEF EMBED_MANIFEST 412MANIFESTTOOL = $(MT) -manifest $(DIRDIST)\bin\$(PROGRAM_NAME).manifest -outputresource:$(DIRDIST)\bin\$(PROGRAM_NAME);1 413!ELSE 414CURL_RC_FLAGS = $(CURL_RC_FLAGS) /dCURL_EMBED_MANIFEST 415!ENDIF 416 417# Runtime library configuration 418!IF "$(RTLIBCFG)"=="static" 419RTLIB = /MT 420RTLIB_DEBUG = /MTd 421!ELSE 422RTLIB = /MD 423RTLIB_DEBUG = /MDd 424!ENDIF 425 426!IF "$(MODE)"=="static" 427TARGET = $(LIB_NAME_STATIC) 428CURL_LIBCURL_LIBNAME=$(LIB_NAME_STATIC) 429AS_DLL = false 430CFGSET = true 431!ELSEIF "$(MODE)"=="dll" 432TARGET = $(LIB_NAME_DLL) 433CURL_LIBCURL_LIBNAME=$(LIB_NAME_IMP) 434AS_DLL = true 435CFGSET = true 436!ENDIF 437 438!IF "$(CFGSET)" == "FALSE" 439!ERROR please choose a valid mode 440!ENDIF 441 442 443 444# CURL_XX macros are for the curl.exe command 445 446!IF "$(DEBUG)"=="yes" 447RC_FLAGS = /d_DEBUG /Fo $@ $(LIBCURL_SRC_DIR)\libcurl.rc 448CURL_CC = $(CC_DEBUG) $(RTLIB_DEBUG) 449CURL_RC_FLAGS = $(CURL_RC_FLAGS) /i../include /d_DEBUG /Fo $@ $(CURL_SRC_DIR)\curl.rc 450!ELSE 451RC_FLAGS = /Fo $@ $(LIBCURL_SRC_DIR)\libcurl.rc 452CURL_CC = $(CC_NODEBUG) $(RTLIB) 453CURL_RC_FLAGS = $(CURL_RC_FLAGS) /i../include /Fo $@ $(CURL_SRC_DIR)\curl.rc 454!ENDIF 455 456!IF "$(AS_DLL)" == "true" 457 458LNK = $(LNKDLL) $(LFLAGS) $(WIN_LIBS) /out:$(LIB_DIROBJ)\$(TARGET) 459!IF "$(DEBUG)"=="yes" 460TARGET = $(LIB_NAME_DLL_DEBUG) 461LNK = $(LNK) /DEBUG /IMPLIB:$(LIB_DIROBJ)\$(LIB_NAME_IMP_DEBUG) 462PDB = $(PDB_NAME_DLL_DEBUG) 463CURL_LIBS = /IMPLIB:$(LIB_DIROBJ)\$(LIB_NAME_IMP_DEBUG) 464!ELSE 465TARGET = $(LIB_NAME_DLL) 466LNK = $(LNK) /IMPLIB:$(LIB_DIROBJ)\$(LIB_NAME_IMP) 467PDB = $(PDB_NAME_DLL) 468CURL_LIBS = /IMPLIB:$(LIB_DIROBJ)\$(LIB_NAME_IMP) 469!ENDIF 470RESOURCE = $(LIB_DIROBJ)\libcurl.res 471 472# AS_DLL 473!ELSE 474 475!IF "$(DEBUG)"=="yes" 476TARGET = $(LIB_NAME_STATIC_DEBUG) 477PDB = $(PDB_NAME_STATIC_DEBUG) 478!ELSE 479TARGET = $(LIB_NAME_STATIC) 480PDB = $(PDB_NAME_STATIC) 481!ENDIF 482LNK = $(LNKLIB) /out:$(LIB_DIROBJ)\$(TARGET) 483CURL_CC = $(CURL_CC) $(CFLAGS_LIBCURL_STATIC) 484 485# AS_DLL 486!ENDIF 487 488!IF "$(USE_SSL)"=="true" 489CFLAGS = $(CFLAGS) $(SSL_CFLAGS) 490LFLAGS = $(LFLAGS) $(SSL_LFLAGS) $(SSL_LIBS) 491!ENDIF 492 493!IF "$(USE_MBEDTLS)"=="true" 494CFLAGS = $(CFLAGS) $(MBEDTLS_CFLAGS) 495LFLAGS = $(LFLAGS) $(MBEDTLS_LFLAGS) $(MBEDTLS_LIBS) 496!ENDIF 497 498!IF "$(USE_WOLFSSL)"=="true" 499CFLAGS = $(CFLAGS) $(WOLFSSL_CFLAGS) 500LFLAGS = $(LFLAGS) $(WOLFSSL_LFLAGS) $(WOLFSSL_LIBS) 501!ENDIF 502 503!IF "$(USE_CARES)"=="true" 504CFLAGS = $(CFLAGS) $(CARES_CFLAGS) 505LFLAGS = $(LFLAGS) $(CARES_LFLAGS) $(CARES_LIBS) 506!ENDIF 507 508!IF "$(USE_ZLIB)"=="true" 509CFLAGS = $(CFLAGS) $(ZLIB_CFLAGS) 510LFLAGS = $(LFLAGS) $(ZLIB_LFLAGS) $(ZLIB_LIBS) 511!ENDIF 512 513!IF "$(USE_SSH2)"=="true" 514CFLAGS = $(CFLAGS) $(SSH2_CFLAGS) 515LFLAGS = $(LFLAGS) $(SSH2_LFLAGS) $(SSH2_LIBS) 516!ENDIF 517 518!IF "$(USE_SSH)"=="true" 519CFLAGS = $(CFLAGS) $(SSH_CFLAGS) 520LFLAGS = $(LFLAGS) $(SSH_LFLAGS) $(SSH_LIBS) 521!ENDIF 522 523!IF "$(USE_IDN)"=="true" 524CFLAGS = $(CFLAGS) $(IDN_CFLAGS) 525!ENDIF 526 527!IF "$(USE_IPV6)"=="true" 528CFLAGS = $(CFLAGS) $(IPV6_CFLAGS) 529!ENDIF 530 531!IF "$(USE_SSPI)"=="true" 532CFLAGS = $(CFLAGS) $(SSPI_CFLAGS) 533!ENDIF 534 535!IF "$(USE_NGHTTP2)"=="true" 536CFLAGS = $(CFLAGS) $(NGHTTP2_CFLAGS) 537LFLAGS = $(LFLAGS) $(NGHTTP2_LFLAGS) $(NGHTTP2_LIBS) 538!ENDIF 539 540!IF "$(USE_MSH3)"=="true" 541CFLAGS = $(CFLAGS) $(MSH3_CFLAGS) 542LFLAGS = $(LFLAGS) $(MSH3_LFLAGS) $(MSH3_LIBS) 543!ENDIF 544 545!IF "$(GEN_PDB)"=="true" 546CFLAGS = $(CFLAGS) $(CFLAGS_PDB) /Fd"$(LIB_DIROBJ)\$(PDB)" 547LFLAGS = $(LFLAGS) $(LFLAGS_PDB) 548!ENDIF 549 550!IF ( "$(USE_SSL)"=="true" && "$(USE_SCHANNEL)"=="true" ) \ 551 || ( "$(USE_SSL)"=="true" && "$(USE_MBEDTLS)"=="true" ) \ 552 || ( "$(USE_SSL)"=="true" && "$(USE_WOLFSSL)"=="true" ) \ 553 || ( "$(USE_MBEDTLS)"=="true" && "$(USE_WOLFSSL)"=="true" ) \ 554 || ( "$(USE_MBEDTLS)"=="true" && "$(USE_SCHANNEL)"=="true" ) \ 555 || ( "$(USE_WOLFSSL)"=="true" && "$(USE_SCHANNEL)"=="true" ) 556CFLAGS = $(CFLAGS) /DCURL_WITH_MULTI_SSL 557!ENDIF 558 559!IF "$(USE_UNICODE)"=="true" 560CFLAGS = $(CFLAGS) /DUNICODE /D_UNICODE 561!ENDIF 562 563LIB_DIROBJ = ..\builds\$(CONFIG_NAME_LIB)-obj-lib 564CURL_DIROBJ = ..\builds\$(CONFIG_NAME_LIB)-obj-curl 565 566!IFDEF WITH_PREFIX 567DIRDIST = $(WITH_PREFIX) 568!ELSE 569DIRDIST = ..\builds\$(CONFIG_NAME_LIB)\ 570!ENDIF 571 572# 573# curl.exe 574# 575CURL_LINK = link.exe /incremental:no /libpath:"$(DIRDIST)\lib" 576 577!IF "$(CFGSET)" != "FALSE" 578# A mode was provided, so the library can be built. 579# 580!include CURL_OBJS.inc 581!include LIBCURL_OBJS.inc 582 583!IF "$(AS_DLL)" == "true" 584LIB_OBJS = $(LIBCURL_OBJS) $(RESOURCE) 585!ELSE 586LIB_OBJS = $(LIBCURL_OBJS) 587!ENDIF 588 589EXE_OBJS = $(CURL_OBJS) $(CURL_DIROBJ)\curl.res 590 591all : $(TARGET) $(PROGRAM_NAME) 592 593package: $(TARGET) 594 @cd $(DIRDIST) 595 @-$(ZIP) -9 -q -r ..\$(CONFIG_NAME_LIB).zip .>nul 2<&1 596 @cd $(MAKEDIR) 597 598$(TARGET): $(LIB_OBJS) $(LIB_DIROBJ) $(DIRDIST) 599 @echo Using SSL: $(USE_SSL) 600 @echo Using NGHTTP2: $(USE_NGHTTP2) 601 @echo Using MSH3: $(USE_MSH3) 602 @echo Using c-ares: $(USE_CARES) 603 @echo Using SSH2: $(USE_SSH2) 604 @echo Using SSH: $(USE_SSH) 605 @echo Using ZLIB: $(USE_ZLIB) 606 @echo Using IDN: $(USE_IDN) 607 @echo Using IPv6: $(USE_IPV6) 608 @echo Using SSPI: $(USE_SSPI) 609 @echo Using Schannel: $(USE_SCHANNEL) 610 @echo CFLAGS: $(CFLAGS) 611 @echo LFLAGS: $(LFLAGS) 612 @echo GenPDB: $(GEN_PDB) 613 @echo Debug: $(DEBUG) 614 @echo Machine: $(MACHINE) 615 $(LNK) $(LIB_OBJS) 616 @echo Copying libs... 617 @if exist $(LIB_DIROBJ)\$(LIB_NAME_DLL) copy $(LIB_DIROBJ)\$(LIB_NAME_DLL) $(DIRDIST)\bin\ /y >nul 2<&1 618 @if exist $(LIB_DIROBJ)\$(LIB_NAME_STATIC) copy $(LIB_DIROBJ)\$(LIB_NAME_STATIC) $(DIRDIST)\lib\ /y >nul 2<&1 619 @if exist $(LIB_DIROBJ)\$(LIB_NAME_DLL_DEBUG) copy $(LIB_DIROBJ)\$(LIB_NAME_DLL_DEBUG) $(DIRDIST)\bin\ /y >nul 2<&1 620 @if exist $(LIB_DIROBJ)\$(LIB_NAME_STATIC_DEBUG) copy $(LIB_DIROBJ)\$(LIB_NAME_STATIC_DEBUG) $(DIRDIST)\lib\ /y >nul 2<&1 621 @if exist $(LIB_DIROBJ)\$(LIB_NAME_IMP) copy $(LIB_DIROBJ)\$(LIB_NAME_IMP) $(DIRDIST)\lib\ /y >nul 2<&1 622 @if exist $(LIB_DIROBJ)\$(LIB_NAME_IMP_DEBUG) copy $(LIB_DIROBJ)\$(LIB_NAME_IMP_DEBUG) $(DIRDIST)\lib >nul 2<&1 623 @-copy $(LIB_DIROBJ)\*.exp $(DIRDIST)\lib /y >nul 2<&1 624 @-copy $(LIB_DIROBJ)\*.pdb $(DIRDIST)\lib /y >nul 2<&1 625 @-copy ..\include\curl\*.h $(DIRDIST)\include\curl\ /y >nul 2<&1 626 627$(LIB_OBJS): $(LIB_DIROBJ) $(DIRDIST) 628 629$(DIRDIST): 630 @if not exist "$(DIRDIST)\bin" mkdir $(DIRDIST)\bin 631 @if not exist "$(DIRDIST)\include" mkdir $(DIRDIST)\include 632 @if not exist "$(DIRDIST)\include\curl" mkdir $(DIRDIST)\include\curl 633 @if not exist "$(DIRDIST)\lib" mkdir $(DIRDIST)\lib 634 635$(LIB_DIROBJ): 636 @if not exist "$(LIB_DIROBJ)" mkdir $(LIB_DIROBJ) 637 @if not exist "$(LIB_DIROBJ)\vauth" mkdir $(LIB_DIROBJ)\vauth 638 @if not exist "$(LIB_DIROBJ)\vtls" mkdir $(LIB_DIROBJ)\vtls 639 @if not exist "$(LIB_DIROBJ)\vssh" mkdir $(LIB_DIROBJ)\vssh 640 @if not exist "$(LIB_DIROBJ)\vquic" mkdir $(LIB_DIROBJ)\vquic 641 642$(CURL_DIROBJ): 643 @if not exist "$(CURL_DIROBJ)" mkdir $(CURL_DIROBJ) 644# we need a lib dir for the portability functions from libcurl 645# we use the .c directly here 646 @if not exist "$(CURL_DIROBJ)" mkdir $(CURL_DIROBJ)\lib 647 648.SUFFIXES: .c .obj .res 649 650{$(LIBCURL_SRC_DIR)\}.c{$(LIB_DIROBJ)\}.obj:: 651 $(CURL_CC) $(CFLAGS) /Fo"$(LIB_DIROBJ)\\" $< 652 653{$(LIBCURL_SRC_DIR)\vauth\}.c{$(LIB_DIROBJ)\vauth\}.obj:: 654 $(CURL_CC) $(CFLAGS) /Fo"$(LIB_DIROBJ)\vauth\\" $< 655 656{$(LIBCURL_SRC_DIR)\vtls\}.c{$(LIB_DIROBJ)\vtls\}.obj:: 657 $(CURL_CC) $(CFLAGS) /Fo"$(LIB_DIROBJ)\vtls\\" $< 658 659{$(LIBCURL_SRC_DIR)\vssh\}.c{$(LIB_DIROBJ)\vssh\}.obj:: 660 $(CURL_CC) $(CFLAGS) /Fo"$(LIB_DIROBJ)\vssh\\" $< 661 662{$(LIBCURL_SRC_DIR)\vquic\}.c{$(LIB_DIROBJ)\vquic\}.obj:: 663 $(CURL_CC) $(CFLAGS) /Fo"$(LIB_DIROBJ)\vquic\\" $< 664 665$(LIB_DIROBJ)\libcurl.res: $(LIBCURL_SRC_DIR)\libcurl.rc 666 $(RC) $(RC_FLAGS) 667 668# 669# curl.exe 670# 671 672 673!IF "$(MODE)"=="static" 674!IF "$(DEBUG)"=="yes" 675CURL_LIBCURL_LIBNAME=$(LIB_NAME_STATIC_DEBUG) 676!ELSE 677CURL_LIBCURL_LIBNAME=$(LIB_NAME_STATIC) 678!ENDIF 679!ELSEIF "$(MODE)"=="dll" 680!IF "$(DEBUG)"=="yes" 681CURL_LIBCURL_LIBNAME=$(LIB_NAME_IMP_DEBUG) 682!ELSE 683CURL_LIBCURL_LIBNAME=$(LIB_NAME_IMP) 684!ENDIF 685!ENDIF 686 687CURL_FROM_LIBCURL=$(CURL_DIROBJ)\tool_hugehelp.obj \ 688 $(CURL_DIROBJ)\nonblock.obj \ 689 $(CURL_DIROBJ)\strtoofft.obj \ 690 $(CURL_DIROBJ)\warnless.obj \ 691 $(CURL_DIROBJ)\curl_multibyte.obj \ 692 $(CURL_DIROBJ)\version_win32.obj \ 693 $(CURL_DIROBJ)\dynbuf.obj \ 694 $(CURL_DIROBJ)\base64.obj 695 696$(PROGRAM_NAME): $(CURL_DIROBJ) $(CURL_FROM_LIBCURL) $(EXE_OBJS) 697 $(CURL_LINK) $(CURL_LFLAGS) $(CURL_LIBCURL_LIBNAME) $(WIN_LIBS) $(CURL_FROM_LIBCURL) $(EXE_OBJS) 698 $(MANIFESTTOOL) 699 700{$(CURL_SRC_DIR)\}.c{$(CURL_DIROBJ)\}.obj:: 701 $(CURL_CC) $(CURL_CFLAGS) /Fo"$(CURL_DIROBJ)\\" $< 702 703$(CURL_DIROBJ)\tool_hugehelp.obj: $(CURL_SRC_DIR)\tool_hugehelp.c 704 $(CURL_CC) $(CURL_CFLAGS) /Zm200 /Fo"$@" $(CURL_SRC_DIR)\tool_hugehelp.c 705$(CURL_DIROBJ)\nonblock.obj: ../lib/nonblock.c 706 $(CURL_CC) $(CURL_CFLAGS) /Fo"$@" ../lib/nonblock.c 707$(CURL_DIROBJ)\strtoofft.obj: ../lib/strtoofft.c 708 $(CURL_CC) $(CURL_CFLAGS) /Fo"$@" ../lib/strtoofft.c 709$(CURL_DIROBJ)\warnless.obj: ../lib/warnless.c 710 $(CURL_CC) $(CURL_CFLAGS) /Fo"$@" ../lib/warnless.c 711$(CURL_DIROBJ)\curl_multibyte.obj: ../lib/curl_multibyte.c 712 $(CURL_CC) $(CURL_CFLAGS) /Fo"$@" ../lib/curl_multibyte.c 713$(CURL_DIROBJ)\version_win32.obj: ../lib/version_win32.c 714 $(CURL_CC) $(CURL_CFLAGS) /Fo"$@" ../lib/version_win32.c 715$(CURL_DIROBJ)\dynbuf.obj: ../lib/dynbuf.c 716 $(CURL_CC) $(CURL_CFLAGS) /Fo"$@" ../lib/dynbuf.c 717$(CURL_DIROBJ)\base64.obj: ../lib/base64.c 718 $(CURL_CC) $(CURL_CFLAGS) /Fo"$@" ../lib/base64.c 719$(CURL_DIROBJ)\curl.res: $(CURL_SRC_DIR)\curl.rc 720 $(RC) $(CURL_RC_FLAGS) 721 722!ENDIF # End of case where a config was provided. 723 724# Makefile.vc's clean removes (LIB)CURL_DIROBJ and DIRDIST dirs then calls 725# this clean. Note those are the original directories we control and not the 726# directories possibly modified by this makefile to point to user-specified 727# directories. 728# For example, don't remove DIRDIST here since it may contain user files if it 729# has been changed by WITH_PREFIX to a different output dir (eg C:\usr\local). 730clean: 731 @-erase /s *.dll 2> NUL 732 @-erase /s *.exp 2> NUL 733 @-erase /s *.idb 2> NUL 734 @-erase /s *.lib 2> NUL 735 @-erase /s *.obj 2> NUL 736 @-erase /s *.pch 2> NUL 737 @-erase /s *.pdb 2> NUL 738 @-erase /s *.res 2> NUL 739