Makefile.vc 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290
  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 GEN_PDB=<yes or no> - Generate Program Database (debug symbols for release build)
  60. !MESSAGE DEBUG=<yes or no> - Debug builds
  61. !MESSAGE MACHINE=<x86 or x64> - Target architecture (default x64 on AMD64, x86 on others)
  62. !MESSAGE CARES_PATH=<path to cares> - Custom path for c-ares
  63. !MESSAGE MBEDTLS_PATH=<path to mbedTLS> - Custom path for mbedTLS
  64. !MESSAGE NGHTTP2_PATH=<path to HTTP/2> - Custom path for nghttp2
  65. !MESSAGE SSH2_PATH=<path to libSSH2> - Custom path for libSSH2
  66. !MESSAGE SSL_PATH=<path to OpenSSL> - Custom path for OpenSSL
  67. !MESSAGE ZLIB_PATH=<path to zlib> - Custom path for zlib
  68. !ERROR please choose a valid mode
  69. !ENDIF
  70. !INCLUDE "../lib/Makefile.inc"
  71. LIBCURL_OBJS=$(CSOURCES:.c=.obj)
  72. !INCLUDE "../src/Makefile.inc"
  73. # tool_hugehelp has a special rule
  74. CURL_OBJS=$(CURL_CFILES:tool_hugehelp.c=)
  75. CURL_OBJS=$(CURL_OBJS:.c=.obj)
  76. # backwards compatible check for USE_SSPI
  77. !IFDEF USE_SSPI
  78. ENABLE_SSPI = $(USE_SSPI)
  79. !ENDIF
  80. # default options
  81. !IFNDEF MACHINE
  82. # Note: nmake magically changes the value of PROCESSOR_ARCHITECTURE from "AMD64"
  83. # to "x86" when building in a 32 bit build environment on a 64 bit machine.
  84. !IF "$(PROCESSOR_ARCHITECTURE)"=="AMD64"
  85. MACHINE = x64
  86. !ELSE
  87. MACHINE = x86
  88. !ENDIF
  89. !ENDIF
  90. !IFNDEF ENABLE_IDN
  91. USE_IDN = true
  92. !ELSEIF "$(ENABLE_IDN)"=="yes"
  93. USE_IDN = true
  94. !ELSEIF "$(ENABLE_IDN)"=="no"
  95. USE_IDN = false
  96. !ENDIF
  97. !IFNDEF ENABLE_IPV6
  98. USE_IPV6 = true
  99. !ELSEIF "$(ENABLE_IPV6)"=="yes"
  100. USE_IPV6 = true
  101. !ELSEIF "$(ENABLE_IPV6)"=="no"
  102. USE_IPV6 = false
  103. !ENDIF
  104. !IFNDEF ENABLE_SSPI
  105. USE_SSPI = true
  106. !ELSEIF "$(ENABLE_SSPI)"=="yes"
  107. USE_SSPI = true
  108. !ELSEIF "$(ENABLE_SSPI)"=="no"
  109. USE_SSPI = false
  110. !ENDIF
  111. !IFNDEF ENABLE_WINSSL
  112. !IF DEFINED(WITH_SSL) || DEFINED(WITH_MBEDTLS)
  113. USE_WINSSL = false
  114. !ELSE
  115. USE_WINSSL = $(USE_SSPI)
  116. !ENDIF
  117. !ELSEIF "$(ENABLE_WINSSL)"=="yes"
  118. USE_WINSSL = true
  119. !ELSEIF "$(ENABLE_WINSSL)"=="no"
  120. USE_WINSSL = false
  121. !ENDIF
  122. !IFNDEF ENABLE_OPENSSL_AUTO_LOAD_CONFIG
  123. ENABLE_OPENSSL_AUTO_LOAD_CONFIG = true
  124. !ELSEIF "$(ENABLE_OPENSSL_AUTO_LOAD_CONFIG)"=="yes"
  125. !UNDEF ENABLE_OPENSSL_AUTO_LOAD_CONFIG
  126. ENABLE_OPENSSL_AUTO_LOAD_CONFIG = true
  127. !ELSEIF "$(ENABLE_OPENSSL_AUTO_LOAD_CONFIG)"=="no"
  128. !UNDEF ENABLE_OPENSSL_AUTO_LOAD_CONFIG
  129. ENABLE_OPENSSL_AUTO_LOAD_CONFIG = false
  130. !ENDIF
  131. CONFIG_NAME_LIB = libcurl
  132. !IF "$(WITH_SSL)"=="dll"
  133. USE_SSL = true
  134. SSL = dll
  135. !ELSEIF "$(WITH_SSL)"=="static"
  136. USE_SSL = true
  137. SSL = static
  138. !ENDIF
  139. !IF "$(ENABLE_NGHTTP2)"=="yes"
  140. # compatibility bit, WITH_NGHTTP2 is the correct flag
  141. WITH_NGHTTP2 = dll
  142. USE_NGHTTP2 = true
  143. NGHTTP2 = dll
  144. !ELSEIF "$(WITH_NGHTTP2)"=="dll"
  145. USE_NGHTTP2 = true
  146. NGHTTP2 = dll
  147. !ELSEIF "$(WITH_NGHTTP2)"=="static"
  148. USE_NGHTTP2 = true
  149. NGHTTP2 = static
  150. !ENDIF
  151. !IFNDEF USE_NGHTTP2
  152. USE_NGHTTP2 = false
  153. !ENDIF
  154. !IF "$(WITH_MBEDTLS)"=="dll" || "$(WITH_MBEDTLS)"=="static"
  155. USE_MBEDTLS = true
  156. MBEDTLS = $(WITH_MBEDTLS)
  157. !ENDIF
  158. !IF "$(WITH_CARES)"=="dll"
  159. USE_CARES = true
  160. CARES = dll
  161. !ELSEIF "$(WITH_CARES)"=="static"
  162. USE_CARES = true
  163. CARES = static
  164. !ENDIF
  165. !IF "$(WITH_ZLIB)"=="dll"
  166. USE_ZLIB = true
  167. ZLIB = dll
  168. !ELSEIF "$(WITH_ZLIB)"=="static"
  169. USE_ZLIB = true
  170. ZLIB = static
  171. !ENDIF
  172. !IF "$(WITH_SSH2)"=="dll"
  173. USE_SSH2 = true
  174. SSH2 = dll
  175. !ELSEIF "$(WITH_SSH2)"=="static"
  176. USE_SSH2 = true
  177. SSH2 = static
  178. !ENDIF
  179. CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-vc$(VC)-$(MACHINE)
  180. !IF "$(DEBUG)"=="yes"
  181. CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-debug
  182. !ELSE
  183. CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-release
  184. !ENDIF
  185. !IF "$(AS_DLL)"=="true"
  186. CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-dll
  187. !ELSE
  188. CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-static
  189. !ENDIF
  190. !IF "$(USE_SSL)"=="true"
  191. CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-ssl-$(SSL)
  192. !ENDIF
  193. !IF "$(USE_MBEDTLS)"=="true"
  194. CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-mbedtls-$(MBEDTLS)
  195. !ENDIF
  196. !IF "$(USE_CARES)"=="true"
  197. CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-cares-$(CARES)
  198. !ENDIF
  199. !IF "$(USE_ZLIB)"=="true"
  200. CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-zlib-$(ZLIB)
  201. !ENDIF
  202. !IF "$(USE_SSH2)"=="true"
  203. CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-ssh2-$(SSH2)
  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_WINSSL)"=="true"
  212. CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-winssl
  213. !ENDIF
  214. !IF "$(USE_NGHTTP2)"=="true"
  215. CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-nghttp2-$(NGHTTP2)
  216. !ENDIF
  217. !MESSAGE configuration name: $(CONFIG_NAME_LIB)
  218. BUILD_DIR=../builds/$(CONFIG_NAME_LIB)
  219. LIBCURL_DIROBJ = ..\builds\$(CONFIG_NAME_LIB)-obj-lib
  220. CURL_DIROBJ = ..\builds\$(CONFIG_NAME_LIB)-obj-curl
  221. DIRDIST = ..\builds\$(CONFIG_NAME_LIB)\
  222. $(MODE):
  223. @SET DIROBJ=$(LIBCURL_DIROBJ)
  224. @SET MACRO_NAME=LIBCURL_OBJS
  225. @SET OUTFILE=LIBCURL_OBJS.inc
  226. @CALL gen_resp_file.bat $(LIBCURL_OBJS)
  227. @SET DIROBJ=$(CURL_DIROBJ)
  228. @SET MACRO_NAME=CURL_OBJS
  229. @SET OUTFILE=CURL_OBJS.inc
  230. @CALL gen_resp_file.bat $(CURL_OBJS)
  231. @SET CONFIG_NAME_LIB=$(CONFIG_NAME_LIB)
  232. @SET MACHINE=$(MACHINE)
  233. @SET USE_NGHTTP2=$(USE_NGHTTP2)
  234. @SET USE_IDN=$(USE_IDN)
  235. @SET USE_IPV6=$(USE_IPV6)
  236. @SET USE_SSPI=$(USE_SSPI)
  237. @SET USE_WINSSL=$(USE_WINSSL)
  238. # compatibility bit
  239. @SET WITH_NGHTTP2=$(WITH_NGHTTP2)
  240. @$(MAKE) /NOLOGO /F MakefileBuild.vc
  241. copy_from_lib:
  242. echo copying .c...
  243. FOR %%i IN ($(CURLX_CFILES:/=\)) DO copy %%i ..\src\
  244. clean:
  245. $(MAKE) /NOLOGO /F MakefileBuild.vc $@