Makefile.vc 6.2 KB

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