MakefileBuild.vc 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543
  1. #***************************************************************************
  2. # _ _ ____ _
  3. # Project ___| | | | _ \| |
  4. # / __| | | | |_) | |
  5. # | (__| |_| | _ <| |___
  6. # \___|\___/|_| \_\_____|
  7. #
  8. # Copyright (C) 1999 - 2016, 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. ###########################################################################
  23. #
  24. # Makefile for building libcurl with MSVC 6, 7, 8, 9, 10, 11, 12 and 14
  25. #
  26. # Usage: see usage message below
  27. # Should be invoked from winbuild directory
  28. # Edit the paths and desired library name
  29. # SSL path is only required if you intend compiling
  30. # with SSL.
  31. #
  32. # This make file leaves the result either a .lib or .dll file
  33. # in the \lib directory. It should be called from the \lib
  34. # directory.
  35. #
  36. # An option would have been to allow the source directory to
  37. # be specified, but I saw no requirement.
  38. #
  39. # Another option would have been to leave the .lib and .dll
  40. # files in the "cfg" directory, but then the make file
  41. # in \src would need to be changed.
  42. #
  43. ##############################################################
  44. CFGSET=FALSE
  45. WINBUILD_DIR=`cd`
  46. ZIP = zip.exe
  47. # Allow changing C compiler via environment variable CC (default cl.exe)
  48. # This command macro is not set by default: https://msdn.microsoft.com/en-us/library/ms933742.aspx
  49. !If "$(CC)" == ""
  50. CC = cl.exe
  51. !Endif
  52. !IF "$(VC)"=="6"
  53. CC_NODEBUG = $(CC) /O2 /DNDEBUG
  54. CC_DEBUG = $(CC) /Od /Gm /Zi /D_DEBUG /GZ
  55. CFLAGS = /I. /I../lib /I../include /nologo /W3 /GX /DWIN32 /YX /FD /c /DBUILDING_LIBCURL
  56. !ELSE
  57. CC_NODEBUG = $(CC) /O2 /DNDEBUG
  58. CC_DEBUG = $(CC) /Od /D_DEBUG /RTC1 /Z7 /LDd /W3
  59. CFLAGS = /I. /I ../lib /I../include /nologo /W3 /EHsc /DWIN32 /FD /c /DBUILDING_LIBCURL /DWIN32_LEAN_AND_MEAN
  60. !ENDIF
  61. LFLAGS = /nologo /machine:$(MACHINE)
  62. LNKDLL = link.exe /DLL
  63. LNKLIB = link.exe /lib
  64. CFLAGS_PDB = /Zi
  65. LFLAGS_PDB = /incremental:no /opt:ref,icf
  66. CFLAGS_LIBCURL_STATIC = /DCURL_STATICLIB
  67. WIN_LIBS = ws2_32.lib wldap32.lib advapi32.lib
  68. BASE_NAME = libcurl
  69. BASE_NAME_DEBUG = $(BASE_NAME)_debug
  70. BASE_NAME_STATIC = $(BASE_NAME)_a
  71. BASE_NAME_STATIC_DEBUG = $(BASE_NAME_STATIC)_debug
  72. LIB_NAME_STATIC = $(BASE_NAME_STATIC).lib
  73. LIB_NAME_STATIC_DEBUG = $(BASE_NAME_STATIC_DEBUG).lib
  74. LIB_NAME_DLL = $(BASE_NAME).dll
  75. LIB_NAME_IMP = $(BASE_NAME).lib
  76. LIB_NAME_DLL_DEBUG = $(BASE_NAME_DEBUG).dll
  77. LIB_NAME_IMP_DEBUG = $(BASE_NAME_DEBUG).lib
  78. PDB_NAME_STATIC = $(BASE_NAME_STATIC).pdb
  79. PDB_NAME_STATIC_DEBUG = $(BASE_NAME_STATIC_DEBUG).pdb
  80. PDB_NAME_DLL = $(BASE_NAME).pdb
  81. PDB_NAME_DLL_DEBUG = $(BASE_NAME_DEBUG).pdb
  82. # CURL Command section
  83. PROGRAM_NAME = curl.exe
  84. CURL_CFLAGS = /I../lib /I../include /nologo /W3 /EHsc /DWIN32 /FD /c
  85. CURL_LFLAGS = /nologo /out:$(DIRDIST)\bin\$(PROGRAM_NAME) /subsystem:console /machine:$(MACHINE)
  86. CURL_RESFLAGS = /i../include
  87. #############################################################
  88. ## Nothing more to do below this line!
  89. LIBCURL_SRC_DIR = ..\lib
  90. CURL_SRC_DIR = ..\src
  91. !IFNDEF WITH_DEVEL
  92. WITH_DEVEL = ../../deps
  93. !ENDIF
  94. DEVEL_INCLUDE = $(WITH_DEVEL)/include
  95. DEVEL_LIB = $(WITH_DEVEL)/lib
  96. DEVEL_BIN = $(WITH_DEVEL)/bin
  97. CFLAGS = $(CFLAGS) /I"$(DEVEL_INCLUDE)"
  98. LFLAGS = $(LFLAGS) "/LIBPATH:$(DEVEL_LIB)"
  99. !IF "$(WITH_SSL)"=="dll"
  100. !IF EXISTS("$(DEVEL_LIB)\libssl.lib")
  101. SSL_LIBS = libssl.lib libcrypto.lib
  102. !ELSE
  103. SSL_LIBS = libeay32.lib ssleay32.lib
  104. !ENDIF
  105. USE_SSL = true
  106. SSL = dll
  107. !ELSEIF "$(WITH_SSL)"=="static"
  108. !IF EXISTS("$(DEVEL_LIB)\libssl.lib")
  109. SSL_LIBS = libssl.lib libcrypto.lib gdi32.lib user32.lib crypt32.lib
  110. !ELSE
  111. SSL_LIBS = libeay32.lib ssleay32.lib gdi32.lib user32.lib crypt32.lib
  112. !ENDIF
  113. USE_SSL = true
  114. SSL = static
  115. !ENDIF
  116. !IFDEF USE_SSL
  117. SSL_CFLAGS = /DUSE_OPENSSL /I"$(DEVEL_INCLUDE)/openssl"
  118. !IF EXISTS("$(DEVEL_INCLUDE)\openssl\is_boringssl.h")
  119. SSL_CFLAGS = $(SSL_CFLAGS) /DHAVE_BORINGSSL
  120. !ENDIF
  121. !ENDIF
  122. !IF "$(WITH_NGHTTP2)"=="dll"
  123. NGHTTP2_CFLAGS = /DUSE_NGHTTP2
  124. NGHTTP2_LIBS = nghttp2.lib
  125. !ELSEIF "$(WITH_NGHTTP2)"=="static"
  126. NGHTTP2_CFLAGS = /DUSE_NGHTTP2 /DNGHTTP2_STATICLIB
  127. NGHTTP2_LIBS = nghttp2_static.lib
  128. !ENDIF
  129. !IF "$(WITH_MBEDTLS)"=="dll" || "$(WITH_MBEDTLS)"=="static"
  130. USE_MBEDTLS = true
  131. MBEDTLS = $(WITH_MBEDTLS)
  132. MBEDTLS_CFLAGS = /DUSE_MBEDTLS
  133. MBEDTLS_LIBS = mbedtls.lib mbedcrypto.lib mbedx509.lib
  134. !ENDIF
  135. !IF "$(WITH_CARES)"=="dll"
  136. !IF "$(DEBUG)"=="yes"
  137. CARES_LIBS = caresd.lib
  138. !ELSE
  139. CARES_LIBS = cares.lib
  140. !ENDIF
  141. USE_CARES = true
  142. CARES = dll
  143. !ELSEIF "$(WITH_CARES)"=="static"
  144. !IF "$(DEBUG)"=="yes"
  145. CARES_LIBS = libcaresd.lib
  146. !ELSE
  147. CARES_LIBS = libcares.lib
  148. !ENDIF
  149. USE_CARES = true
  150. CARES = static
  151. !ENDIF
  152. !IFDEF USE_CARES
  153. CARES_CFLAGS = /DUSE_ARES /I"$(DEVEL_INCLUDE)/cares"
  154. !ENDIF
  155. !IF "$(WITH_ZLIB)"=="dll"
  156. ZLIB_LIBS = zlib.lib
  157. USE_ZLIB = true
  158. ZLIB = dll
  159. !ELSEIF "$(WITH_ZLIB)"=="static"
  160. ZLIB_LIBS = zlib_a.lib
  161. USE_ZLIB = true
  162. ZLIB = static
  163. !ENDIF
  164. !IFDEF USE_ZLIB
  165. ZLIB_CFLAGS = /DHAVE_ZLIB_H /DHAVE_ZLIB /DHAVE_LIBZ
  166. !ENDIF
  167. !IF "$(WITH_SSH2)"=="dll"
  168. SSH2_LIBS = libssh2.lib
  169. USE_SSH2 = true
  170. SSH2 = dll
  171. !ELSEIF "$(WITH_SSH2)"=="static"
  172. SSH2_LIBS = libssh2_a.lib user32.lib
  173. USE_SSH2 = true
  174. SSH2 = static
  175. !ENDIF
  176. !IFDEF USE_SSH2
  177. SSH2_CFLAGS = /DHAVE_LIBSSH2 /DHAVE_LIBSSH2_H /DLIBSSH2_WIN32 /DLIBSSH2_LIBRARY /DUSE_LIBSSH2
  178. SSH2_CFLAGS = $(SSH2_CFLAGS) /I$(WITH_DEVEL)/include/libssh2
  179. !ENDIF
  180. !IFNDEF USE_IDN
  181. USE_IDN = true
  182. !ELSEIF "$(USE_IDN)"=="yes"
  183. USE_IDN = true
  184. !ENDIF
  185. !IF "$(USE_IDN)"=="true"
  186. IDN_CFLAGS = $(IDN_CFLAGS) /DUSE_WIN32_IDN /DWANT_IDN_PROTOTYPES
  187. WIN_LIBS = $(WIN_LIBS) Normaliz.lib
  188. !ENDIF
  189. !IFNDEF USE_IPV6
  190. USE_IPV6 = true
  191. !ELSEIF "$(USE_IPV6)"=="yes"
  192. USE_IPV6 = true
  193. !ENDIF
  194. !IF "$(USE_IPV6)"=="true"
  195. IPV6_CFLAGS = $(IPV6_CFLAGS) /DUSE_IPV6
  196. !ENDIF
  197. !IFNDEF USE_SSPI
  198. USE_SSPI = true
  199. !ELSEIF "$(USE_SSPI)"=="yes"
  200. USE_SSPI = true
  201. !ENDIF
  202. !IF "$(USE_SSPI)"=="true"
  203. SSPI_CFLAGS = $(SSPI_CFLAGS) /DUSE_WINDOWS_SSPI
  204. !ENDIF
  205. !IFNDEF USE_WINSSL
  206. !IF "$(USE_SSL)"=="true"
  207. USE_WINSSL = false
  208. !ELSE
  209. USE_WINSSL = $(USE_SSPI)
  210. !ENDIF
  211. !ELSEIF "$(USE_WINSSL)"=="yes"
  212. USE_WINSSL = true
  213. !ENDIF
  214. !IF "$(USE_WINSSL)"=="true"
  215. !IF "$(USE_SSPI)"!="true"
  216. !ERROR cannot build with WinSSL without SSPI
  217. !ENDIF
  218. SSPI_CFLAGS = $(SSPI_CFLAGS) /DUSE_SCHANNEL
  219. WIN_LIBS = $(WIN_LIBS) Crypt32.lib
  220. !ENDIF
  221. !IF "$(GEN_PDB)"=="yes"
  222. GEN_PDB = true
  223. !ENDIF
  224. !IFDEF EMBED_MANIFEST
  225. MANIFESTTOOL = mt -manifest $(DIRDIST)\$(PROGRAM_NAME).manifest -outputresource:$(DIRDIST)\$(PROGRAM_NAME);1
  226. !ENDIF
  227. # Runtime library configuration
  228. !IF "$(RTLIBCFG)"=="static"
  229. RTLIB = /MT
  230. RTLIB_DEBUG = /MTd
  231. !ELSE
  232. RTLIB = /MD
  233. RTLIB_DEBUG = /MDd
  234. !ENDIF
  235. !IF "$(MODE)"=="static"
  236. TARGET = $(LIB_NAME_STATIC)
  237. CURL_LIBCURL_LIBNAME=$(LIB_NAME_STATIC)
  238. AS_DLL = false
  239. CFGSET = true
  240. !ELSEIF "$(MODE)"=="dll"
  241. TARGET = $(LIB_NAME_DLL)
  242. CURL_LIBCURL_LIBNAME=$(LIB_NAME_IMP)
  243. AS_DLL = true
  244. CFGSET = true
  245. !ENDIF
  246. !IF "$(CFGSET)" == "FALSE"
  247. !ERROR please choose a valid mode
  248. !ENDIF
  249. # CURL_XX macros are for the curl.exe command
  250. !IF "$(DEBUG)"=="yes"
  251. RC_FLAGS = /dDEBUGBUILD=1 /Fo $@ $(LIBCURL_SRC_DIR)\libcurl.rc
  252. CURL_CC = $(CC_DEBUG) $(RTLIB_DEBUG)
  253. CURL_RC_FLAGS = /i../include /dDEBUGBUILD=1 /Fo $@ $(CURL_SRC_DIR)\curl.rc
  254. !ELSE
  255. RC_FLAGS = /dDEBUGBUILD=0 /Fo $@ $(LIBCURL_SRC_DIR)\libcurl.rc
  256. CURL_CC = $(CC_NODEBUG) $(RTLIB)
  257. CURL_RC_FLAGS = /i../include /dDEBUGBUILD=0 /Fo $@ $(CURL_SRC_DIR)\curl.rc
  258. !ENDIF
  259. !IF "$(AS_DLL)" == "true"
  260. LNK = $(LNKDLL) $(WIN_LIBS) /out:$(LIB_DIROBJ)\$(TARGET)
  261. !IF "$(DEBUG)"=="yes"
  262. TARGET = $(LIB_NAME_DLL_DEBUG)
  263. LNK = $(LNK) /DEBUG /IMPLIB:$(LIB_DIROBJ)\$(LIB_NAME_IMP_DEBUG)
  264. PDB = $(PDB_NAME_DLL_DEBUG)
  265. CURL_LIBS = /IMPLIB:$(LIB_DIROBJ)\$(LIB_NAME_IMP_DEBUG)
  266. !ELSE
  267. TARGET = $(LIB_NAME_DLL)
  268. LNK = $(LNK) /IMPLIB:$(LIB_DIROBJ)\$(LIB_NAME_IMP)
  269. PDB = $(PDB_NAME_DLL)
  270. CURL_LIBS = /IMPLIB:$(LIB_DIROBJ)\$(LIB_NAME_IMP)
  271. !ENDIF
  272. RESOURCE = $(LIB_DIROBJ)\libcurl.res
  273. # AS_DLL
  274. !ELSE
  275. !IF "$(DEBUG)"=="yes"
  276. TARGET = $(LIB_NAME_STATIC_DEBUG)
  277. PDB = $(PDB_NAME_STATIC_DEBUG)
  278. !ELSE
  279. TARGET = $(LIB_NAME_STATIC)
  280. PDB = $(PDB_NAME_STATIC)
  281. !ENDIF
  282. LNK = $(LNKLIB) $(WIN_LIBS) /out:$(LIB_DIROBJ)\$(TARGET)
  283. CURL_CC = $(CURL_CC) $(CFLAGS_LIBCURL_STATIC)
  284. # AS_DLL
  285. !ENDIF
  286. !IF "$(USE_SSL)"=="true"
  287. CFLAGS = $(CFLAGS) $(SSL_CFLAGS)
  288. LFLAGS = $(LFLAGS) $(SSL_LFLAGS) $(SSL_LIBS)
  289. !ENDIF
  290. !IF "$(USE_MBEDTLS)"=="true"
  291. CFLAGS = $(CFLAGS) $(MBEDTLS_CFLAGS)
  292. LFLAGS = $(LFLAGS) $(MBEDTLS_LFLAGS) $(MBEDTLS_LIBS)
  293. !ENDIF
  294. !IF "$(USE_CARES)"=="true"
  295. CFLAGS = $(CFLAGS) $(CARES_CFLAGS)
  296. LFLAGS = $(LFLAGS) $(CARES_LFLAGS) $(CARES_LIBS)
  297. !ENDIF
  298. !IF "$(USE_ZLIB)"=="true"
  299. CFLAGS = $(CFLAGS) $(ZLIB_CFLAGS)
  300. LFLAGS = $(LFLAGS) $(ZLIB_LFLAGS) $(ZLIB_LIBS)
  301. !ENDIF
  302. !IF "$(USE_SSH2)"=="true"
  303. CFLAGS = $(CFLAGS) $(SSH2_CFLAGS)
  304. LFLAGS = $(LFLAGS) $(SSH2_LFLAGS) $(SSH2_LIBS)
  305. !ENDIF
  306. !IF "$(USE_IDN)"=="true"
  307. CFLAGS = $(CFLAGS) $(IDN_CFLAGS)
  308. !ENDIF
  309. !IF "$(USE_IPV6)"=="true"
  310. CFLAGS = $(CFLAGS) $(IPV6_CFLAGS)
  311. !ENDIF
  312. !IF "$(USE_SSPI)"=="true"
  313. CFLAGS = $(CFLAGS) $(SSPI_CFLAGS)
  314. !ENDIF
  315. !IF "$(USE_NGHTTP2)"=="true"
  316. CFLAGS = $(CFLAGS) $(NGHTTP2_CFLAGS)
  317. LFLAGS = $(LFLAGS) $(NGHTTP2_LFLAGS) $(NGHTTP2_LIBS)
  318. !ENDIF
  319. !IF "$(GEN_PDB)"=="true"
  320. CFLAGS = $(CFLAGS) $(CFLAGS_PDB) /Fd"$(LIB_DIROBJ)\$(PDB)"
  321. LFLAGS = $(LFLAGS) $(LFLAGS_PDB)
  322. !ENDIF
  323. LIB_DIROBJ = ..\builds\$(CONFIG_NAME_LIB)-obj-lib
  324. CURL_DIROBJ = ..\builds\$(CONFIG_NAME_LIB)-obj-curl
  325. DIRDIST = ..\builds\$(CONFIG_NAME_LIB)\
  326. #
  327. # curl.exe
  328. #
  329. CURL_LINK = link.exe /incremental:no /libpath:"$(DIRDIST)\lib"
  330. #!IF "$(CFG)" == "release-ssh2-ssl-dll-zlib"
  331. #TARGET = $(LIB_NAME_STATIC)
  332. #LNK = $(LNKLIB) $(WINLIBS) $(SSLLIBS) $(ZLIBLIBS) $(SSH2LIBS) $(SSL_LFLAGS) $(ZLIB_LFLAGS) $(LFLAGSSSH) /out:$(LIB_DIROBJ)\$(TARGET)
  333. #CC = $(CCNODBG) $(RTLIB) $(SSL_CFLAGS) $(ZLIB_CFLAGS) $(CFLAGSLIB) $(SSH2_CFLAGS)
  334. #CFGSET = TRUE
  335. #!ENDIF
  336. #######################
  337. # Only the clean target can be used if a config was not provided.
  338. #
  339. !IF "$(CFGSET)" == "FALSE"
  340. clean:
  341. @-erase /s *.dll 2> NUL
  342. @-erase /s *.exp 2> NUL
  343. @-erase /s *.idb 2> NUL
  344. @-erase /s *.lib 2> NUL
  345. @-erase /s *.obj 2> NUL
  346. @-erase /s *.pch 2> NUL
  347. @-erase /s *.pdb 2> NUL
  348. @-erase /s *.res 2> NUL
  349. !ELSE
  350. # A mode was provided, so the library can be built.
  351. #
  352. !include CURL_OBJS.inc
  353. !include LIBCURL_OBJS.inc
  354. !IF "$(AS_DLL)" == "true"
  355. LIB_OBJS = $(LIBCURL_OBJS) $(RESOURCE)
  356. !ELSE
  357. LIB_OBJS = $(LIBCURL_OBJS)
  358. !ENDIF
  359. EXE_OBJS = $(CURL_OBJS) $(CURL_DIROBJ)\curl.res
  360. all : $(TARGET) $(PROGRAM_NAME)
  361. package: $(TARGET)
  362. @cd $(DIRDIST)
  363. @-$(ZIP) -9 -q -r ..\$(CONFIG_NAME_LIB).zip .>nul 2<&1
  364. @cd $(MAKEDIR)
  365. $(TARGET): $(LIB_OBJS) $(LIB_DIROBJ) $(DISTDIR)
  366. @echo Using SSL: $(USE_SSL)
  367. @echo Using NGHTTP2: $(USE_NGHTTP2)
  368. @echo Using c-ares: $(USE_CARES)
  369. @echo Using SSH2: $(USE_SSH2)
  370. @echo Using ZLIB: $(USE_ZLIB)
  371. @echo Using IDN: $(USE_IDN)
  372. @echo Using IPv6: $(USE_IPV6)
  373. @echo Using SSPI: $(USE_SSPI)
  374. @echo Using WinSSL: $(USE_WINSSL)
  375. @echo CFLAGS: $(CFLAGS)
  376. @echo LFLAGS: $(LFLAGS)
  377. @echo GenPDB: $(GEN_PDB)
  378. @echo Debug: $(DEBUG)
  379. @echo Machine: $(MACHINE)
  380. $(LNK) $(LFLAGS) $(LIB_OBJS)
  381. @echo Copying libs...
  382. @if exist $(LIB_DIROBJ)\$(LIB_NAME_DLL) copy $(LIB_DIROBJ)\$(LIB_NAME_DLL) $(DIRDIST)\bin\ /y >nul 2<&1
  383. @if exist $(LIB_DIROBJ)\$(LIB_NAME_STATIC) copy $(LIB_DIROBJ)\$(LIB_NAME_STATIC) $(DIRDIST)\lib\ /y >nul 2<&1
  384. @if exist $(LIB_DIROBJ)\$(LIB_NAME_DLL_DEBUG) copy $(LIB_DIROBJ)\$(LIB_NAME_DLL_DEBUG) $(DIRDIST)\bin\ /y >nul 2<&1
  385. @if exist $(LIB_DIROBJ)\$(LIB_NAME_STATIC_DEBUG) copy $(LIB_DIROBJ)\$(LIB_NAME_STATIC_DEBUG) $(DIRDIST)\lib\ /y >nul 2<&1
  386. @if exist $(LIB_DIROBJ)\$(LIB_NAME_IMP) copy $(LIB_DIROBJ)\$(LIB_NAME_IMP) $(DIRDIST)\lib\ /y >nul 2<&1
  387. @if exist $(LIB_DIROBJ)\$(LIB_NAME_IMP_DEBUG) copy $(LIB_DIROBJ)\$(LIB_NAME_IMP_DEBUG) $(DIRDIST)\lib >nul 2<&1
  388. @-copy $(LIB_DIROBJ)\*.exp $(DIRDIST)\lib /y >nul 2<&1
  389. @-copy $(LIB_DIROBJ)\*.pdb $(DIRDIST)\lib /y >nul 2<&1
  390. @-copy ..\include\curl\*.h $(DIRDIST)\include\curl\ /y >nul 2<&1
  391. $(LIB_OBJS): $(LIB_DIROBJ) $(DIRDIST)
  392. $(DIRDIST):
  393. @if not exist "$(DIRDIST)\bin" mkdir $(DIRDIST)\bin
  394. @if not exist "$(DIRDIST)\include" mkdir $(DIRDIST)\include
  395. @if not exist "$(DIRDIST)\include\curl" mkdir $(DIRDIST)\include\curl
  396. @if not exist "$(DIRDIST)\lib" mkdir $(DIRDIST)\lib
  397. $(LIB_DIROBJ):
  398. @if not exist "$(LIB_DIROBJ)" mkdir $(LIB_DIROBJ)
  399. @if not exist "$(LIB_DIROBJ)\vauth" mkdir $(LIB_DIROBJ)\vauth
  400. @if not exist "$(LIB_DIROBJ)\vtls" mkdir $(LIB_DIROBJ)\vtls
  401. $(CURL_DIROBJ):
  402. @if not exist "$(CURL_DIROBJ)" mkdir $(CURL_DIROBJ)
  403. # we need a lib dir for the portability functions from libcurl
  404. # we use the .c directly here
  405. @if not exist "$(CURL_DIROBJ)" mkdir $(CURL_DIROBJ)\lib
  406. .SUFFIXES: .c .obj .res
  407. {$(LIBCURL_SRC_DIR)\}.c{$(LIB_DIROBJ)\}.obj:
  408. $(CURL_CC) $(CFLAGS) /Fo"$@" $<
  409. {$(LIBCURL_SRC_DIR)\vauth\}.c{$(LIB_DIROBJ)\vauth\}.obj:
  410. $(CURL_CC) $(CFLAGS) /Fo"$@" $<
  411. {$(LIBCURL_SRC_DIR)\vtls\}.c{$(LIB_DIROBJ)\vtls\}.obj:
  412. $(CURL_CC) $(CFLAGS) /Fo"$@" $<
  413. $(LIB_DIROBJ)\libcurl.res: $(LIBCURL_SRC_DIR)\libcurl.rc
  414. rc $(RC_FLAGS)
  415. #
  416. # curl.exe
  417. #
  418. !IF "$(MODE)"=="static"
  419. !IF "$(DEBUG)"=="yes"
  420. CURL_LIBCURL_LIBNAME=$(LIB_NAME_STATIC_DEBUG)
  421. !ELSE
  422. CURL_LIBCURL_LIBNAME=$(LIB_NAME_STATIC)
  423. !ENDIF
  424. !ELSEIF "$(MODE)"=="dll"
  425. !IF "$(DEBUG)"=="yes"
  426. CURL_LIBCURL_LIBNAME=$(LIB_NAME_IMP_DEBUG)
  427. !ELSE
  428. CURL_LIBCURL_LIBNAME=$(LIB_NAME_IMP)
  429. !ENDIF
  430. !ENDIF
  431. CURL_FROM_LIBCURL=$(CURL_DIROBJ)\tool_hugehelp.obj \
  432. $(CURL_DIROBJ)\nonblock.obj \
  433. $(CURL_DIROBJ)\strtoofft.obj \
  434. $(CURL_DIROBJ)\warnless.obj
  435. $(PROGRAM_NAME): $(CURL_DIROBJ) $(CURL_FROM_LIBCURL) $(EXE_OBJS)
  436. $(CURL_LINK) $(CURL_LFLAGS) $(CURL_LIBCURL_LIBNAME) $(WIN_LIBS) $(CURL_FROM_LIBCURL) $(EXE_OBJS)
  437. $(MANIFESTTOOL)
  438. {$(CURL_SRC_DIR)\}.c{$(CURL_DIROBJ)\}.obj:
  439. $(CURL_CC) $(CURL_CFLAGS) /Fo"$@" $<
  440. $(CURL_DIROBJ)\tool_hugehelp.obj: $(CURL_SRC_DIR)\tool_hugehelp.c
  441. $(CURL_CC) $(CURL_CFLAGS) /Zm200 /Fo"$@" $(CURL_SRC_DIR)\tool_hugehelp.c
  442. $(CURL_DIROBJ)\nonblock.obj: ../lib/nonblock.c
  443. $(CURL_CC) $(CURL_CFLAGS) /Fo"$@" ../lib/nonblock.c
  444. $(CURL_DIROBJ)\strtoofft.obj: ../lib/strtoofft.c
  445. $(CURL_CC) $(CURL_CFLAGS) /Fo"$@" ../lib/strtoofft.c
  446. $(CURL_DIROBJ)\warnless.obj: ../lib/warnless.c
  447. $(CURL_CC) $(CURL_CFLAGS) /Fo"$@" ../lib/warnless.c
  448. $(CURL_DIROBJ)\curl.res: $(CURL_SRC_DIR)\curl.rc
  449. rc $(CURL_RC_FLAGS)
  450. !ENDIF # End of case where a config was provided.