Makefile.vc 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300
  1. #***************************************************************************
  2. # _ _ ____ _
  3. # Project ___| | | | _ \| |
  4. # / __| | | | |_) | |
  5. # | (__| |_| | _ <| |___
  6. # \___|\___/|_| \_\_____|
  7. #
  8. # Copyright (C) 1999 - 2019, 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.haxx.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 Usage: nmake /f Makefile.vc mode=<static or dll> <options>
  36. !MESSAGE where <options> is one or many of:
  37. !MESSAGE VC=<6,7,8,9,10,11,12,14,15> - VC versions
  38. !MESSAGE WITH_DEVEL=<path> - Paths for the development files (SSL, zlib, etc.)
  39. !MESSAGE Defaults to curl's sibling directory deps: ../deps
  40. !MESSAGE Libraries can be fetched at https://windows.php.net/downloads/php-sdk/deps/
  41. !MESSAGE Uncompress them into the deps folder.
  42. !MESSAGE WITH_PREFIX=<path> - Installation directory path
  43. !MESSAGE Defaults to a configuration dependent (SSL, zlib, etc.)
  44. !MESSAGE directory inside curl's subdirectory builds: ./builds
  45. !MESSAGE Use backslashes as path separator
  46. !MESSAGE WITH_SSL=<dll or static> - Enable OpenSSL support, DLL or static
  47. !MESSAGE WITH_NGHTTP2=<dll or static> - Enable HTTP/2 support, DLL or static
  48. !MESSAGE WITH_CARES=<dll or static> - Enable c-ares support, DLL or static
  49. !MESSAGE WITH_ZLIB=<dll or static> - Enable zlib support, DLL or static
  50. !MESSAGE WITH_SSH2=<dll or static> - Enable libSSH2 support, DLL or static
  51. !MESSAGE WITH_MBEDTLS=<dll or static> - Enable mbedTLS support, DLL or static
  52. !MESSAGE ENABLE_IDN=<yes or no> - Enable use of Windows IDN APIs, defaults to yes
  53. !MESSAGE Requires Windows Vista or later
  54. !MESSAGE ENABLE_IPV6=<yes or no> - Enable IPv6, defaults to yes
  55. !MESSAGE ENABLE_SSPI=<yes or no> - Enable SSPI support, defaults to yes
  56. !MESSAGE ENABLE_WINSSL=<yes or no> - Enable native Windows SSL support, defaults to yes
  57. !MESSAGE ENABLE_OPENSSL_AUTO_LOAD_CONFIG=<yes or no>
  58. !MESSAGE - Whether the OpenSSL configuration will be loaded automatically, defaults to yes
  59. !MESSAGE ENABLE_UNICODE=<yes or no> - Enable UNICODE support, defaults to no
  60. !MESSAGE GEN_PDB=<yes or no> - Generate Program Database (debug symbols for release build)
  61. !MESSAGE DEBUG=<yes or no> - Debug builds
  62. !MESSAGE MACHINE=<x86 or x64> - Target architecture (default x64 on AMD64, x86 on others)
  63. !MESSAGE CARES_PATH=<path to cares> - Custom path for c-ares
  64. !MESSAGE MBEDTLS_PATH=<path to mbedTLS> - Custom path for mbedTLS
  65. !MESSAGE NGHTTP2_PATH=<path to HTTP/2> - Custom path for nghttp2
  66. !MESSAGE SSH2_PATH=<path to libSSH2> - Custom path for libSSH2
  67. !MESSAGE SSL_PATH=<path to OpenSSL> - Custom path for OpenSSL
  68. !MESSAGE ZLIB_PATH=<path to zlib> - Custom path for zlib
  69. !ERROR please choose a valid mode
  70. !ENDIF
  71. !INCLUDE "../lib/Makefile.inc"
  72. LIBCURL_OBJS=$(CSOURCES:.c=.obj)
  73. !INCLUDE "../src/Makefile.inc"
  74. # tool_hugehelp has a special rule
  75. CURL_OBJS=$(CURL_CFILES:tool_hugehelp.c=)
  76. CURL_OBJS=$(CURL_OBJS:.c=.obj)
  77. # backwards compatible check for USE_SSPI
  78. !IFDEF USE_SSPI
  79. ENABLE_SSPI = $(USE_SSPI)
  80. !ENDIF
  81. # default options
  82. !IFNDEF MACHINE
  83. # Note: nmake magically changes the value of PROCESSOR_ARCHITECTURE from "AMD64"
  84. # to "x86" when building in a 32 bit build environment on a 64 bit machine.
  85. !IF "$(PROCESSOR_ARCHITECTURE)"=="AMD64"
  86. MACHINE = x64
  87. !ELSE
  88. MACHINE = x86
  89. !ENDIF
  90. !ENDIF
  91. !IFNDEF ENABLE_IDN
  92. USE_IDN = true
  93. !ELSEIF "$(ENABLE_IDN)"=="yes"
  94. USE_IDN = true
  95. !ELSEIF "$(ENABLE_IDN)"=="no"
  96. USE_IDN = false
  97. !ENDIF
  98. !IFNDEF ENABLE_IPV6
  99. USE_IPV6 = true
  100. !ELSEIF "$(ENABLE_IPV6)"=="yes"
  101. USE_IPV6 = true
  102. !ELSEIF "$(ENABLE_IPV6)"=="no"
  103. USE_IPV6 = false
  104. !ENDIF
  105. !IFNDEF ENABLE_SSPI
  106. USE_SSPI = true
  107. !ELSEIF "$(ENABLE_SSPI)"=="yes"
  108. USE_SSPI = true
  109. !ELSEIF "$(ENABLE_SSPI)"=="no"
  110. USE_SSPI = false
  111. !ENDIF
  112. !IFNDEF ENABLE_WINSSL
  113. !IF DEFINED(WITH_SSL) || DEFINED(WITH_MBEDTLS)
  114. USE_WINSSL = false
  115. !ELSE
  116. USE_WINSSL = $(USE_SSPI)
  117. !ENDIF
  118. !ELSEIF "$(ENABLE_WINSSL)"=="yes"
  119. USE_WINSSL = true
  120. !ELSEIF "$(ENABLE_WINSSL)"=="no"
  121. USE_WINSSL = false
  122. !ENDIF
  123. !IFNDEF ENABLE_OPENSSL_AUTO_LOAD_CONFIG
  124. ENABLE_OPENSSL_AUTO_LOAD_CONFIG = true
  125. !ELSEIF "$(ENABLE_OPENSSL_AUTO_LOAD_CONFIG)"=="yes"
  126. !UNDEF ENABLE_OPENSSL_AUTO_LOAD_CONFIG
  127. ENABLE_OPENSSL_AUTO_LOAD_CONFIG = true
  128. !ELSEIF "$(ENABLE_OPENSSL_AUTO_LOAD_CONFIG)"=="no"
  129. !UNDEF ENABLE_OPENSSL_AUTO_LOAD_CONFIG
  130. ENABLE_OPENSSL_AUTO_LOAD_CONFIG = false
  131. !ENDIF
  132. !IFNDEF ENABLE_UNICODE
  133. USE_UNICODE = false
  134. !ELSEIF "$(ENABLE_UNICODE)"=="yes"
  135. USE_UNICODE = true
  136. !ELSEIF "$(ENABLE_UNICODE)"=="no"
  137. USE_UNICODE = false
  138. !ENDIF
  139. CONFIG_NAME_LIB = libcurl
  140. !IF "$(WITH_SSL)"=="dll"
  141. USE_SSL = true
  142. SSL = dll
  143. !ELSEIF "$(WITH_SSL)"=="static"
  144. USE_SSL = true
  145. SSL = static
  146. !ENDIF
  147. !IF "$(ENABLE_NGHTTP2)"=="yes"
  148. # compatibility bit, WITH_NGHTTP2 is the correct flag
  149. WITH_NGHTTP2 = dll
  150. USE_NGHTTP2 = true
  151. NGHTTP2 = dll
  152. !ELSEIF "$(WITH_NGHTTP2)"=="dll"
  153. USE_NGHTTP2 = true
  154. NGHTTP2 = dll
  155. !ELSEIF "$(WITH_NGHTTP2)"=="static"
  156. USE_NGHTTP2 = true
  157. NGHTTP2 = static
  158. !ENDIF
  159. !IFNDEF USE_NGHTTP2
  160. USE_NGHTTP2 = false
  161. !ENDIF
  162. !IF "$(WITH_MBEDTLS)"=="dll" || "$(WITH_MBEDTLS)"=="static"
  163. USE_MBEDTLS = true
  164. MBEDTLS = $(WITH_MBEDTLS)
  165. !ENDIF
  166. !IF "$(WITH_CARES)"=="dll"
  167. USE_CARES = true
  168. CARES = dll
  169. !ELSEIF "$(WITH_CARES)"=="static"
  170. USE_CARES = true
  171. CARES = static
  172. !ENDIF
  173. !IF "$(WITH_ZLIB)"=="dll"
  174. USE_ZLIB = true
  175. ZLIB = dll
  176. !ELSEIF "$(WITH_ZLIB)"=="static"
  177. USE_ZLIB = true
  178. ZLIB = static
  179. !ENDIF
  180. !IF "$(WITH_SSH2)"=="dll"
  181. USE_SSH2 = true
  182. SSH2 = dll
  183. !ELSEIF "$(WITH_SSH2)"=="static"
  184. USE_SSH2 = true
  185. SSH2 = 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_IPV6)"=="true"
  214. CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-ipv6
  215. !ENDIF
  216. !IF "$(USE_SSPI)"=="true"
  217. CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-sspi
  218. !ENDIF
  219. !IF "$(USE_WINSSL)"=="true"
  220. CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-winssl
  221. !ENDIF
  222. !IF "$(USE_NGHTTP2)"=="true"
  223. CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-nghttp2-$(NGHTTP2)
  224. !ENDIF
  225. !MESSAGE configuration name: $(CONFIG_NAME_LIB)
  226. BUILD_DIR=../builds/$(CONFIG_NAME_LIB)
  227. LIBCURL_DIROBJ = ..\builds\$(CONFIG_NAME_LIB)-obj-lib
  228. CURL_DIROBJ = ..\builds\$(CONFIG_NAME_LIB)-obj-curl
  229. DIRDIST = ..\builds\$(CONFIG_NAME_LIB)\
  230. $(MODE):
  231. @SET DIROBJ=$(LIBCURL_DIROBJ)
  232. @SET MACRO_NAME=LIBCURL_OBJS
  233. @SET OUTFILE=LIBCURL_OBJS.inc
  234. @CALL gen_resp_file.bat $(LIBCURL_OBJS)
  235. @SET DIROBJ=$(CURL_DIROBJ)
  236. @SET MACRO_NAME=CURL_OBJS
  237. @SET OUTFILE=CURL_OBJS.inc
  238. @CALL gen_resp_file.bat $(CURL_OBJS)
  239. @SET CONFIG_NAME_LIB=$(CONFIG_NAME_LIB)
  240. @SET MACHINE=$(MACHINE)
  241. @SET USE_NGHTTP2=$(USE_NGHTTP2)
  242. @SET USE_IDN=$(USE_IDN)
  243. @SET USE_IPV6=$(USE_IPV6)
  244. @SET USE_SSPI=$(USE_SSPI)
  245. @SET USE_WINSSL=$(USE_WINSSL)
  246. @SET USE_UNICODE=$(USE_UNICODE)
  247. # compatibility bit
  248. @SET WITH_NGHTTP2=$(WITH_NGHTTP2)
  249. @$(MAKE) /NOLOGO /F MakefileBuild.vc
  250. copy_from_lib:
  251. echo copying .c...
  252. FOR %%i IN ($(CURLX_CFILES:/=\)) DO copy %%i ..\src\
  253. clean:
  254. $(MAKE) /NOLOGO /F MakefileBuild.vc $@