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!IF "$(MODE)"=="static" 26TARGET = $(LIB_NAME_STATIC) 27AS_DLL = false 28CFGSET=true 29!ELSEIF "$(MODE)"=="dll" 30TARGET = $(LIB_NAME_DLL) 31AS_DLL = true 32CFGSET=true 33!ELSE 34!MESSAGE Invalid mode: $(MODE) 35 36####################### 37# Usage 38# 39 40!MESSAGE See winbuild/README.md for usage 41!ERROR please choose a valid mode 42 43!ENDIF 44 45!INCLUDE "../lib/Makefile.inc" 46LIBCURL_OBJS=$(CSOURCES:.c=.obj) 47 48!INCLUDE "../src/Makefile.inc" 49 50# tool_hugehelp has a special rule 51CURL_OBJS=$(CURL_CFILES:tool_hugehelp.c=) 52 53CURL_OBJS=$(CURL_OBJS:.c=.obj) 54 55 56# backwards compatible check for USE_SSPI 57!IFDEF USE_SSPI 58ENABLE_SSPI = $(USE_SSPI) 59!ENDIF 60 61# default options 62 63!IFNDEF MACHINE 64# Note: nmake magically changes the value of PROCESSOR_ARCHITECTURE from "AMD64" 65# to "x86" when building in a 32 bit build environment on a 64 bit machine. 66!IF "$(PROCESSOR_ARCHITECTURE)"=="AMD64" 67MACHINE = x64 68!ELSE 69MACHINE = x86 70!ENDIF 71!ENDIF 72 73!IFNDEF ENABLE_IDN 74USE_IDN = true 75!ELSEIF "$(ENABLE_IDN)"=="yes" 76USE_IDN = true 77!ELSEIF "$(ENABLE_IDN)"=="no" 78USE_IDN = false 79!ENDIF 80 81!IFNDEF ENABLE_IPV6 82USE_IPV6 = true 83!ELSEIF "$(ENABLE_IPV6)"=="yes" 84USE_IPV6 = true 85!ELSEIF "$(ENABLE_IPV6)"=="no" 86USE_IPV6 = false 87!ENDIF 88 89!IFNDEF ENABLE_SSPI 90USE_SSPI = true 91!ELSEIF "$(ENABLE_SSPI)"=="yes" 92USE_SSPI = true 93!ELSEIF "$(ENABLE_SSPI)"=="no" 94USE_SSPI = false 95!ENDIF 96 97!IFNDEF ENABLE_SCHANNEL 98!IF DEFINED(WITH_SSL) || DEFINED(WITH_MBEDTLS) || DEFINED(WITH_WOLFSSL) 99USE_SCHANNEL = false 100!ELSE 101USE_SCHANNEL = $(USE_SSPI) 102!ENDIF 103!ELSEIF "$(ENABLE_SCHANNEL)"=="yes" 104USE_SCHANNEL = true 105!ELSEIF "$(ENABLE_SCHANNEL)"=="no" 106USE_SCHANNEL = false 107!ENDIF 108 109!IFNDEF ENABLE_OPENSSL_AUTO_LOAD_CONFIG 110ENABLE_OPENSSL_AUTO_LOAD_CONFIG = true 111!ELSEIF "$(ENABLE_OPENSSL_AUTO_LOAD_CONFIG)"=="yes" 112!UNDEF ENABLE_OPENSSL_AUTO_LOAD_CONFIG 113ENABLE_OPENSSL_AUTO_LOAD_CONFIG = true 114!ELSEIF "$(ENABLE_OPENSSL_AUTO_LOAD_CONFIG)"=="no" 115!UNDEF ENABLE_OPENSSL_AUTO_LOAD_CONFIG 116ENABLE_OPENSSL_AUTO_LOAD_CONFIG = false 117!ENDIF 118 119!IFNDEF ENABLE_UNICODE 120USE_UNICODE = false 121!ELSEIF "$(ENABLE_UNICODE)"=="yes" 122USE_UNICODE = true 123!ELSEIF "$(ENABLE_UNICODE)"=="no" 124USE_UNICODE = false 125!ENDIF 126 127CONFIG_NAME_LIB = libcurl 128 129!IF "$(WITH_SSL)"=="dll" 130USE_SSL = true 131SSL = dll 132!ELSEIF "$(WITH_SSL)"=="static" 133USE_SSL = true 134SSL = static 135!ENDIF 136 137!IF "$(ENABLE_NGHTTP2)"=="yes" 138# compatibility bit, WITH_NGHTTP2 is the correct flag 139WITH_NGHTTP2 = dll 140USE_NGHTTP2 = true 141NGHTTP2 = dll 142!ELSEIF "$(WITH_NGHTTP2)"=="dll" 143USE_NGHTTP2 = true 144NGHTTP2 = dll 145!ELSEIF "$(WITH_NGHTTP2)"=="static" 146USE_NGHTTP2 = true 147NGHTTP2 = static 148!ENDIF 149 150!IFNDEF USE_NGHTTP2 151USE_NGHTTP2 = false 152!ENDIF 153 154!IF "$(ENABLE_MSH3)"=="yes" 155# compatibility bit, WITH_MSH3 is the correct flag 156WITH_MSH3 = dll 157USE_MSH3 = true 158MSH3 = dll 159!ELSEIF "$(WITH_MSH3)"=="dll" 160USE_MSH3 = true 161MSH3 = dll 162!ELSEIF "$(WITH_MSH3)"=="static" 163USE_MSH3 = true 164MSH3 = static 165!ENDIF 166 167!IFNDEF USE_MSH3 168USE_MSH3 = false 169!ENDIF 170 171!IF "$(WITH_MBEDTLS)"=="dll" || "$(WITH_MBEDTLS)"=="static" 172USE_MBEDTLS = true 173MBEDTLS = $(WITH_MBEDTLS) 174!ENDIF 175 176!IF "$(WITH_WOLFSSL)"=="dll" || "$(WITH_WOLFSSL)"=="static" 177USE_WOLFSSL = true 178WOLFSSL = $(WITH_WOLFSSL) 179!ENDIF 180 181!IF "$(WITH_CARES)"=="dll" 182USE_CARES = true 183CARES = dll 184!ELSEIF "$(WITH_CARES)"=="static" 185USE_CARES = true 186CARES = static 187!ENDIF 188 189!IF "$(WITH_ZLIB)"=="dll" 190USE_ZLIB = true 191ZLIB = dll 192!ELSEIF "$(WITH_ZLIB)"=="static" 193USE_ZLIB = true 194ZLIB = static 195!ENDIF 196 197!IF "$(WITH_SSH2)"=="dll" 198USE_SSH2 = true 199SSH2 = dll 200!ELSEIF "$(WITH_SSH2)"=="static" 201USE_SSH2 = true 202SSH2 = static 203!ENDIF 204 205!IF "$(WITH_SSH)"=="dll" 206USE_SSH = true 207SSH = dll 208!ELSEIF "$(WITH_SSH)"=="static" 209USE_SSH = true 210SSH = static 211!ENDIF 212 213CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-vc$(VC)-$(MACHINE) 214 215!IF "$(DEBUG)"=="yes" 216CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-debug 217!ELSE 218CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-release 219!ENDIF 220 221!IF "$(AS_DLL)"=="true" 222CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-dll 223!ELSE 224CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-static 225!ENDIF 226 227!IF "$(USE_SSL)"=="true" 228CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-ssl-$(SSL) 229!ENDIF 230 231!IF "$(USE_MBEDTLS)"=="true" 232CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-mbedtls-$(MBEDTLS) 233!ENDIF 234 235!IF "$(USE_WOLFSSL)"=="true" 236CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-wolfssl-$(WOLFSSL) 237!ENDIF 238 239!IF "$(USE_CARES)"=="true" 240CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-cares-$(CARES) 241!ENDIF 242 243!IF "$(USE_ZLIB)"=="true" 244CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-zlib-$(ZLIB) 245!ENDIF 246 247!IF "$(USE_SSH2)"=="true" 248CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-ssh2-$(SSH2) 249!ENDIF 250 251!IF "$(USE_SSH)"=="true" 252CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-ssh-$(SSH) 253!ENDIF 254 255!IF "$(USE_IPV6)"=="true" 256CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-ipv6 257!ENDIF 258 259!IF "$(USE_SSPI)"=="true" 260CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-sspi 261!ENDIF 262 263!IF "$(USE_SCHANNEL)"=="true" 264CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-schannel 265!ENDIF 266 267!IF "$(USE_NGHTTP2)"=="true" 268CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-nghttp2-$(NGHTTP2) 269!ENDIF 270 271!IF "$(USE_MSH3)"=="true" 272CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-msh3 273!ENDIF 274 275!MESSAGE configuration name: $(CONFIG_NAME_LIB) 276 277# Note these directories are removed by this makefile's 'clean' so they should 278# not be changed to point to user-specified directories that may contain other 279# data. MakefileBuild.vc uses the same variable names but allows some user 280# changes and therefore does not remove the directories. 281BUILD_DIR=../builds/$(CONFIG_NAME_LIB) 282LIBCURL_DIROBJ = ..\builds\$(CONFIG_NAME_LIB)-obj-lib 283CURL_DIROBJ = ..\builds\$(CONFIG_NAME_LIB)-obj-curl 284DIRDIST = ..\builds\$(CONFIG_NAME_LIB)\ 285 286$(MODE): 287 @echo LIBCURL_OBJS = \> LIBCURL_OBJS.inc 288 @for %%i in ($(LIBCURL_OBJS)) do @echo $(LIBCURL_DIROBJ)/%%i \>> LIBCURL_OBJS.inc 289 @echo. >> LIBCURL_OBJS.inc 290 291 @echo CURL_OBJS = \> CURL_OBJS.inc 292 @for %%i in ($(CURL_OBJS)) do @echo $(CURL_DIROBJ)/%%i \>> CURL_OBJS.inc 293 @echo. >> CURL_OBJS.inc 294 295 @SET CONFIG_NAME_LIB=$(CONFIG_NAME_LIB) 296 @SET MACHINE=$(MACHINE) 297 @SET USE_NGHTTP2=$(USE_NGHTTP2) 298 @SET USE_MSH3=$(USE_MSH3) 299 @SET USE_IDN=$(USE_IDN) 300 @SET USE_IPV6=$(USE_IPV6) 301 @SET USE_SSPI=$(USE_SSPI) 302 @SET USE_SCHANNEL=$(USE_SCHANNEL) 303 @SET USE_UNICODE=$(USE_UNICODE) 304# compatibility bit 305 @SET WITH_NGHTTP2=$(WITH_NGHTTP2) 306 307 @$(MAKE) /NOLOGO /F MakefileBuild.vc 308 309copy_from_lib: 310 echo copying .c... 311 FOR %%i IN ($(CURLX_CFILES:/=\)) DO copy %%i ..\src\ 312 313clean: 314 @if exist $(LIBCURL_DIROBJ) rd /s /q $(LIBCURL_DIROBJ) 315 @if exist $(CURL_DIROBJ) rd /s /q $(CURL_DIROBJ) 316 @if exist $(DIRDIST) rd /s /q $(DIRDIST) 317 $(MAKE) /NOLOGO /F MakefileBuild.vc $@ 318