Makefile.vc 6.6 KB

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