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) 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_WEBSOCKETS 120ENABLE_WEBSOCKETS = false 121!ELSEIF "$(ENABLE_WEBSOCKETS)"=="yes" 122!UNDEF ENABLE_WEBSOCKETS 123ENABLE_WEBSOCKETS = true 124!ELSEIF "$(ENABLE_WEBSOCKETS)"=="no" 125!UNDEF ENABLE_WEBSOCKETS 126ENABLE_WEBSOCKETS = false 127!ENDIF 128 129!IFNDEF ENABLE_UNICODE 130USE_UNICODE = false 131!ELSEIF "$(ENABLE_UNICODE)"=="yes" 132USE_UNICODE = true 133!ELSEIF "$(ENABLE_UNICODE)"=="no" 134USE_UNICODE = false 135!ENDIF 136 137CONFIG_NAME_LIB = libcurl 138 139!IF "$(WITH_SSL)"=="dll" 140USE_SSL = true 141SSL = dll 142!ELSEIF "$(WITH_SSL)"=="static" 143USE_SSL = true 144SSL = static 145!ENDIF 146 147!IF "$(ENABLE_NGHTTP2)"=="yes" 148# compatibility bit, WITH_NGHTTP2 is the correct flag 149WITH_NGHTTP2 = dll 150USE_NGHTTP2 = true 151NGHTTP2 = dll 152!ELSEIF "$(WITH_NGHTTP2)"=="dll" 153USE_NGHTTP2 = true 154NGHTTP2 = dll 155!ELSEIF "$(WITH_NGHTTP2)"=="static" 156USE_NGHTTP2 = true 157NGHTTP2 = static 158!ENDIF 159 160!IFNDEF USE_NGHTTP2 161USE_NGHTTP2 = false 162!ENDIF 163 164!IF "$(ENABLE_MSH3)"=="yes" 165# compatibility bit, WITH_MSH3 is the correct flag 166WITH_MSH3 = dll 167USE_MSH3 = true 168MSH3 = dll 169!ELSEIF "$(WITH_MSH3)"=="dll" 170USE_MSH3 = true 171MSH3 = dll 172!ELSEIF "$(WITH_MSH3)"=="static" 173USE_MSH3 = true 174MSH3 = static 175!ENDIF 176 177!IFNDEF USE_MSH3 178USE_MSH3 = false 179!ENDIF 180 181!IF "$(WITH_MBEDTLS)"=="dll" || "$(WITH_MBEDTLS)"=="static" 182USE_MBEDTLS = true 183MBEDTLS = $(WITH_MBEDTLS) 184!ENDIF 185 186!IF "$(WITH_CARES)"=="dll" 187USE_CARES = true 188CARES = dll 189!ELSEIF "$(WITH_CARES)"=="static" 190USE_CARES = true 191CARES = static 192!ENDIF 193 194!IF "$(WITH_ZLIB)"=="dll" 195USE_ZLIB = true 196ZLIB = dll 197!ELSEIF "$(WITH_ZLIB)"=="static" 198USE_ZLIB = true 199ZLIB = static 200!ENDIF 201 202!IF "$(WITH_SSH2)"=="dll" 203USE_SSH2 = true 204SSH2 = dll 205!ELSEIF "$(WITH_SSH2)"=="static" 206USE_SSH2 = true 207SSH2 = static 208!ENDIF 209 210!IF "$(WITH_SSH)"=="dll" 211USE_SSH = true 212SSH = dll 213!ELSEIF "$(WITH_SSH)"=="static" 214USE_SSH = true 215SSH = static 216!ENDIF 217 218CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-vc$(VC)-$(MACHINE) 219 220!IF "$(DEBUG)"=="yes" 221CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-debug 222!ELSE 223CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-release 224!ENDIF 225 226!IF "$(AS_DLL)"=="true" 227CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-dll 228!ELSE 229CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-static 230!ENDIF 231 232!IF "$(USE_SSL)"=="true" 233CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-ssl-$(SSL) 234!ENDIF 235 236!IF "$(USE_MBEDTLS)"=="true" 237CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-mbedtls-$(MBEDTLS) 238!ENDIF 239 240!IF "$(USE_CARES)"=="true" 241CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-cares-$(CARES) 242!ENDIF 243 244!IF "$(USE_ZLIB)"=="true" 245CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-zlib-$(ZLIB) 246!ENDIF 247 248!IF "$(USE_SSH2)"=="true" 249CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-ssh2-$(SSH2) 250!ENDIF 251 252!IF "$(USE_SSH)"=="true" 253CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-ssh-$(SSH) 254!ENDIF 255 256!IF "$(USE_IPV6)"=="true" 257CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-ipv6 258!ENDIF 259 260!IF "$(USE_SSPI)"=="true" 261CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-sspi 262!ENDIF 263 264!IF "$(USE_SCHANNEL)"=="true" 265CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-schannel 266!ENDIF 267 268!IF "$(USE_NGHTTP2)"=="true" 269CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-nghttp2-$(NGHTTP2) 270!ENDIF 271 272!IF "$(USE_MSH3)"=="true" 273CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-msh3 274!ENDIF 275 276!MESSAGE configuration name: $(CONFIG_NAME_LIB) 277 278# Note these directories are removed by this makefile's 'clean' so they should 279# not be changed to point to user-specified directories that may contain other 280# data. MakefileBuild.vc uses the same variable names but allows some user 281# changes and therefore does not remove the directories. 282BUILD_DIR=../builds/$(CONFIG_NAME_LIB) 283LIBCURL_DIROBJ = ..\builds\$(CONFIG_NAME_LIB)-obj-lib 284CURL_DIROBJ = ..\builds\$(CONFIG_NAME_LIB)-obj-curl 285DIRDIST = ..\builds\$(CONFIG_NAME_LIB)\ 286 287$(MODE): 288 @SET DIROBJ=$(LIBCURL_DIROBJ) 289 @SET MACRO_NAME=LIBCURL_OBJS 290 @SET OUTFILE=LIBCURL_OBJS.inc 291 @CALL gen_resp_file.bat $(LIBCURL_OBJS) 292 293 @SET DIROBJ=$(CURL_DIROBJ) 294 @SET MACRO_NAME=CURL_OBJS 295 @SET OUTFILE=CURL_OBJS.inc 296 @CALL gen_resp_file.bat $(CURL_OBJS) 297 298 @SET CONFIG_NAME_LIB=$(CONFIG_NAME_LIB) 299 @SET MACHINE=$(MACHINE) 300 @SET USE_NGHTTP2=$(USE_NGHTTP2) 301 @SET USE_MSH3=$(USE_MSH3) 302 @SET USE_IDN=$(USE_IDN) 303 @SET USE_IPV6=$(USE_IPV6) 304 @SET USE_SSPI=$(USE_SSPI) 305 @SET USE_SCHANNEL=$(USE_SCHANNEL) 306 @SET USE_UNICODE=$(USE_UNICODE) 307# compatibility bit 308 @SET WITH_NGHTTP2=$(WITH_NGHTTP2) 309 310 @$(MAKE) /NOLOGO /F MakefileBuild.vc 311 312copy_from_lib: 313 echo copying .c... 314 FOR %%i IN ($(CURLX_CFILES:/=\)) DO copy %%i ..\src\ 315 316clean: 317 @if exist $(LIBCURL_DIROBJ) rd /s /q $(LIBCURL_DIROBJ) 318 @if exist $(CURL_DIROBJ) rd /s /q $(CURL_DIROBJ) 319 @if exist $(DIRDIST) rd /s /q $(DIRDIST) 320 $(MAKE) /NOLOGO /F MakefileBuild.vc $@ 321