2
0

Makefile.vc 7.3 KB

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