113498266Sopenharmony_ci#***************************************************************************
213498266Sopenharmony_ci#                                  _   _ ____  _
313498266Sopenharmony_ci#  Project                     ___| | | |  _ \| |
413498266Sopenharmony_ci#                             / __| | | | |_) | |
513498266Sopenharmony_ci#                            | (__| |_| |  _ <| |___
613498266Sopenharmony_ci#                             \___|\___/|_| \_\_____|
713498266Sopenharmony_ci#
813498266Sopenharmony_ci# Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
913498266Sopenharmony_ci#
1013498266Sopenharmony_ci# This software is licensed as described in the file COPYING, which
1113498266Sopenharmony_ci# you should have received as part of this distribution. The terms
1213498266Sopenharmony_ci# are also available at https://curl.se/docs/copyright.html.
1313498266Sopenharmony_ci#
1413498266Sopenharmony_ci# You may opt to use, copy, modify, merge, publish, distribute and/or sell
1513498266Sopenharmony_ci# copies of the Software, and permit persons to whom the Software is
1613498266Sopenharmony_ci# furnished to do so, under the terms of the COPYING file.
1713498266Sopenharmony_ci#
1813498266Sopenharmony_ci# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
1913498266Sopenharmony_ci# KIND, either express or implied.
2013498266Sopenharmony_ci#
2113498266Sopenharmony_ci# SPDX-License-Identifier: curl
2213498266Sopenharmony_ci#
2313498266Sopenharmony_ci#***************************************************************************
2413498266Sopenharmony_ci
2513498266Sopenharmony_ci!IF "$(MODE)"=="static"
2613498266Sopenharmony_ciTARGET = $(LIB_NAME_STATIC)
2713498266Sopenharmony_ciAS_DLL = false
2813498266Sopenharmony_ciCFGSET=true
2913498266Sopenharmony_ci!ELSEIF "$(MODE)"=="dll"
3013498266Sopenharmony_ciTARGET = $(LIB_NAME_DLL)
3113498266Sopenharmony_ciAS_DLL = true
3213498266Sopenharmony_ciCFGSET=true
3313498266Sopenharmony_ci!ELSE
3413498266Sopenharmony_ci!MESSAGE Invalid mode: $(MODE)
3513498266Sopenharmony_ci
3613498266Sopenharmony_ci#######################
3713498266Sopenharmony_ci# Usage
3813498266Sopenharmony_ci#
3913498266Sopenharmony_ci
4013498266Sopenharmony_ci!MESSAGE See winbuild/README.md for usage
4113498266Sopenharmony_ci!ERROR please choose a valid mode
4213498266Sopenharmony_ci
4313498266Sopenharmony_ci!ENDIF
4413498266Sopenharmony_ci
4513498266Sopenharmony_ci!INCLUDE "../lib/Makefile.inc"
4613498266Sopenharmony_ciLIBCURL_OBJS=$(CSOURCES:.c=.obj)
4713498266Sopenharmony_ci
4813498266Sopenharmony_ci!INCLUDE "../src/Makefile.inc"
4913498266Sopenharmony_ci
5013498266Sopenharmony_ci# tool_hugehelp has a special rule
5113498266Sopenharmony_ciCURL_OBJS=$(CURL_CFILES:tool_hugehelp.c=)
5213498266Sopenharmony_ci
5313498266Sopenharmony_ciCURL_OBJS=$(CURL_OBJS:.c=.obj)
5413498266Sopenharmony_ci
5513498266Sopenharmony_ci
5613498266Sopenharmony_ci# backwards compatible check for USE_SSPI
5713498266Sopenharmony_ci!IFDEF USE_SSPI
5813498266Sopenharmony_ciENABLE_SSPI = $(USE_SSPI)
5913498266Sopenharmony_ci!ENDIF
6013498266Sopenharmony_ci
6113498266Sopenharmony_ci# default options
6213498266Sopenharmony_ci
6313498266Sopenharmony_ci!IFNDEF MACHINE
6413498266Sopenharmony_ci# Note: nmake magically changes the value of PROCESSOR_ARCHITECTURE from "AMD64"
6513498266Sopenharmony_ci# to "x86" when building in a 32 bit build environment on a 64 bit machine.
6613498266Sopenharmony_ci!IF "$(PROCESSOR_ARCHITECTURE)"=="AMD64"
6713498266Sopenharmony_ciMACHINE = x64
6813498266Sopenharmony_ci!ELSE
6913498266Sopenharmony_ciMACHINE = x86
7013498266Sopenharmony_ci!ENDIF
7113498266Sopenharmony_ci!ENDIF
7213498266Sopenharmony_ci
7313498266Sopenharmony_ci!IFNDEF ENABLE_IDN
7413498266Sopenharmony_ciUSE_IDN = true
7513498266Sopenharmony_ci!ELSEIF "$(ENABLE_IDN)"=="yes"
7613498266Sopenharmony_ciUSE_IDN = true
7713498266Sopenharmony_ci!ELSEIF "$(ENABLE_IDN)"=="no"
7813498266Sopenharmony_ciUSE_IDN = false
7913498266Sopenharmony_ci!ENDIF
8013498266Sopenharmony_ci
8113498266Sopenharmony_ci!IFNDEF ENABLE_IPV6
8213498266Sopenharmony_ciUSE_IPV6 = true
8313498266Sopenharmony_ci!ELSEIF "$(ENABLE_IPV6)"=="yes"
8413498266Sopenharmony_ciUSE_IPV6 = true
8513498266Sopenharmony_ci!ELSEIF "$(ENABLE_IPV6)"=="no"
8613498266Sopenharmony_ciUSE_IPV6 = false
8713498266Sopenharmony_ci!ENDIF
8813498266Sopenharmony_ci
8913498266Sopenharmony_ci!IFNDEF ENABLE_SSPI
9013498266Sopenharmony_ciUSE_SSPI = true
9113498266Sopenharmony_ci!ELSEIF "$(ENABLE_SSPI)"=="yes"
9213498266Sopenharmony_ciUSE_SSPI = true
9313498266Sopenharmony_ci!ELSEIF "$(ENABLE_SSPI)"=="no"
9413498266Sopenharmony_ciUSE_SSPI = false
9513498266Sopenharmony_ci!ENDIF
9613498266Sopenharmony_ci
9713498266Sopenharmony_ci!IFNDEF ENABLE_SCHANNEL
9813498266Sopenharmony_ci!IF DEFINED(WITH_SSL) || DEFINED(WITH_MBEDTLS)
9913498266Sopenharmony_ciUSE_SCHANNEL = false
10013498266Sopenharmony_ci!ELSE
10113498266Sopenharmony_ciUSE_SCHANNEL = $(USE_SSPI)
10213498266Sopenharmony_ci!ENDIF
10313498266Sopenharmony_ci!ELSEIF "$(ENABLE_SCHANNEL)"=="yes"
10413498266Sopenharmony_ciUSE_SCHANNEL = true
10513498266Sopenharmony_ci!ELSEIF "$(ENABLE_SCHANNEL)"=="no"
10613498266Sopenharmony_ciUSE_SCHANNEL = false
10713498266Sopenharmony_ci!ENDIF
10813498266Sopenharmony_ci
10913498266Sopenharmony_ci!IFNDEF ENABLE_OPENSSL_AUTO_LOAD_CONFIG
11013498266Sopenharmony_ciENABLE_OPENSSL_AUTO_LOAD_CONFIG = true
11113498266Sopenharmony_ci!ELSEIF "$(ENABLE_OPENSSL_AUTO_LOAD_CONFIG)"=="yes"
11213498266Sopenharmony_ci!UNDEF ENABLE_OPENSSL_AUTO_LOAD_CONFIG
11313498266Sopenharmony_ciENABLE_OPENSSL_AUTO_LOAD_CONFIG = true
11413498266Sopenharmony_ci!ELSEIF "$(ENABLE_OPENSSL_AUTO_LOAD_CONFIG)"=="no"
11513498266Sopenharmony_ci!UNDEF ENABLE_OPENSSL_AUTO_LOAD_CONFIG
11613498266Sopenharmony_ciENABLE_OPENSSL_AUTO_LOAD_CONFIG = false
11713498266Sopenharmony_ci!ENDIF
11813498266Sopenharmony_ci
11913498266Sopenharmony_ci!IFNDEF ENABLE_UNICODE
12013498266Sopenharmony_ciUSE_UNICODE = false
12113498266Sopenharmony_ci!ELSEIF "$(ENABLE_UNICODE)"=="yes"
12213498266Sopenharmony_ciUSE_UNICODE = true
12313498266Sopenharmony_ci!ELSEIF "$(ENABLE_UNICODE)"=="no"
12413498266Sopenharmony_ciUSE_UNICODE = false
12513498266Sopenharmony_ci!ENDIF
12613498266Sopenharmony_ci
12713498266Sopenharmony_ciCONFIG_NAME_LIB = libcurl
12813498266Sopenharmony_ci
12913498266Sopenharmony_ci!IF "$(WITH_SSL)"=="dll"
13013498266Sopenharmony_ciUSE_SSL = true
13113498266Sopenharmony_ciSSL     = dll
13213498266Sopenharmony_ci!ELSEIF "$(WITH_SSL)"=="static"
13313498266Sopenharmony_ciUSE_SSL = true
13413498266Sopenharmony_ciSSL     = static
13513498266Sopenharmony_ci!ENDIF
13613498266Sopenharmony_ci
13713498266Sopenharmony_ci!IF "$(ENABLE_NGHTTP2)"=="yes"
13813498266Sopenharmony_ci# compatibility bit, WITH_NGHTTP2 is the correct flag
13913498266Sopenharmony_ciWITH_NGHTTP2 = dll
14013498266Sopenharmony_ciUSE_NGHTTP2  = true
14113498266Sopenharmony_ciNGHTTP2      = dll
14213498266Sopenharmony_ci!ELSEIF "$(WITH_NGHTTP2)"=="dll"
14313498266Sopenharmony_ciUSE_NGHTTP2 = true
14413498266Sopenharmony_ciNGHTTP2     = dll
14513498266Sopenharmony_ci!ELSEIF "$(WITH_NGHTTP2)"=="static"
14613498266Sopenharmony_ciUSE_NGHTTP2 = true
14713498266Sopenharmony_ciNGHTTP2     = static
14813498266Sopenharmony_ci!ENDIF
14913498266Sopenharmony_ci
15013498266Sopenharmony_ci!IFNDEF USE_NGHTTP2
15113498266Sopenharmony_ciUSE_NGHTTP2 = false
15213498266Sopenharmony_ci!ENDIF
15313498266Sopenharmony_ci
15413498266Sopenharmony_ci!IF "$(ENABLE_MSH3)"=="yes"
15513498266Sopenharmony_ci# compatibility bit, WITH_MSH3 is the correct flag
15613498266Sopenharmony_ciWITH_MSH3    = dll
15713498266Sopenharmony_ciUSE_MSH3     = true
15813498266Sopenharmony_ciMSH3         = dll
15913498266Sopenharmony_ci!ELSEIF "$(WITH_MSH3)"=="dll"
16013498266Sopenharmony_ciUSE_MSH3     = true
16113498266Sopenharmony_ciMSH3         = dll
16213498266Sopenharmony_ci!ELSEIF "$(WITH_MSH3)"=="static"
16313498266Sopenharmony_ciUSE_MSH3     = true
16413498266Sopenharmony_ciMSH3         = static
16513498266Sopenharmony_ci!ENDIF
16613498266Sopenharmony_ci
16713498266Sopenharmony_ci!IFNDEF USE_MSH3
16813498266Sopenharmony_ciUSE_MSH3 = false
16913498266Sopenharmony_ci!ENDIF
17013498266Sopenharmony_ci
17113498266Sopenharmony_ci!IF "$(WITH_MBEDTLS)"=="dll" || "$(WITH_MBEDTLS)"=="static"
17213498266Sopenharmony_ciUSE_MBEDTLS = true
17313498266Sopenharmony_ciMBEDTLS     = $(WITH_MBEDTLS)
17413498266Sopenharmony_ci!ENDIF
17513498266Sopenharmony_ci
17613498266Sopenharmony_ci!IF "$(WITH_CARES)"=="dll"
17713498266Sopenharmony_ciUSE_CARES = true
17813498266Sopenharmony_ciCARES     = dll
17913498266Sopenharmony_ci!ELSEIF "$(WITH_CARES)"=="static"
18013498266Sopenharmony_ciUSE_CARES = true
18113498266Sopenharmony_ciCARES     = static
18213498266Sopenharmony_ci!ENDIF
18313498266Sopenharmony_ci
18413498266Sopenharmony_ci!IF "$(WITH_ZLIB)"=="dll"
18513498266Sopenharmony_ciUSE_ZLIB = true
18613498266Sopenharmony_ciZLIB     = dll
18713498266Sopenharmony_ci!ELSEIF "$(WITH_ZLIB)"=="static"
18813498266Sopenharmony_ciUSE_ZLIB = true
18913498266Sopenharmony_ciZLIB     = static
19013498266Sopenharmony_ci!ENDIF
19113498266Sopenharmony_ci
19213498266Sopenharmony_ci!IF "$(WITH_SSH2)"=="dll"
19313498266Sopenharmony_ciUSE_SSH2 = true
19413498266Sopenharmony_ciSSH2     = dll
19513498266Sopenharmony_ci!ELSEIF "$(WITH_SSH2)"=="static"
19613498266Sopenharmony_ciUSE_SSH2 = true
19713498266Sopenharmony_ciSSH2     = static
19813498266Sopenharmony_ci!ENDIF
19913498266Sopenharmony_ci
20013498266Sopenharmony_ci!IF "$(WITH_SSH)"=="dll"
20113498266Sopenharmony_ciUSE_SSH = true
20213498266Sopenharmony_ciSSH     = dll
20313498266Sopenharmony_ci!ELSEIF "$(WITH_SSH)"=="static"
20413498266Sopenharmony_ciUSE_SSH = true
20513498266Sopenharmony_ciSSH     = static
20613498266Sopenharmony_ci!ENDIF
20713498266Sopenharmony_ci
20813498266Sopenharmony_ciCONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-vc$(VC)-$(MACHINE)
20913498266Sopenharmony_ci
21013498266Sopenharmony_ci!IF "$(DEBUG)"=="yes"
21113498266Sopenharmony_ciCONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-debug
21213498266Sopenharmony_ci!ELSE
21313498266Sopenharmony_ciCONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-release
21413498266Sopenharmony_ci!ENDIF
21513498266Sopenharmony_ci
21613498266Sopenharmony_ci!IF "$(AS_DLL)"=="true"
21713498266Sopenharmony_ciCONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-dll
21813498266Sopenharmony_ci!ELSE
21913498266Sopenharmony_ciCONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-static
22013498266Sopenharmony_ci!ENDIF
22113498266Sopenharmony_ci
22213498266Sopenharmony_ci!IF "$(USE_SSL)"=="true"
22313498266Sopenharmony_ciCONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-ssl-$(SSL)
22413498266Sopenharmony_ci!ENDIF
22513498266Sopenharmony_ci
22613498266Sopenharmony_ci!IF "$(USE_MBEDTLS)"=="true"
22713498266Sopenharmony_ciCONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-mbedtls-$(MBEDTLS)
22813498266Sopenharmony_ci!ENDIF
22913498266Sopenharmony_ci
23013498266Sopenharmony_ci!IF "$(USE_CARES)"=="true"
23113498266Sopenharmony_ciCONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-cares-$(CARES)
23213498266Sopenharmony_ci!ENDIF
23313498266Sopenharmony_ci
23413498266Sopenharmony_ci!IF "$(USE_ZLIB)"=="true"
23513498266Sopenharmony_ciCONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-zlib-$(ZLIB)
23613498266Sopenharmony_ci!ENDIF
23713498266Sopenharmony_ci
23813498266Sopenharmony_ci!IF "$(USE_SSH2)"=="true"
23913498266Sopenharmony_ciCONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-ssh2-$(SSH2)
24013498266Sopenharmony_ci!ENDIF
24113498266Sopenharmony_ci
24213498266Sopenharmony_ci!IF "$(USE_SSH)"=="true"
24313498266Sopenharmony_ciCONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-ssh-$(SSH)
24413498266Sopenharmony_ci!ENDIF
24513498266Sopenharmony_ci
24613498266Sopenharmony_ci!IF "$(USE_IPV6)"=="true"
24713498266Sopenharmony_ciCONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-ipv6
24813498266Sopenharmony_ci!ENDIF
24913498266Sopenharmony_ci
25013498266Sopenharmony_ci!IF "$(USE_SSPI)"=="true"
25113498266Sopenharmony_ciCONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-sspi
25213498266Sopenharmony_ci!ENDIF
25313498266Sopenharmony_ci
25413498266Sopenharmony_ci!IF "$(USE_SCHANNEL)"=="true"
25513498266Sopenharmony_ciCONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-schannel
25613498266Sopenharmony_ci!ENDIF
25713498266Sopenharmony_ci
25813498266Sopenharmony_ci!IF "$(USE_NGHTTP2)"=="true"
25913498266Sopenharmony_ciCONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-nghttp2-$(NGHTTP2)
26013498266Sopenharmony_ci!ENDIF
26113498266Sopenharmony_ci
26213498266Sopenharmony_ci!IF "$(USE_MSH3)"=="true"
26313498266Sopenharmony_ciCONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-msh3
26413498266Sopenharmony_ci!ENDIF
26513498266Sopenharmony_ci
26613498266Sopenharmony_ci!MESSAGE configuration name: $(CONFIG_NAME_LIB)
26713498266Sopenharmony_ci
26813498266Sopenharmony_ci# Note these directories are removed by this makefile's 'clean' so they should
26913498266Sopenharmony_ci# not be changed to point to user-specified directories that may contain other
27013498266Sopenharmony_ci# data. MakefileBuild.vc uses the same variable names but allows some user
27113498266Sopenharmony_ci# changes and therefore does not remove the directories.
27213498266Sopenharmony_ciBUILD_DIR=../builds/$(CONFIG_NAME_LIB)
27313498266Sopenharmony_ciLIBCURL_DIROBJ = ..\builds\$(CONFIG_NAME_LIB)-obj-lib
27413498266Sopenharmony_ciCURL_DIROBJ = ..\builds\$(CONFIG_NAME_LIB)-obj-curl
27513498266Sopenharmony_ciDIRDIST = ..\builds\$(CONFIG_NAME_LIB)\
27613498266Sopenharmony_ci
27713498266Sopenharmony_ci$(MODE):
27813498266Sopenharmony_ci	@SET DIROBJ=$(LIBCURL_DIROBJ)
27913498266Sopenharmony_ci	@SET MACRO_NAME=LIBCURL_OBJS
28013498266Sopenharmony_ci	@SET OUTFILE=LIBCURL_OBJS.inc
28113498266Sopenharmony_ci	@CALL gen_resp_file.bat $(LIBCURL_OBJS)
28213498266Sopenharmony_ci
28313498266Sopenharmony_ci	@SET DIROBJ=$(CURL_DIROBJ)
28413498266Sopenharmony_ci	@SET MACRO_NAME=CURL_OBJS
28513498266Sopenharmony_ci	@SET OUTFILE=CURL_OBJS.inc
28613498266Sopenharmony_ci	@CALL gen_resp_file.bat $(CURL_OBJS)
28713498266Sopenharmony_ci
28813498266Sopenharmony_ci	@SET CONFIG_NAME_LIB=$(CONFIG_NAME_LIB)
28913498266Sopenharmony_ci	@SET MACHINE=$(MACHINE)
29013498266Sopenharmony_ci	@SET USE_NGHTTP2=$(USE_NGHTTP2)
29113498266Sopenharmony_ci	@SET USE_MSH3=$(USE_MSH3)
29213498266Sopenharmony_ci	@SET USE_IDN=$(USE_IDN)
29313498266Sopenharmony_ci	@SET USE_IPV6=$(USE_IPV6)
29413498266Sopenharmony_ci	@SET USE_SSPI=$(USE_SSPI)
29513498266Sopenharmony_ci	@SET USE_SCHANNEL=$(USE_SCHANNEL)
29613498266Sopenharmony_ci	@SET USE_UNICODE=$(USE_UNICODE)
29713498266Sopenharmony_ci# compatibility bit
29813498266Sopenharmony_ci	@SET WITH_NGHTTP2=$(WITH_NGHTTP2)
29913498266Sopenharmony_ci
30013498266Sopenharmony_ci	@$(MAKE) /NOLOGO /F MakefileBuild.vc
30113498266Sopenharmony_ci
30213498266Sopenharmony_cicopy_from_lib:
30313498266Sopenharmony_ci	echo copying .c...
30413498266Sopenharmony_ci	FOR %%i IN ($(CURLX_CFILES:/=\)) DO copy %%i ..\src\
30513498266Sopenharmony_ci
30613498266Sopenharmony_ciclean:
30713498266Sopenharmony_ci	@if exist $(LIBCURL_DIROBJ) rd /s /q $(LIBCURL_DIROBJ)
30813498266Sopenharmony_ci	@if exist $(CURL_DIROBJ) rd /s /q $(CURL_DIROBJ)
30913498266Sopenharmony_ci	@if exist $(DIRDIST) rd /s /q $(DIRDIST)
31013498266Sopenharmony_ci	$(MAKE) /NOLOGO /F MakefileBuild.vc $@
311