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