Makefile.vc 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317
  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) || DEFINED(WITH_WOLFSSL)
  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_WOLFSSL)"=="dll" || "$(WITH_WOLFSSL)"=="static"
  151. USE_WOLFSSL = true
  152. WOLFSSL = $(WITH_WOLFSSL)
  153. !ENDIF
  154. !IF "$(WITH_CARES)"=="dll"
  155. USE_CARES = true
  156. CARES = dll
  157. !ELSEIF "$(WITH_CARES)"=="static"
  158. USE_CARES = true
  159. CARES = static
  160. !ENDIF
  161. !IF "$(WITH_ZLIB)"=="dll"
  162. USE_ZLIB = true
  163. ZLIB = dll
  164. !ELSEIF "$(WITH_ZLIB)"=="static"
  165. USE_ZLIB = true
  166. ZLIB = static
  167. !ENDIF
  168. !IF "$(WITH_SSH2)"=="dll"
  169. USE_SSH2 = true
  170. SSH2 = dll
  171. !ELSEIF "$(WITH_SSH2)"=="static"
  172. USE_SSH2 = true
  173. SSH2 = static
  174. !ENDIF
  175. !IF "$(WITH_SSH)"=="dll"
  176. USE_SSH = true
  177. SSH = dll
  178. !ELSEIF "$(WITH_SSH)"=="static"
  179. USE_SSH = true
  180. SSH = static
  181. !ENDIF
  182. CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-vc$(VC)-$(MACHINE)
  183. !IF "$(DEBUG)"=="yes"
  184. CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-debug
  185. !ELSE
  186. CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-release
  187. !ENDIF
  188. !IF "$(AS_DLL)"=="true"
  189. CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-dll
  190. !ELSE
  191. CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-static
  192. !ENDIF
  193. !IF "$(USE_SSL)"=="true"
  194. CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-ssl-$(SSL)
  195. !ENDIF
  196. !IF "$(USE_MBEDTLS)"=="true"
  197. CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-mbedtls-$(MBEDTLS)
  198. !ENDIF
  199. !IF "$(USE_WOLFSSL)"=="true"
  200. CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-wolfssl-$(WOLFSSL)
  201. !ENDIF
  202. !IF "$(USE_CARES)"=="true"
  203. CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-cares-$(CARES)
  204. !ENDIF
  205. !IF "$(USE_ZLIB)"=="true"
  206. CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-zlib-$(ZLIB)
  207. !ENDIF
  208. !IF "$(USE_SSH2)"=="true"
  209. CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-ssh2-$(SSH2)
  210. !ENDIF
  211. !IF "$(USE_SSH)"=="true"
  212. CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-ssh-$(SSH)
  213. !ENDIF
  214. !IF "$(USE_IPV6)"=="true"
  215. CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-ipv6
  216. !ENDIF
  217. !IF "$(USE_SSPI)"=="true"
  218. CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-sspi
  219. !ENDIF
  220. !IF "$(USE_SCHANNEL)"=="true"
  221. CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-schannel
  222. !ENDIF
  223. !IF "$(USE_NGHTTP2)"=="true"
  224. CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-nghttp2-$(NGHTTP2)
  225. !ENDIF
  226. !IF "$(USE_MSH3)"=="true"
  227. CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-msh3
  228. !ENDIF
  229. !MESSAGE configuration name: $(CONFIG_NAME_LIB)
  230. # Note these directories are removed by this makefile's 'clean' so they should
  231. # not be changed to point to user-specified directories that may contain other
  232. # data. MakefileBuild.vc uses the same variable names but allows some user
  233. # changes and therefore does not remove the directories.
  234. BUILD_DIR=../builds/$(CONFIG_NAME_LIB)
  235. LIBCURL_DIROBJ = ..\builds\$(CONFIG_NAME_LIB)-obj-lib
  236. CURL_DIROBJ = ..\builds\$(CONFIG_NAME_LIB)-obj-curl
  237. DIRDIST = ..\builds\$(CONFIG_NAME_LIB)\
  238. $(MODE):
  239. @echo LIBCURL_OBJS = \> LIBCURL_OBJS.inc
  240. @for %%i in ($(LIBCURL_OBJS)) do @echo $(LIBCURL_DIROBJ)/%%i \>> LIBCURL_OBJS.inc
  241. @echo. >> LIBCURL_OBJS.inc
  242. @echo CURL_OBJS = \> CURL_OBJS.inc
  243. @for %%i in ($(CURL_OBJS)) do @echo $(CURL_DIROBJ)/%%i \>> CURL_OBJS.inc
  244. @echo. >> CURL_OBJS.inc
  245. @SET CONFIG_NAME_LIB=$(CONFIG_NAME_LIB)
  246. @SET MACHINE=$(MACHINE)
  247. @SET USE_NGHTTP2=$(USE_NGHTTP2)
  248. @SET USE_MSH3=$(USE_MSH3)
  249. @SET USE_IDN=$(USE_IDN)
  250. @SET USE_IPV6=$(USE_IPV6)
  251. @SET USE_SSPI=$(USE_SSPI)
  252. @SET USE_SCHANNEL=$(USE_SCHANNEL)
  253. @SET USE_UNICODE=$(USE_UNICODE)
  254. # compatibility bit
  255. @SET WITH_NGHTTP2=$(WITH_NGHTTP2)
  256. @$(MAKE) /NOLOGO /F MakefileBuild.vc
  257. copy_from_lib:
  258. echo copying .c...
  259. FOR %%i IN ($(CURLX_CFILES:/=\)) DO copy %%i ..\src\
  260. clean:
  261. @if exist $(LIBCURL_DIROBJ) rd /s /q $(LIBCURL_DIROBJ)
  262. @if exist $(CURL_DIROBJ) rd /s /q $(CURL_DIROBJ)
  263. @if exist $(DIRDIST) rd /s /q $(DIRDIST)
  264. $(MAKE) /NOLOGO /F MakefileBuild.vc $@