• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#***************************************************************************
2#                                  _   _ ____  _
3#  Project                     ___| | | |  _ \| |
4#                             / __| | | | |_) | |
5#                            | (__| |_| |  _ <| |___
6#                             \___|\___/|_| \_\_____|
7#
8# Copyright (C) 1999 - 2018, 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#
25# Makefile for building libcurl with MSVC 6 through to 15
26#
27# Usage: see usage message below
28#        Should be invoked from winbuild directory
29#        Edit the paths and desired library name
30#        SSL path is only required if you intend compiling
31#        with SSL.
32#
33# This make file leaves the result either a .lib or .dll file
34# in the \lib directory. It should be called from the \lib
35# directory.
36#
37# An option would have been to allow the source directory to
38# be specified, but I saw no requirement.
39#
40# Another option would have been to leave the .lib and .dll
41# files in the "cfg" directory, but then the make file
42# in \src would need to be changed.
43#
44##############################################################
45
46CFGSET=FALSE
47WINBUILD_DIR=`cd`
48
49# Utilities.
50# If a path is required that contains characters such as space, quote the path.
51MT         = mt.exe
52RC         = rc.exe
53ZIP        = zip.exe
54
55# Allow changing C compiler via environment variable CC (default cl.exe)
56# This command macro is not set by default: https://msdn.microsoft.com/en-us/library/ms933742.aspx
57!If "$(CC)" == ""
58CC = cl.exe
59!Endif
60
61!IF "$(VC)"=="6"
62CC_NODEBUG  = $(CC) /O2 /DNDEBUG
63CC_DEBUG    = $(CC) /Od /Gm /Zi /D_DEBUG /GZ
64CFLAGS      = /I. /I../lib /I../include /nologo /W4 /wd4127 /GX /DWIN32 /YX /FD /c /DBUILDING_LIBCURL
65!ELSE
66CC_NODEBUG  = $(CC) /O2 /DNDEBUG
67CC_DEBUG    = $(CC) /Od /D_DEBUG /RTC1 /Z7 /LDd
68CFLAGS      = /I. /I ../lib /I../include /nologo /W4 /wd4127 /EHsc /DWIN32 /FD /c /DBUILDING_LIBCURL
69!ENDIF
70
71LFLAGS     = /nologo /machine:$(MACHINE)
72LNKDLL     = link.exe /DLL
73# Use lib.exe instead of link.exe as link.exe /lib has the following bad habits:
74# - optimizing options like /opt:ref raises warnings (at least in Visual Studio 2015)
75# - all (including Windows) dependencies are aggregated (as static parts)
76# - link.exe /lib is not documented (anymore) at MSDN
77# Instead of id: just create an archive, that contains all objects
78LNKLIB     = lib.exe
79
80CFLAGS_PDB = /Zi
81LFLAGS_PDB = /incremental:no /opt:ref,icf /DEBUG
82
83CFLAGS_LIBCURL_STATIC  = /DCURL_STATICLIB
84
85WIN_LIBS    = ws2_32.lib wldap32.lib advapi32.lib crypt32.lib
86
87BASE_NAME              = libcurl
88BASE_NAME_DEBUG        = $(BASE_NAME)_debug
89BASE_NAME_STATIC       = $(BASE_NAME)_a
90BASE_NAME_STATIC_DEBUG = $(BASE_NAME_STATIC)_debug
91
92LIB_NAME_STATIC        = $(BASE_NAME_STATIC).lib
93LIB_NAME_STATIC_DEBUG  = $(BASE_NAME_STATIC_DEBUG).lib
94LIB_NAME_DLL           = $(BASE_NAME).dll
95LIB_NAME_IMP           = $(BASE_NAME).lib
96LIB_NAME_DLL_DEBUG     = $(BASE_NAME_DEBUG).dll
97LIB_NAME_IMP_DEBUG     = $(BASE_NAME_DEBUG).lib
98
99PDB_NAME_STATIC        = $(BASE_NAME_STATIC).pdb
100PDB_NAME_STATIC_DEBUG  = $(BASE_NAME_STATIC_DEBUG).pdb
101PDB_NAME_DLL           = $(BASE_NAME).pdb
102PDB_NAME_DLL_DEBUG     = $(BASE_NAME_DEBUG).pdb
103
104# CURL Command section
105PROGRAM_NAME  = curl.exe
106CURL_CFLAGS   = /I../lib /I../include /nologo /W4 /EHsc /DWIN32 /FD /c
107CURL_LFLAGS   = /out:$(DIRDIST)\bin\$(PROGRAM_NAME) /subsystem:console $(LFLAGS)
108CURL_RESFLAGS = /i../include
109
110#############################################################
111## Nothing more to do below this line!
112LIBCURL_SRC_DIR = ..\lib
113CURL_SRC_DIR = ..\src
114
115!IFNDEF WITH_DEVEL
116WITH_DEVEL   = ../../deps
117!ENDIF
118DEVEL_INCLUDE= $(WITH_DEVEL)/include
119DEVEL_LIB    = $(WITH_DEVEL)/lib
120
121!IF EXISTS("$(DEVEL_INCLUDE)")
122CFLAGS       = $(CFLAGS) /I"$(DEVEL_INCLUDE)"
123!ENDIF
124!IF EXISTS("$(DEVEL_LIB)")
125LFLAGS       = $(LFLAGS) "/LIBPATH:$(DEVEL_LIB)"
126!ENDIF
127
128!IFDEF SSL_PATH
129SSL_INC_DIR  = $(SSL_PATH)\include
130SSL_LIB_DIR  = $(SSL_PATH)\lib
131SSL_LFLAGS   = $(SSL_LFLAGS) "/LIBPATH:$(SSL_LIB_DIR)"
132!ELSE
133SSL_INC_DIR=$(DEVEL_INCLUDE)\openssl
134SSL_LIB_DIR=$(DEVEL_LIB)
135!ENDIF
136
137!IF "$(WITH_SSL)"=="dll" || "$(WITH_SSL)"=="static"
138!IF EXISTS("$(SSL_LIB_DIR)\libssl.lib")
139SSL_LIBS     = libssl.lib libcrypto.lib
140!ELSE
141SSL_LIBS     = libeay32.lib ssleay32.lib
142!ENDIF
143USE_SSL      = true
144SSL          = $(WITH_SSL)
145!IF "$(WITH_SSL)"=="static"
146WIN_LIBS     = $(WIN_LIBS) gdi32.lib user32.lib crypt32.lib
147!ENDIF
148!ENDIF
149
150!IFDEF USE_SSL
151SSL_CFLAGS   = /DUSE_OPENSSL /I"$(SSL_INC_DIR)"
152!IF EXISTS("$(SSL_INC_DIR)\is_boringssl.h")
153SSL_CFLAGS   = $(SSL_CFLAGS) /DHAVE_BORINGSSL
154!ENDIF
155!IF "$(ENABLE_OPENSSL_AUTO_LOAD_CONFIG)"=="false"
156SSL_CFLAGS   = $(SSL_CFLAGS) /DCURL_DISABLE_OPENSSL_AUTO_LOAD_CONFIG
157!ENDIF
158!ENDIF
159
160
161!IFDEF NGHTTP2_PATH
162NGHTTP2_INC_DIR  = $(NGHTTP2_PATH)\include
163NGHTTP2_LIB_DIR  = $(NGHTTP2_PATH)\lib
164NGHTTP2_LFLAGS   = $(NGHTTP2_LFLAGS) "/LIBPATH:$(NGHTTP2_LIB_DIR)"
165!ELSE
166NGHTTP2_INC_DIR  = $(DEVEL_INCLUDE)
167NGHTTP2_LIB_DIR  = $(DEVEL_LIB)
168!ENDIF
169
170!IF "$(WITH_NGHTTP2)"=="dll"
171NGHTTP2_CFLAGS   = /DUSE_NGHTTP2 /I"$(NGHTTP2_INC_DIR)"
172NGHTTP2_LIBS     = nghttp2.lib
173!ELSEIF "$(WITH_NGHTTP2)"=="static"
174NGHTTP2_CFLAGS   = /DUSE_NGHTTP2 /DNGHTTP2_STATICLIB /I"$(NGHTTP2_INC_DIR)"
175NGHTTP2_LIBS     = nghttp2_static.lib
176!ENDIF
177
178
179!IFDEF MBEDTLS_PATH
180MBEDTLS_INC_DIR  = $(MBEDTLS_PATH)\include
181MBEDTLS_LIB_DIR  = $(MBEDTLS_PATH)\lib
182MBEDTLS_LFLAGS   = $(MBEDTLS_LFLAGS) "/LIBPATH:$(MBEDTLS_LIB_DIR)"
183!ELSE
184MBEDTLS_INC_DIR  = $(DEVEL_INCLUDE)
185MBEDTLS_LIB_DIR  = $(DEVEL_LIB)
186!ENDIF
187
188!IF "$(WITH_MBEDTLS)"=="dll" || "$(WITH_MBEDTLS)"=="static"
189USE_MBEDTLS    = true
190MBEDTLS        = $(WITH_MBEDTLS)
191MBEDTLS_CFLAGS = /DUSE_MBEDTLS /I"$(MBEDTLS_INC_DIR)"
192MBEDTLS_LIBS   = mbedtls.lib mbedcrypto.lib mbedx509.lib
193!ENDIF
194
195
196!IFDEF CARES_PATH
197CARES_INC_DIR  = $(CARES_PATH)\include
198CARES_LIB_DIR  = $(CARES_PATH)\lib
199CARES_LFLAGS   = $(CARES_LFLAGS) "/LIBPATH:$(CARES_LIB_DIR)"
200!ELSE
201CARES_INC_DIR  = $(DEVEL_INCLUDE)/cares
202CARES_LIB_DIR  = $(DEVEL_LIB)
203!ENDIF
204
205!IF "$(WITH_CARES)"=="dll"
206!IF "$(DEBUG)"=="yes"
207CARES_LIBS     = caresd.lib
208!ELSE
209CARES_LIBS     = cares.lib
210!ENDIF
211USE_CARES      = true
212CARES          = dll
213!ELSEIF "$(WITH_CARES)"=="static"
214!IF "$(DEBUG)"=="yes"
215CARES_LIBS     = libcaresd.lib
216!ELSE
217CARES_LIBS     = libcares.lib
218!ENDIF
219USE_CARES      = true
220CARES          = static
221!ENDIF
222
223!IFDEF USE_CARES
224CARES_CFLAGS   = /DUSE_ARES /I"$(CARES_INC_DIR)"
225!ENDIF
226
227
228!IFDEF ZLIB_PATH
229ZLIB_INC_DIR = $(ZLIB_PATH)\include
230ZLIB_LIB_DIR = $(ZLIB_PATH)\lib
231ZLIB_LFLAGS  = $(ZLIB_LFLAGS) "/LIBPATH:$(ZLIB_LIB_DIR)"
232!ELSE
233ZLIB_INC_DIR = $(DEVEL_INCLUDE)
234ZLIB_LIB_DIR = $(DEVEL_LIB)
235!ENDIF
236
237# Depending on how zlib is built the libraries have different names, we
238# try to handle them all.
239!IF "$(WITH_ZLIB)"=="dll"
240!IF EXISTS("$(ZLIB_LIB_DIR)\zlibwapi.lib")
241ZLIB_LIBS = zlibwapi.lib
242ADDITIONAL_ZLIB_CFLAGS = /DZLIB_WINAPI
243!ELSEIF EXISTS("$(ZLIB_LIB_DIR)\zdll.lib")
244ZLIB_LIBS   = zdll.lib
245!ELSE
246ZLIB_LIBS   = zlib.lib
247!ENDIF
248USE_ZLIB    = true
249ZLIB        = dll
250!ELSEIF "$(WITH_ZLIB)"=="static"
251!IF EXISTS("$(ZLIB_LIB_DIR)\zlibstat.lib")
252ZLIB_LIBS   = zlibstat.lib
253ADDITIONAL_ZLIB_CFLAGS = /DZLIB_WINAPI
254!ELSEIF EXISTS("$(ZLIB_LIB_DIR)\zlib.lib")
255ZLIB_LIBS   = zlib.lib
256!ELSE
257ZLIB_LIBS   = zlib_a.lib
258!ENDIF
259USE_ZLIB    = true
260ZLIB        = static
261!ENDIF
262
263!IFDEF USE_ZLIB
264ZLIB_CFLAGS = /DHAVE_ZLIB_H /DHAVE_ZLIB /DHAVE_LIBZ $(ADDITIONAL_ZLIB_CFLAGS) /I"$(ZLIB_INC_DIR)"
265!ENDIF
266
267
268!IFDEF SSH2_PATH
269SSH2_INC_DIR= $(SSH2_PATH)\include
270SSH2_LIB_DIR= $(SSH2_PATH)\lib
271SSH2_LFLAGS = $(SSH2_LFLAGS) "/LIBPATH:$(SSH2_LIB_DIR)"
272!ELSE
273SSH2_LIB_DIR= $(DEVEL_LIB)
274SSH2_INC_DIR= $(DEVEL_INCLUDE)/libssh2
275!ENDIF
276
277!IF "$(WITH_SSH2)"=="dll"
278SSH2_LIBS   = libssh2.lib
279USE_SSH2    = true
280SSH2        = dll
281!ELSEIF "$(WITH_SSH2)"=="static"
282# libssh2 NMakefile on Windows at default creates a static library without _a suffix
283!IF EXISTS("$(SSH2_LIB_DIR)\libssh2.lib")
284SSH2_LIBS   = libssh2.lib
285!ELSE
286SSH2_LIBS   = libssh2_a.lib
287!ENDIF
288WIN_LIBS     = $(WIN_LIBS) user32.lib
289USE_SSH2    = true
290SSH2        = static
291!ENDIF
292
293!IFDEF USE_SSH2
294SSH2_CFLAGS = /DHAVE_LIBSSH2 /DHAVE_LIBSSH2_H /DLIBSSH2_WIN32 /DLIBSSH2_LIBRARY /DUSE_LIBSSH2
295SSH2_CFLAGS = $(SSH2_CFLAGS) /I$(SSH2_INC_DIR)
296!ENDIF
297
298
299!IFNDEF USE_IDN
300USE_IDN   = true
301!ELSEIF "$(USE_IDN)"=="yes"
302USE_IDN   = true
303!ENDIF
304
305!IF "$(USE_IDN)"=="true"
306IDN_CFLAGS = $(IDN_CFLAGS) /DUSE_WIN32_IDN /DWANT_IDN_PROTOTYPES
307WIN_LIBS   = $(WIN_LIBS) Normaliz.lib
308!ENDIF
309
310
311!IFNDEF USE_IPV6
312USE_IPV6  = true
313!ELSEIF "$(USE_IPV6)"=="yes"
314USE_IPV6  = true
315!ENDIF
316
317!IF "$(USE_IPV6)"=="true"
318IPV6_CFLAGS = $(IPV6_CFLAGS) /DUSE_IPV6
319!ENDIF
320
321
322!IFNDEF USE_SSPI
323USE_SSPI  = true
324!ELSEIF "$(USE_SSPI)"=="yes"
325USE_SSPI  = true
326!ENDIF
327
328!IF "$(USE_SSPI)"=="true"
329SSPI_CFLAGS = $(SSPI_CFLAGS) /DUSE_WINDOWS_SSPI
330!ENDIF
331
332
333!IFNDEF USE_WINSSL
334!IF "$(USE_SSL)"=="true"
335USE_WINSSL  = false
336!ELSE
337USE_WINSSL  = $(USE_SSPI)
338!ENDIF
339!ELSEIF "$(USE_WINSSL)"=="yes"
340USE_WINSSL  = true
341!ENDIF
342
343
344!IF "$(USE_WINSSL)"=="true"
345!IF "$(USE_SSPI)"!="true"
346!ERROR cannot build with WinSSL without SSPI
347!ENDIF
348SSPI_CFLAGS = $(SSPI_CFLAGS) /DUSE_SCHANNEL
349WIN_LIBS    = $(WIN_LIBS) Crypt32.lib
350!ENDIF
351
352
353!IF "$(GEN_PDB)"=="yes"
354GEN_PDB = true
355!ENDIF
356
357
358!IFDEF EMBED_MANIFEST
359MANIFESTTOOL = $(MT) -manifest $(DIRDIST)\bin\$(PROGRAM_NAME).manifest -outputresource:$(DIRDIST)\bin\$(PROGRAM_NAME);1
360!ELSE
361CURL_RC_FLAGS = $(CURL_RC_FLAGS) /dCURL_EMBED_MANIFEST
362!ENDIF
363
364# Runtime library configuration
365!IF "$(RTLIBCFG)"=="static"
366RTLIB = /MT
367RTLIB_DEBUG = /MTd
368!ELSE
369RTLIB = /MD
370RTLIB_DEBUG  = /MDd
371!ENDIF
372
373!IF "$(MODE)"=="static"
374TARGET = $(LIB_NAME_STATIC)
375CURL_LIBCURL_LIBNAME=$(LIB_NAME_STATIC)
376AS_DLL = false
377CFGSET = true
378!ELSEIF "$(MODE)"=="dll"
379TARGET = $(LIB_NAME_DLL)
380CURL_LIBCURL_LIBNAME=$(LIB_NAME_IMP)
381AS_DLL = true
382CFGSET = true
383!ENDIF
384
385!IF "$(CFGSET)" == "FALSE"
386!ERROR please choose a valid mode
387!ENDIF
388
389
390
391# CURL_XX macros are for the curl.exe command
392
393!IF "$(DEBUG)"=="yes"
394RC_FLAGS = /dDEBUGBUILD=1 /Fo $@ $(LIBCURL_SRC_DIR)\libcurl.rc
395CURL_CC       = $(CC_DEBUG) $(RTLIB_DEBUG)
396CURL_RC_FLAGS = /i../include /dDEBUGBUILD=1 /Fo $@ $(CURL_SRC_DIR)\curl.rc
397!ELSE
398RC_FLAGS = /dDEBUGBUILD=0 /Fo $@ $(LIBCURL_SRC_DIR)\libcurl.rc
399CURL_CC       = $(CC_NODEBUG) $(RTLIB)
400CURL_RC_FLAGS = /i../include /dDEBUGBUILD=0 /Fo $@ $(CURL_SRC_DIR)\curl.rc
401!ENDIF
402
403!IF "$(AS_DLL)" == "true"
404
405LNK       = $(LNKDLL) $(LFLAGS) $(WIN_LIBS) /out:$(LIB_DIROBJ)\$(TARGET)
406!IF "$(DEBUG)"=="yes"
407TARGET    = $(LIB_NAME_DLL_DEBUG)
408LNK       = $(LNK) /DEBUG /IMPLIB:$(LIB_DIROBJ)\$(LIB_NAME_IMP_DEBUG)
409PDB       = $(PDB_NAME_DLL_DEBUG)
410CURL_LIBS = /IMPLIB:$(LIB_DIROBJ)\$(LIB_NAME_IMP_DEBUG)
411!ELSE
412TARGET    = $(LIB_NAME_DLL)
413LNK       = $(LNK)  /IMPLIB:$(LIB_DIROBJ)\$(LIB_NAME_IMP)
414PDB       = $(PDB_NAME_DLL)
415CURL_LIBS = /IMPLIB:$(LIB_DIROBJ)\$(LIB_NAME_IMP)
416!ENDIF
417RESOURCE  = $(LIB_DIROBJ)\libcurl.res
418
419# AS_DLL
420!ELSE
421
422!IF "$(DEBUG)"=="yes"
423TARGET   = $(LIB_NAME_STATIC_DEBUG)
424PDB      = $(PDB_NAME_STATIC_DEBUG)
425!ELSE
426TARGET   = $(LIB_NAME_STATIC)
427PDB      = $(PDB_NAME_STATIC)
428!ENDIF
429LNK      = $(LNKLIB) /out:$(LIB_DIROBJ)\$(TARGET)
430CURL_CC  = $(CURL_CC) $(CFLAGS_LIBCURL_STATIC)
431
432# AS_DLL
433!ENDIF
434
435!IF "$(USE_SSL)"=="true"
436CFLAGS = $(CFLAGS) $(SSL_CFLAGS)
437LFLAGS = $(LFLAGS) $(SSL_LFLAGS) $(SSL_LIBS)
438!ENDIF
439
440!IF "$(USE_MBEDTLS)"=="true"
441CFLAGS = $(CFLAGS) $(MBEDTLS_CFLAGS)
442LFLAGS = $(LFLAGS) $(MBEDTLS_LFLAGS) $(MBEDTLS_LIBS)
443!ENDIF
444
445!IF "$(USE_CARES)"=="true"
446CFLAGS = $(CFLAGS) $(CARES_CFLAGS)
447LFLAGS = $(LFLAGS) $(CARES_LFLAGS) $(CARES_LIBS)
448!ENDIF
449
450!IF "$(USE_ZLIB)"=="true"
451CFLAGS = $(CFLAGS) $(ZLIB_CFLAGS)
452LFLAGS = $(LFLAGS) $(ZLIB_LFLAGS) $(ZLIB_LIBS)
453!ENDIF
454
455!IF "$(USE_SSH2)"=="true"
456CFLAGS = $(CFLAGS) $(SSH2_CFLAGS)
457LFLAGS = $(LFLAGS) $(SSH2_LFLAGS) $(SSH2_LIBS)
458!ENDIF
459
460!IF "$(USE_IDN)"=="true"
461CFLAGS = $(CFLAGS) $(IDN_CFLAGS)
462!ENDIF
463
464!IF "$(USE_IPV6)"=="true"
465CFLAGS = $(CFLAGS) $(IPV6_CFLAGS)
466!ENDIF
467
468!IF "$(USE_SSPI)"=="true"
469CFLAGS = $(CFLAGS) $(SSPI_CFLAGS)
470!ENDIF
471
472!IF "$(USE_NGHTTP2)"=="true"
473CFLAGS = $(CFLAGS) $(NGHTTP2_CFLAGS)
474LFLAGS = $(LFLAGS) $(NGHTTP2_LFLAGS) $(NGHTTP2_LIBS)
475!ENDIF
476
477!IF "$(GEN_PDB)"=="true"
478CFLAGS = $(CFLAGS) $(CFLAGS_PDB) /Fd"$(LIB_DIROBJ)\$(PDB)"
479LFLAGS = $(LFLAGS) $(LFLAGS_PDB)
480!ENDIF
481
482LIB_DIROBJ = ..\builds\$(CONFIG_NAME_LIB)-obj-lib
483CURL_DIROBJ = ..\builds\$(CONFIG_NAME_LIB)-obj-curl
484DIRDIST = ..\builds\$(CONFIG_NAME_LIB)\
485
486#
487# curl.exe
488#
489CURL_LINK = link.exe /incremental:no /libpath:"$(DIRDIST)\lib"
490
491!IF "$(CFGSET)" != "FALSE"
492# A mode was provided, so the library can be built.
493#
494!include CURL_OBJS.inc
495!include LIBCURL_OBJS.inc
496
497!IF "$(AS_DLL)" == "true"
498LIB_OBJS = $(LIBCURL_OBJS) $(RESOURCE)
499!ELSE
500LIB_OBJS = $(LIBCURL_OBJS)
501!ENDIF
502
503EXE_OBJS = $(CURL_OBJS) $(CURL_DIROBJ)\curl.res
504
505all : $(TARGET) $(PROGRAM_NAME)
506
507package: $(TARGET)
508	@cd $(DIRDIST)
509	@-$(ZIP) -9 -q -r ..\$(CONFIG_NAME_LIB).zip .>nul 2<&1
510	@cd $(MAKEDIR)
511
512$(TARGET): $(LIB_OBJS) $(LIB_DIROBJ) $(DIRDIST)
513	@echo Using SSL: $(USE_SSL)
514	@echo Using NGHTTP2: $(USE_NGHTTP2)
515	@echo Using c-ares: $(USE_CARES)
516	@echo Using SSH2: $(USE_SSH2)
517	@echo Using ZLIB: $(USE_ZLIB)
518	@echo Using IDN:  $(USE_IDN)
519	@echo Using IPv6: $(USE_IPV6)
520	@echo Using SSPI: $(USE_SSPI)
521	@echo Using WinSSL: $(USE_WINSSL)
522	@echo CFLAGS:     $(CFLAGS)
523	@echo LFLAGS:     $(LFLAGS)
524	@echo GenPDB:     $(GEN_PDB)
525	@echo Debug:      $(DEBUG)
526	@echo Machine:    $(MACHINE)
527	$(LNK) $(LIB_OBJS)
528	@echo Copying libs...
529	@if exist $(LIB_DIROBJ)\$(LIB_NAME_DLL) copy $(LIB_DIROBJ)\$(LIB_NAME_DLL)       $(DIRDIST)\bin\ /y >nul 2<&1
530	@if exist $(LIB_DIROBJ)\$(LIB_NAME_STATIC) copy $(LIB_DIROBJ)\$(LIB_NAME_STATIC)    $(DIRDIST)\lib\ /y >nul 2<&1
531	@if exist $(LIB_DIROBJ)\$(LIB_NAME_DLL_DEBUG) copy $(LIB_DIROBJ)\$(LIB_NAME_DLL_DEBUG) $(DIRDIST)\bin\ /y >nul 2<&1
532	@if exist $(LIB_DIROBJ)\$(LIB_NAME_STATIC_DEBUG) copy $(LIB_DIROBJ)\$(LIB_NAME_STATIC_DEBUG) $(DIRDIST)\lib\ /y >nul 2<&1
533	@if exist $(LIB_DIROBJ)\$(LIB_NAME_IMP) copy $(LIB_DIROBJ)\$(LIB_NAME_IMP)       $(DIRDIST)\lib\ /y >nul 2<&1
534	@if exist $(LIB_DIROBJ)\$(LIB_NAME_IMP_DEBUG) copy $(LIB_DIROBJ)\$(LIB_NAME_IMP_DEBUG) $(DIRDIST)\lib >nul 2<&1
535	@-copy $(LIB_DIROBJ)\*.exp                 $(DIRDIST)\lib /y >nul 2<&1
536	@-copy $(LIB_DIROBJ)\*.pdb                 $(DIRDIST)\lib /y >nul 2<&1
537	@-copy ..\include\curl\*.h   $(DIRDIST)\include\curl\ /y  >nul 2<&1
538
539$(LIB_OBJS): $(LIB_DIROBJ) $(DIRDIST)
540
541$(DIRDIST):
542	@if not exist "$(DIRDIST)\bin" mkdir $(DIRDIST)\bin
543	@if not exist "$(DIRDIST)\include" mkdir $(DIRDIST)\include
544	@if not exist "$(DIRDIST)\include\curl" mkdir $(DIRDIST)\include\curl
545	@if not exist "$(DIRDIST)\lib" mkdir $(DIRDIST)\lib
546
547$(LIB_DIROBJ):
548	@if not exist "$(LIB_DIROBJ)" mkdir $(LIB_DIROBJ)
549	@if not exist "$(LIB_DIROBJ)\vauth" mkdir $(LIB_DIROBJ)\vauth
550	@if not exist "$(LIB_DIROBJ)\vtls" mkdir $(LIB_DIROBJ)\vtls
551
552$(CURL_DIROBJ):
553	@if not exist "$(CURL_DIROBJ)" mkdir $(CURL_DIROBJ)
554# we need a lib dir for the portability functions from libcurl
555# we use the .c directly here
556	@if not exist "$(CURL_DIROBJ)" mkdir $(CURL_DIROBJ)\lib
557
558.SUFFIXES: .c .obj .res
559
560{$(LIBCURL_SRC_DIR)\}.c{$(LIB_DIROBJ)\}.obj:
561	$(CURL_CC) $(CFLAGS) /Fo"$@"  $<
562
563{$(LIBCURL_SRC_DIR)\vauth\}.c{$(LIB_DIROBJ)\vauth\}.obj:
564	$(CURL_CC) $(CFLAGS) /Fo"$@"  $<
565
566{$(LIBCURL_SRC_DIR)\vtls\}.c{$(LIB_DIROBJ)\vtls\}.obj:
567	$(CURL_CC) $(CFLAGS) /Fo"$@"  $<
568
569$(LIB_DIROBJ)\libcurl.res: $(LIBCURL_SRC_DIR)\libcurl.rc
570	$(RC) $(RC_FLAGS)
571
572#
573# curl.exe
574#
575
576
577!IF "$(MODE)"=="static"
578!IF "$(DEBUG)"=="yes"
579CURL_LIBCURL_LIBNAME=$(LIB_NAME_STATIC_DEBUG)
580!ELSE
581CURL_LIBCURL_LIBNAME=$(LIB_NAME_STATIC)
582!ENDIF
583!ELSEIF "$(MODE)"=="dll"
584!IF "$(DEBUG)"=="yes"
585CURL_LIBCURL_LIBNAME=$(LIB_NAME_IMP_DEBUG)
586!ELSE
587CURL_LIBCURL_LIBNAME=$(LIB_NAME_IMP)
588!ENDIF
589!ENDIF
590
591CURL_FROM_LIBCURL=$(CURL_DIROBJ)\tool_hugehelp.obj \
592 $(CURL_DIROBJ)\nonblock.obj \
593 $(CURL_DIROBJ)\strtoofft.obj \
594 $(CURL_DIROBJ)\warnless.obj \
595 $(CURL_DIROBJ)\curl_ctype.obj
596
597$(PROGRAM_NAME): $(CURL_DIROBJ) $(CURL_FROM_LIBCURL) $(EXE_OBJS)
598	$(CURL_LINK) $(CURL_LFLAGS) $(CURL_LIBCURL_LIBNAME) $(WIN_LIBS) $(CURL_FROM_LIBCURL) $(EXE_OBJS)
599	$(MANIFESTTOOL)
600
601{$(CURL_SRC_DIR)\}.c{$(CURL_DIROBJ)\}.obj:
602	$(CURL_CC) $(CURL_CFLAGS) /Fo"$@"  $<
603
604$(CURL_DIROBJ)\tool_hugehelp.obj: $(CURL_SRC_DIR)\tool_hugehelp.c
605	$(CURL_CC) $(CURL_CFLAGS) /Zm200 /Fo"$@" $(CURL_SRC_DIR)\tool_hugehelp.c
606$(CURL_DIROBJ)\nonblock.obj: ../lib/nonblock.c
607	$(CURL_CC) $(CURL_CFLAGS) /Fo"$@" ../lib/nonblock.c
608$(CURL_DIROBJ)\strtoofft.obj: ../lib/strtoofft.c
609	$(CURL_CC) $(CURL_CFLAGS) /Fo"$@" ../lib/strtoofft.c
610$(CURL_DIROBJ)\warnless.obj: ../lib/warnless.c
611	$(CURL_CC) $(CURL_CFLAGS) /Fo"$@" ../lib/warnless.c
612$(CURL_DIROBJ)\curl_ctype.obj: ../lib/curl_ctype.c
613	$(CURL_CC) $(CURL_CFLAGS) /Fo"$@" ../lib/curl_ctype.c
614$(CURL_DIROBJ)\curl.res: $(CURL_SRC_DIR)\curl.rc
615	rc $(CURL_RC_FLAGS)
616
617!ENDIF  # End of case where a config was provided.
618
619clean:
620	@-erase /s *.dll 2> NUL
621	@-erase /s *.exp 2> NUL
622	@-erase /s *.idb 2> NUL
623	@-erase /s *.lib 2> NUL
624	@-erase /s *.obj 2> NUL
625	@-erase /s *.pch 2> NUL
626	@-erase /s *.pdb 2> NUL
627	@-erase /s *.res 2> NUL
628	@if exist $(LIB_DIROBJ) rd /s/q $(LIB_DIROBJ)
629	@if exist $(CURL_DIROBJ)rd /s/q $(CURL_DIROBJ)
630	@if exist $(DIRDIST) rd /s/q $(DIRDIST)
631