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_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_CARES)"=="dll" 177USE_CARES = true 178CARES = dll 179!ELSEIF "$(WITH_CARES)"=="static" 180USE_CARES = true 181CARES = static 182!ENDIF 183 184!IF "$(WITH_ZLIB)"=="dll" 185USE_ZLIB = true 186ZLIB = dll 187!ELSEIF "$(WITH_ZLIB)"=="static" 188USE_ZLIB = true 189ZLIB = static 190!ENDIF 191 192!IF "$(WITH_SSH2)"=="dll" 193USE_SSH2 = true 194SSH2 = dll 195!ELSEIF "$(WITH_SSH2)"=="static" 196USE_SSH2 = true 197SSH2 = static 198!ENDIF 199 200!IF "$(WITH_SSH)"=="dll" 201USE_SSH = true 202SSH = dll 203!ELSEIF "$(WITH_SSH)"=="static" 204USE_SSH = true 205SSH = static 206!ENDIF 207 208CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-vc$(VC)-$(MACHINE) 209 210!IF "$(DEBUG)"=="yes" 211CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-debug 212!ELSE 213CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-release 214!ENDIF 215 216!IF "$(AS_DLL)"=="true" 217CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-dll 218!ELSE 219CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-static 220!ENDIF 221 222!IF "$(USE_SSL)"=="true" 223CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-ssl-$(SSL) 224!ENDIF 225 226!IF "$(USE_MBEDTLS)"=="true" 227CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-mbedtls-$(MBEDTLS) 228!ENDIF 229 230!IF "$(USE_CARES)"=="true" 231CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-cares-$(CARES) 232!ENDIF 233 234!IF "$(USE_ZLIB)"=="true" 235CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-zlib-$(ZLIB) 236!ENDIF 237 238!IF "$(USE_SSH2)"=="true" 239CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-ssh2-$(SSH2) 240!ENDIF 241 242!IF "$(USE_SSH)"=="true" 243CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-ssh-$(SSH) 244!ENDIF 245 246!IF "$(USE_IPV6)"=="true" 247CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-ipv6 248!ENDIF 249 250!IF "$(USE_SSPI)"=="true" 251CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-sspi 252!ENDIF 253 254!IF "$(USE_SCHANNEL)"=="true" 255CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-schannel 256!ENDIF 257 258!IF "$(USE_NGHTTP2)"=="true" 259CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-nghttp2-$(NGHTTP2) 260!ENDIF 261 262!IF "$(USE_MSH3)"=="true" 263CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-msh3 264!ENDIF 265 266!MESSAGE configuration name: $(CONFIG_NAME_LIB) 267 268# Note these directories are removed by this makefile's 'clean' so they should 269# not be changed to point to user-specified directories that may contain other 270# data. MakefileBuild.vc uses the same variable names but allows some user 271# changes and therefore does not remove the directories. 272BUILD_DIR=../builds/$(CONFIG_NAME_LIB) 273LIBCURL_DIROBJ = ..\builds\$(CONFIG_NAME_LIB)-obj-lib 274CURL_DIROBJ = ..\builds\$(CONFIG_NAME_LIB)-obj-curl 275DIRDIST = ..\builds\$(CONFIG_NAME_LIB)\ 276 277$(MODE): 278 @SET DIROBJ=$(LIBCURL_DIROBJ) 279 @SET MACRO_NAME=LIBCURL_OBJS 280 @SET OUTFILE=LIBCURL_OBJS.inc 281 @CALL gen_resp_file.bat $(LIBCURL_OBJS) 282 283 @SET DIROBJ=$(CURL_DIROBJ) 284 @SET MACRO_NAME=CURL_OBJS 285 @SET OUTFILE=CURL_OBJS.inc 286 @CALL gen_resp_file.bat $(CURL_OBJS) 287 288 @SET CONFIG_NAME_LIB=$(CONFIG_NAME_LIB) 289 @SET MACHINE=$(MACHINE) 290 @SET USE_NGHTTP2=$(USE_NGHTTP2) 291 @SET USE_MSH3=$(USE_MSH3) 292 @SET USE_IDN=$(USE_IDN) 293 @SET USE_IPV6=$(USE_IPV6) 294 @SET USE_SSPI=$(USE_SSPI) 295 @SET USE_SCHANNEL=$(USE_SCHANNEL) 296 @SET USE_UNICODE=$(USE_UNICODE) 297# compatibility bit 298 @SET WITH_NGHTTP2=$(WITH_NGHTTP2) 299 300 @$(MAKE) /NOLOGO /F MakefileBuild.vc 301 302copy_from_lib: 303 echo copying .c... 304 FOR %%i IN ($(CURLX_CFILES:/=\)) DO copy %%i ..\src\ 305 306clean: 307 @if exist $(LIBCURL_DIROBJ) rd /s /q $(LIBCURL_DIROBJ) 308 @if exist $(CURL_DIROBJ) rd /s /q $(CURL_DIROBJ) 309 @if exist $(DIRDIST) rd /s /q $(DIRDIST) 310 $(MAKE) /NOLOGO /F MakefileBuild.vc $@ 311