2
0

Makefile.vc 7.1 KB

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