Makefile.vc 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273
  1. #***************************************************************************
  2. # _ _ ____ _
  3. # Project ___| | | | _ \| |
  4. # / __| | | | |_) | |
  5. # | (__| |_| | _ <| |___
  6. # \___|\___/|_| \_\_____|
  7. #
  8. # Copyright (C) 1999 - 2017, Daniel Stenberg, <[email protected]>, 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 sibbling directory deps: ../deps
  40. !MESSAGE Libraries can be fetched at http://pecl2.php.net/downloads/php-windows-builds/
  41. !MESSAGE Uncompress them into the deps folder.
  42. !MESSAGE WITH_SSL=<dll or static> - Enable OpenSSL support, DLL or static
  43. !MESSAGE WITH_NGHTTP2=<dll or static> - Enable HTTP/2 support, DLL or static
  44. !MESSAGE WITH_CARES=<dll or static> - Enable c-ares support, DLL or static
  45. !MESSAGE WITH_ZLIB=<dll or static> - Enable zlib support, DLL or static
  46. !MESSAGE WITH_SSH2=<dll or static> - Enable libSSH2 support, DLL or static
  47. !MESSAGE WITH_MBEDTLS=<dll or static> - Enable mbedTLS support, DLL or static
  48. !MESSAGE ENABLE_IDN=<yes or no> - Enable use of Windows IDN APIs, defaults to yes
  49. !MESSAGE Requires Windows Vista or later, or installation from:
  50. !MESSAGE https://www.microsoft.com/en-us/download/details.aspx?id=734
  51. !MESSAGE ENABLE_IPV6=<yes or no> - Enable IPv6, defaults to yes
  52. !MESSAGE ENABLE_SSPI=<yes or no> - Enable SSPI support, defaults to yes
  53. !MESSAGE ENABLE_WINSSL=<yes or no> - Enable native Windows SSL support, defaults to yes
  54. !MESSAGE GEN_PDB=<yes or no> - Generate Program Database (debug symbols for release build)
  55. !MESSAGE DEBUG=<yes or no> - Debug builds
  56. !MESSAGE MACHINE=<x86 or x64> - Target architecture (default x64 on AMD64, x86 on others)
  57. !ERROR please choose a valid mode
  58. !ENDIF
  59. !INCLUDE "../lib/Makefile.inc"
  60. LIBCURL_OBJS=$(CSOURCES:.c=.obj)
  61. !INCLUDE "../src/Makefile.inc"
  62. # tool_hugehelp has a special rule
  63. CURL_OBJS=$(CURL_CFILES:tool_hugehelp.c=)
  64. CURL_OBJS=$(CURL_OBJS:.c=.obj)
  65. # backwards compatible check for USE_SSPI
  66. !IFDEF USE_SSPI
  67. ENABLE_SSPI = $(USE_SSPI)
  68. !ENDIF
  69. # default options
  70. !IFNDEF MACHINE
  71. # Note: nmake magically changes the value of PROCESSOR_ARCHITECTURE from "AMD64"
  72. # to "x86" when building in a 32 bit build environment on a 64 bit machine.
  73. !IF "$(PROCESSOR_ARCHITECTURE)"=="AMD64"
  74. MACHINE = x64
  75. !ELSE
  76. MACHINE = x86
  77. !ENDIF
  78. !ENDIF
  79. !IFNDEF ENABLE_IDN
  80. USE_IDN = true
  81. !ELSEIF "$(ENABLE_IDN)"=="yes"
  82. USE_IDN = true
  83. !ELSEIF "$(ENABLE_IDN)"=="no"
  84. USE_IDN = false
  85. !ENDIF
  86. !IFNDEF ENABLE_IPV6
  87. USE_IPV6 = true
  88. !ELSEIF "$(ENABLE_IPV6)"=="yes"
  89. USE_IPV6 = true
  90. !ELSEIF "$(ENABLE_IPV6)"=="no"
  91. USE_IPV6 = false
  92. !ENDIF
  93. !IFNDEF ENABLE_SSPI
  94. USE_SSPI = true
  95. !ELSEIF "$(ENABLE_SSPI)"=="yes"
  96. USE_SSPI = true
  97. !ELSEIF "$(ENABLE_SSPI)"=="no"
  98. USE_SSPI = false
  99. !ENDIF
  100. !IFNDEF ENABLE_WINSSL
  101. !IF DEFINED(WITH_SSL) || DEFINED(WITH_MBEDTLS)
  102. USE_WINSSL = false
  103. !ELSE
  104. USE_WINSSL = $(USE_SSPI)
  105. !ENDIF
  106. !ELSEIF "$(ENABLE_WINSSL)"=="yes"
  107. USE_WINSSL = true
  108. !ELSEIF "$(ENABLE_WINSSL)"=="no"
  109. USE_WINSSL = false
  110. !ENDIF
  111. CONFIG_NAME_LIB = libcurl
  112. !IF "$(WITH_SSL)"=="dll"
  113. USE_SSL = true
  114. SSL = dll
  115. !ELSEIF "$(WITH_SSL)"=="static"
  116. USE_SSL = true
  117. SSL = static
  118. !ENDIF
  119. !IF "$(ENABLE_NGHTTP2)"=="yes"
  120. # compatibility bit, WITH_NGHTTP2 is the correct flag
  121. WITH_NGHTTP2 = dll
  122. USE_NGHTTP2 = true
  123. NGHTTP2 = dll
  124. !ELSEIF "$(WITH_NGHTTP2)"=="dll"
  125. USE_NGHTTP2 = true
  126. NGHTTP2 = dll
  127. !ELSEIF "$(WITH_NGHTTP2)"=="static"
  128. USE_NGHTTP2 = true
  129. NGHTTP2 = static
  130. !ENDIF
  131. !IFNDEF USE_NGHTTP2
  132. USE_NGHTTP2 = false
  133. !ENDIF
  134. !IF "$(WITH_MBEDTLS)"=="dll" || "$(WITH_MBEDTLS)"=="static"
  135. USE_MBEDTLS = true
  136. MBEDTLS = $(WITH_MBEDTLS)
  137. !ENDIF
  138. !IF ( "$(USE_SSL)"=="true" && "$(USE_WINSSL)"=="true" ) \
  139. || ( "$(USE_SSL)"=="true" && "$(USE_MBEDTLS)"=="true" ) \
  140. || ( "$(USE_MBEDTLS)"=="true" && "$(USE_WINSSL)"=="true" )
  141. !ERROR SSL, MBEDTLS and WINSSL are mutual exclusive options.
  142. !ENDIF
  143. !IF "$(WITH_CARES)"=="dll"
  144. USE_CARES = true
  145. CARES = dll
  146. !ELSEIF "$(WITH_CARES)"=="static"
  147. USE_CARES = true
  148. CARES = static
  149. !ENDIF
  150. !IF "$(WITH_ZLIB)"=="dll"
  151. USE_ZLIB = true
  152. ZLIB = dll
  153. !ELSEIF "$(WITH_ZLIB)"=="static"
  154. USE_ZLIB = true
  155. ZLIB = static
  156. !ENDIF
  157. !IF "$(WITH_SSH2)"=="dll"
  158. USE_SSH2 = true
  159. SSH2 = dll
  160. !ELSEIF "$(WITH_SSH2)"=="static"
  161. USE_SSH2 = true
  162. SSH2 = static
  163. !ENDIF
  164. CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-vc$(VC)-$(MACHINE)
  165. !IF "$(DEBUG)"=="yes"
  166. CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-debug
  167. !ELSE
  168. CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-release
  169. !ENDIF
  170. !IF "$(AS_DLL)"=="true"
  171. CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-dll
  172. !ELSE
  173. CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-static
  174. !ENDIF
  175. !IF "$(USE_SSL)"=="true"
  176. CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-ssl-$(SSL)
  177. !ENDIF
  178. !IF "$(USE_MBEDTLS)"=="true"
  179. CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-mbedtls-$(MBEDTLS)
  180. !ENDIF
  181. !IF "$(USE_CARES)"=="true"
  182. CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-cares-$(CARES)
  183. !ENDIF
  184. !IF "$(USE_ZLIB)"=="true"
  185. CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-zlib-$(ZLIB)
  186. !ENDIF
  187. !IF "$(USE_SSH2)"=="true"
  188. CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-ssh2-$(SSH2)
  189. !ENDIF
  190. !IF "$(USE_IPV6)"=="true"
  191. CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-ipv6
  192. !ENDIF
  193. !IF "$(USE_SSPI)"=="true"
  194. CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-sspi
  195. !ENDIF
  196. !IF "$(USE_WINSSL)"=="true"
  197. CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-winssl
  198. !ENDIF
  199. !IF "$(USE_NGHTTP2)"=="true"
  200. CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-nghttp2-$(NGHTTP2)
  201. !ENDIF
  202. !MESSAGE configuration name: $(CONFIG_NAME_LIB)
  203. BUILD_DIR=../builds/$(CONFIG_NAME_LIB)
  204. LIBCURL_DIROBJ = ..\builds\$(CONFIG_NAME_LIB)-obj-lib
  205. CURL_DIROBJ = ..\builds\$(CONFIG_NAME_LIB)-obj-curl
  206. DIRDIST = ..\builds\$(CONFIG_NAME_LIB)\
  207. $(MODE):
  208. @SET DIROBJ=$(LIBCURL_DIROBJ)
  209. @SET MACRO_NAME=LIBCURL_OBJS
  210. @SET OUTFILE=LIBCURL_OBJS.inc
  211. @gen_resp_file.bat $(LIBCURL_OBJS)
  212. @SET DIROBJ=$(CURL_DIROBJ)
  213. @SET MACRO_NAME=CURL_OBJS
  214. @SET OUTFILE=CURL_OBJS.inc
  215. @gen_resp_file.bat $(CURL_OBJS)
  216. @SET CONFIG_NAME_LIB=$(CONFIG_NAME_LIB)
  217. @SET MACHINE=$(MACHINE)
  218. @SET USE_NGHTTP2=$(USE_NGHTTP2)
  219. @SET USE_IDN=$(USE_IDN)
  220. @SET USE_IPV6=$(USE_IPV6)
  221. @SET USE_SSPI=$(USE_SSPI)
  222. @SET USE_WINSSL=$(USE_WINSSL)
  223. @SET RTLIBCFG=static
  224. # compatibility bit
  225. @SET WITH_NGHTTP2=$(WITH_NGHTTP2)
  226. @$(MAKE) /NOLOGO /F MakefileBuild.vc
  227. copy_from_lib:
  228. echo copying .c...
  229. FOR %%i IN ($(CURLX_CFILES:/=\)) DO copy %%i ..\src\