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