1#*************************************************************************** 2# _ _ ____ _ 3# Project ___| | | | _ \| | 4# / __| | | | |_) | | 5# | (__| |_| | _ <| |___ 6# \___|\___/|_| \_\_____| 7# 8# Copyright (C) 1999 - 2017, 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!IF "$(MODE)"=="static" 24TARGET = $(LIB_NAME_STATIC) 25AS_DLL = false 26CFGSET=true 27!ELSEIF "$(MODE)"=="dll" 28TARGET = $(LIB_NAME_DLL) 29AS_DLL = true 30CFGSET=true 31!ELSE 32!MESSAGE Invalid mode: $(MODE) 33 34####################### 35# Usage 36# 37 38!MESSAGE Usage: nmake /f Makefile.vc mode=<static or dll> <options> 39!MESSAGE where <options> is one or many of: 40!MESSAGE VC=<6,7,8,9,10,11,12,14,15> - VC versions 41!MESSAGE WITH_DEVEL=<path> - Paths for the development files (SSL, zlib, etc.) 42!MESSAGE Defaults to sibbling directory deps: ../deps 43!MESSAGE Libraries can be fetched at https://windows.php.net/downloads/php-sdk/deps/ 44!MESSAGE Uncompress them into the deps folder. 45!MESSAGE WITH_SSL=<dll or static> - Enable OpenSSL support, DLL or static 46!MESSAGE WITH_NGHTTP2=<dll or static> - Enable HTTP/2 support, DLL or static 47!MESSAGE WITH_CARES=<dll or static> - Enable c-ares support, DLL or static 48!MESSAGE WITH_ZLIB=<dll or static> - Enable zlib support, DLL or static 49!MESSAGE WITH_SSH2=<dll or static> - Enable libSSH2 support, DLL or static 50!MESSAGE WITH_MBEDTLS=<dll or static> - Enable mbedTLS support, DLL or static 51!MESSAGE ENABLE_IDN=<yes or no> - Enable use of Windows IDN APIs, defaults to yes 52!MESSAGE Requires Windows Vista or later 53!MESSAGE ENABLE_IPV6=<yes or no> - Enable IPv6, defaults to yes 54!MESSAGE ENABLE_SSPI=<yes or no> - Enable SSPI support, defaults to yes 55!MESSAGE ENABLE_WINSSL=<yes or no> - Enable native Windows SSL support, defaults to yes 56!MESSAGE ENABLE_OPENSSL_AUTO_LOAD_CONFIG=<yes or no> 57!MESSAGE - Whether the OpenSSL configuration will be loaded automatically, defaults to yes 58!MESSAGE GEN_PDB=<yes or no> - Generate Program Database (debug symbols for release build) 59!MESSAGE DEBUG=<yes or no> - Debug builds 60!MESSAGE MACHINE=<x86 or x64> - Target architecture (default x64 on AMD64, x86 on others) 61!MESSAGE CARES_PATH=<path to cares> - Custom path for c-ares 62!MESSAGE MBEDTLS_PATH=<path to mbedTLS> - Custom path for mbedTLS 63!MESSAGE NGHTTP2_PATH=<path to HTTP/2> - Custom path for nghttp2 64!MESSAGE SSH2_PATH=<path to libSSH2> - Custom path for libSSH2 65!MESSAGE SSL_PATH=<path to OpenSSL> - Custom path for OpenSSL 66!MESSAGE ZLIB_PATH=<path to zlib> - Custom path for zlib 67!ERROR please choose a valid mode 68 69!ENDIF 70 71!INCLUDE "../lib/Makefile.inc" 72LIBCURL_OBJS=$(CSOURCES:.c=.obj) 73 74!INCLUDE "../src/Makefile.inc" 75 76# tool_hugehelp has a special rule 77CURL_OBJS=$(CURL_CFILES:tool_hugehelp.c=) 78 79CURL_OBJS=$(CURL_OBJS:.c=.obj) 80 81 82# backwards compatible check for USE_SSPI 83!IFDEF USE_SSPI 84ENABLE_SSPI = $(USE_SSPI) 85!ENDIF 86 87# default options 88 89!IFNDEF MACHINE 90# Note: nmake magically changes the value of PROCESSOR_ARCHITECTURE from "AMD64" 91# to "x86" when building in a 32 bit build environment on a 64 bit machine. 92!IF "$(PROCESSOR_ARCHITECTURE)"=="AMD64" 93MACHINE = x64 94!ELSE 95MACHINE = x86 96!ENDIF 97!ENDIF 98 99!IFNDEF ENABLE_IDN 100USE_IDN = true 101!ELSEIF "$(ENABLE_IDN)"=="yes" 102USE_IDN = true 103!ELSEIF "$(ENABLE_IDN)"=="no" 104USE_IDN = false 105!ENDIF 106 107!IFNDEF ENABLE_IPV6 108USE_IPV6 = true 109!ELSEIF "$(ENABLE_IPV6)"=="yes" 110USE_IPV6 = true 111!ELSEIF "$(ENABLE_IPV6)"=="no" 112USE_IPV6 = false 113!ENDIF 114 115!IFNDEF ENABLE_SSPI 116USE_SSPI = true 117!ELSEIF "$(ENABLE_SSPI)"=="yes" 118USE_SSPI = true 119!ELSEIF "$(ENABLE_SSPI)"=="no" 120USE_SSPI = false 121!ENDIF 122 123!IFNDEF ENABLE_WINSSL 124!IF DEFINED(WITH_SSL) || DEFINED(WITH_MBEDTLS) 125USE_WINSSL = false 126!ELSE 127USE_WINSSL = $(USE_SSPI) 128!ENDIF 129!ELSEIF "$(ENABLE_WINSSL)"=="yes" 130USE_WINSSL = true 131!ELSEIF "$(ENABLE_WINSSL)"=="no" 132USE_WINSSL = false 133!ENDIF 134 135!IFNDEF ENABLE_OPENSSL_AUTO_LOAD_CONFIG 136ENABLE_OPENSSL_AUTO_LOAD_CONFIG = true 137!ENDIF 138 139CONFIG_NAME_LIB = libcurl 140 141!IF "$(WITH_SSL)"=="dll" 142USE_SSL = true 143SSL = dll 144!ELSEIF "$(WITH_SSL)"=="static" 145USE_SSL = true 146SSL = static 147!ENDIF 148 149!IF "$(ENABLE_NGHTTP2)"=="yes" 150# compatibility bit, WITH_NGHTTP2 is the correct flag 151WITH_NGHTTP2 = dll 152USE_NGHTTP2 = true 153NGHTTP2 = dll 154!ELSEIF "$(WITH_NGHTTP2)"=="dll" 155USE_NGHTTP2 = true 156NGHTTP2 = dll 157!ELSEIF "$(WITH_NGHTTP2)"=="static" 158USE_NGHTTP2 = true 159NGHTTP2 = static 160!ENDIF 161 162!IFNDEF USE_NGHTTP2 163USE_NGHTTP2 = false 164!ENDIF 165 166!IF "$(WITH_MBEDTLS)"=="dll" || "$(WITH_MBEDTLS)"=="static" 167USE_MBEDTLS = true 168MBEDTLS = $(WITH_MBEDTLS) 169!ENDIF 170 171!IF ( "$(USE_SSL)"=="true" && "$(USE_WINSSL)"=="true" ) \ 172 || ( "$(USE_SSL)"=="true" && "$(USE_MBEDTLS)"=="true" ) \ 173 || ( "$(USE_MBEDTLS)"=="true" && "$(USE_WINSSL)"=="true" ) 174!ERROR SSL, MBEDTLS and WINSSL are mutual exclusive options. 175!ENDIF 176 177!IF "$(WITH_CARES)"=="dll" 178USE_CARES = true 179CARES = dll 180!ELSEIF "$(WITH_CARES)"=="static" 181USE_CARES = true 182CARES = static 183!ENDIF 184 185!IF "$(WITH_ZLIB)"=="dll" 186USE_ZLIB = true 187ZLIB = dll 188!ELSEIF "$(WITH_ZLIB)"=="static" 189USE_ZLIB = true 190ZLIB = static 191!ENDIF 192 193!IF "$(WITH_SSH2)"=="dll" 194USE_SSH2 = true 195SSH2 = dll 196!ELSEIF "$(WITH_SSH2)"=="static" 197USE_SSH2 = true 198SSH2 = static 199!ENDIF 200 201CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-vc$(VC)-$(MACHINE) 202 203!IF "$(DEBUG)"=="yes" 204CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-debug 205!ELSE 206CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-release 207!ENDIF 208 209!IF "$(AS_DLL)"=="true" 210CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-dll 211!ELSE 212CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-static 213!ENDIF 214 215!IF "$(USE_SSL)"=="true" 216CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-ssl-$(SSL) 217!ENDIF 218 219!IF "$(USE_MBEDTLS)"=="true" 220CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-mbedtls-$(MBEDTLS) 221!ENDIF 222 223!IF "$(USE_CARES)"=="true" 224CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-cares-$(CARES) 225!ENDIF 226 227!IF "$(USE_ZLIB)"=="true" 228CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-zlib-$(ZLIB) 229!ENDIF 230 231!IF "$(USE_SSH2)"=="true" 232CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-ssh2-$(SSH2) 233!ENDIF 234 235!IF "$(USE_IPV6)"=="true" 236CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-ipv6 237!ENDIF 238 239!IF "$(USE_SSPI)"=="true" 240CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-sspi 241!ENDIF 242 243!IF "$(USE_WINSSL)"=="true" 244CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-winssl 245!ENDIF 246 247!IF "$(USE_NGHTTP2)"=="true" 248CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-nghttp2-$(NGHTTP2) 249!ENDIF 250 251!MESSAGE configuration name: $(CONFIG_NAME_LIB) 252 253BUILD_DIR=../builds/$(CONFIG_NAME_LIB) 254LIBCURL_DIROBJ = ..\builds\$(CONFIG_NAME_LIB)-obj-lib 255CURL_DIROBJ = ..\builds\$(CONFIG_NAME_LIB)-obj-curl 256DIRDIST = ..\builds\$(CONFIG_NAME_LIB)\ 257 258$(MODE): 259 @SET DIROBJ=$(LIBCURL_DIROBJ) 260 @SET MACRO_NAME=LIBCURL_OBJS 261 @SET OUTFILE=LIBCURL_OBJS.inc 262 @CALL gen_resp_file.bat $(LIBCURL_OBJS) 263 264 @SET DIROBJ=$(CURL_DIROBJ) 265 @SET MACRO_NAME=CURL_OBJS 266 @SET OUTFILE=CURL_OBJS.inc 267 @CALL gen_resp_file.bat $(CURL_OBJS) 268 269 @SET CONFIG_NAME_LIB=$(CONFIG_NAME_LIB) 270 @SET MACHINE=$(MACHINE) 271 @SET USE_NGHTTP2=$(USE_NGHTTP2) 272 @SET USE_IDN=$(USE_IDN) 273 @SET USE_IPV6=$(USE_IPV6) 274 @SET USE_SSPI=$(USE_SSPI) 275 @SET USE_WINSSL=$(USE_WINSSL) 276# compatibility bit 277 @SET WITH_NGHTTP2=$(WITH_NGHTTP2) 278 279 @$(MAKE) /NOLOGO /F MakefileBuild.vc 280 281copy_from_lib: 282 echo copying .c... 283 FOR %%i IN ($(CURLX_CFILES:/=\)) DO copy %%i ..\src\ 284 285clean: 286 $(MAKE) /NOLOGO /F MakefileBuild.vc $@ 287