Makefile.vc 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280
  1. #***************************************************************************
  2. # _ _ ____ _
  3. # Project ___| | | | _ \| |
  4. # / __| | | | |_) | |
  5. # | (__| |_| | _ <| |___
  6. # \___|\___/|_| \_\_____|
  7. #
  8. # Copyright (C) 1999 - 2017, 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 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
  50. !MESSAGE ENABLE_IPV6=<yes or no> - Enable IPv6, defaults to yes
  51. !MESSAGE ENABLE_SSPI=<yes or no> - Enable SSPI support, defaults to yes
  52. !MESSAGE ENABLE_WINSSL=<yes or no> - Enable native Windows SSL support, defaults to yes
  53. !MESSAGE GEN_PDB=<yes or no> - Generate Program Database (debug symbols for release build)
  54. !MESSAGE DEBUG=<yes or no> - Debug builds
  55. !MESSAGE MACHINE=<x86 or x64> - Target architecture (default x64 on AMD64, x86 on others)
  56. !MESSAGE CARES_PATH=<path to cares> - Custom path for c-ares
  57. !MESSAGE MBEDTLS_PATH=<path to mbedTLS> - Custom path for mbedTLS
  58. !MESSAGE NGHTTP2_PATH=<path to HTTP/2> - Custom path for nghttp2
  59. !MESSAGE SSH2_PATH=<path to libSSH2> - Custom path for libSSH2
  60. !MESSAGE SSL_PATH=<path to OpenSSL> - Custom path for OpenSSL
  61. !MESSAGE ZLIB_PATH=<path to zlib> - Custom path for zlib
  62. !ERROR please choose a valid mode
  63. !ENDIF
  64. !INCLUDE "../lib/Makefile.inc"
  65. LIBCURL_OBJS=$(CSOURCES:.c=.obj)
  66. !INCLUDE "../src/Makefile.inc"
  67. # tool_hugehelp has a special rule
  68. CURL_OBJS=$(CURL_CFILES:tool_hugehelp.c=)
  69. CURL_OBJS=$(CURL_OBJS:.c=.obj)
  70. # backwards compatible check for USE_SSPI
  71. !IFDEF USE_SSPI
  72. ENABLE_SSPI = $(USE_SSPI)
  73. !ENDIF
  74. # default options
  75. !IFNDEF MACHINE
  76. # Note: nmake magically changes the value of PROCESSOR_ARCHITECTURE from "AMD64"
  77. # to "x86" when building in a 32 bit build environment on a 64 bit machine.
  78. !IF "$(PROCESSOR_ARCHITECTURE)"=="AMD64"
  79. MACHINE = x64
  80. !ELSE
  81. MACHINE = x86
  82. !ENDIF
  83. !ENDIF
  84. !IFNDEF ENABLE_IDN
  85. USE_IDN = true
  86. !ELSEIF "$(ENABLE_IDN)"=="yes"
  87. USE_IDN = true
  88. !ELSEIF "$(ENABLE_IDN)"=="no"
  89. USE_IDN = false
  90. !ENDIF
  91. !IFNDEF ENABLE_IPV6
  92. USE_IPV6 = true
  93. !ELSEIF "$(ENABLE_IPV6)"=="yes"
  94. USE_IPV6 = true
  95. !ELSEIF "$(ENABLE_IPV6)"=="no"
  96. USE_IPV6 = false
  97. !ENDIF
  98. !IFNDEF ENABLE_SSPI
  99. USE_SSPI = true
  100. !ELSEIF "$(ENABLE_SSPI)"=="yes"
  101. USE_SSPI = true
  102. !ELSEIF "$(ENABLE_SSPI)"=="no"
  103. USE_SSPI = false
  104. !ENDIF
  105. !IFNDEF ENABLE_WINSSL
  106. !IF DEFINED(WITH_SSL) || DEFINED(WITH_MBEDTLS)
  107. USE_WINSSL = false
  108. !ELSE
  109. USE_WINSSL = $(USE_SSPI)
  110. !ENDIF
  111. !ELSEIF "$(ENABLE_WINSSL)"=="yes"
  112. USE_WINSSL = true
  113. !ELSEIF "$(ENABLE_WINSSL)"=="no"
  114. USE_WINSSL = false
  115. !ENDIF
  116. CONFIG_NAME_LIB = libcurl
  117. !IF "$(WITH_SSL)"=="dll"
  118. USE_SSL = true
  119. SSL = dll
  120. !ELSEIF "$(WITH_SSL)"=="static"
  121. USE_SSL = true
  122. SSL = static
  123. !ENDIF
  124. !IF "$(ENABLE_NGHTTP2)"=="yes"
  125. # compatibility bit, WITH_NGHTTP2 is the correct flag
  126. WITH_NGHTTP2 = dll
  127. USE_NGHTTP2 = true
  128. NGHTTP2 = dll
  129. !ELSEIF "$(WITH_NGHTTP2)"=="dll"
  130. USE_NGHTTP2 = true
  131. NGHTTP2 = dll
  132. !ELSEIF "$(WITH_NGHTTP2)"=="static"
  133. USE_NGHTTP2 = true
  134. NGHTTP2 = static
  135. !ENDIF
  136. !IFNDEF USE_NGHTTP2
  137. USE_NGHTTP2 = false
  138. !ENDIF
  139. !IF "$(WITH_MBEDTLS)"=="dll" || "$(WITH_MBEDTLS)"=="static"
  140. USE_MBEDTLS = true
  141. MBEDTLS = $(WITH_MBEDTLS)
  142. !ENDIF
  143. !IF ( "$(USE_SSL)"=="true" && "$(USE_WINSSL)"=="true" ) \
  144. || ( "$(USE_SSL)"=="true" && "$(USE_MBEDTLS)"=="true" ) \
  145. || ( "$(USE_MBEDTLS)"=="true" && "$(USE_WINSSL)"=="true" )
  146. !ERROR SSL, MBEDTLS and WINSSL are mutual exclusive options.
  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. CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-vc$(VC)-$(MACHINE)
  170. !IF "$(DEBUG)"=="yes"
  171. CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-debug
  172. !ELSE
  173. CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-release
  174. !ENDIF
  175. !IF "$(AS_DLL)"=="true"
  176. CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-dll
  177. !ELSE
  178. CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-static
  179. !ENDIF
  180. !IF "$(USE_SSL)"=="true"
  181. CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-ssl-$(SSL)
  182. !ENDIF
  183. !IF "$(USE_MBEDTLS)"=="true"
  184. CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-mbedtls-$(MBEDTLS)
  185. !ENDIF
  186. !IF "$(USE_CARES)"=="true"
  187. CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-cares-$(CARES)
  188. !ENDIF
  189. !IF "$(USE_ZLIB)"=="true"
  190. CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-zlib-$(ZLIB)
  191. !ENDIF
  192. !IF "$(USE_SSH2)"=="true"
  193. CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-ssh2-$(SSH2)
  194. !ENDIF
  195. !IF "$(USE_IPV6)"=="true"
  196. CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-ipv6
  197. !ENDIF
  198. !IF "$(USE_SSPI)"=="true"
  199. CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-sspi
  200. !ENDIF
  201. !IF "$(USE_WINSSL)"=="true"
  202. CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-winssl
  203. !ENDIF
  204. !IF "$(USE_NGHTTP2)"=="true"
  205. CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-nghttp2-$(NGHTTP2)
  206. !ENDIF
  207. !MESSAGE configuration name: $(CONFIG_NAME_LIB)
  208. BUILD_DIR=../builds/$(CONFIG_NAME_LIB)
  209. LIBCURL_DIROBJ = ..\builds\$(CONFIG_NAME_LIB)-obj-lib
  210. CURL_DIROBJ = ..\builds\$(CONFIG_NAME_LIB)-obj-curl
  211. DIRDIST = ..\builds\$(CONFIG_NAME_LIB)\
  212. $(MODE):
  213. @SET DIROBJ=$(LIBCURL_DIROBJ)
  214. @SET MACRO_NAME=LIBCURL_OBJS
  215. @SET OUTFILE=LIBCURL_OBJS.inc
  216. @CALL gen_resp_file.bat $(LIBCURL_OBJS)
  217. @SET DIROBJ=$(CURL_DIROBJ)
  218. @SET MACRO_NAME=CURL_OBJS
  219. @SET OUTFILE=CURL_OBJS.inc
  220. @CALL gen_resp_file.bat $(CURL_OBJS)
  221. @SET CONFIG_NAME_LIB=$(CONFIG_NAME_LIB)
  222. @SET MACHINE=$(MACHINE)
  223. @SET USE_NGHTTP2=$(USE_NGHTTP2)
  224. @SET USE_IDN=$(USE_IDN)
  225. @SET USE_IPV6=$(USE_IPV6)
  226. @SET USE_SSPI=$(USE_SSPI)
  227. @SET USE_WINSSL=$(USE_WINSSL)
  228. # compatibility bit
  229. @SET WITH_NGHTTP2=$(WITH_NGHTTP2)
  230. @$(MAKE) /NOLOGO /F MakefileBuild.vc
  231. copy_from_lib:
  232. echo copying .c...
  233. FOR %%i IN ($(CURLX_CFILES:/=\)) DO copy %%i ..\src\
  234. clean:
  235. $(MAKE) /NOLOGO /F MakefileBuild.vc $@