Makefile.vc 6.4 KB

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