1 #############################################################
2 # $Id: Makefile.vc6,v 1.1.1.1 2008-09-23 16:32:05 hoffman Exp $
4 # Makefile for building libcurl with MSVC6
6 # Usage: see usage message below
7 # Should be invoked from \lib directory
8 # Edit the paths and desired library name
9 # SSL path is only required if you intend compiling
12 # This make file leaves the result either a .lib or .dll file
13 # in the \lib directory. It should be called from the \lib
16 # An option would have been to allow the source directory to
17 # be specified, but I saw no requirement.
19 # Another option would have been to leave the .lib and .dll
20 # files in the "cfg" directory, but then the make file
21 # in \src would need to be changed.
23 ##############################################################
26 # Stem for static libs and DLLs
29 LIB_NAME_DEBUG = libcurld
32 # Stem for DLL import libs
34 IMPLIB_NAME = libcurl_imp
35 IMPLIB_NAME_DEBUG = libcurld_imp
38 OPENSSL_PATH = ../../openssl-0.9.8g
42 ZLIB_PATH = ../../zlib-1.2.3
49 # USE_WINDOWS_SSPI uses windows libraries to allow NTLM authentication
50 # without an openssl installation and offers the ability to authenticate
51 # using the "current logged in user". Since at least with MSVC6 the sspi.h
52 # header is broken it is either required to install the Windows SDK,
53 # or to fix sspi.h with adding this define at the beginning of sspi.h:
54 # #define FreeCredentialHandle FreeCredentialsHandle
56 # If, for some reason the Windows SDK is installed but not installed
57 # in the default location, you can specify WINDOWS_SDK_PATH.
58 # It can be downloaded from:
59 # http://www.microsoft.com/msdownload/platformsdk/sdkupdate/
64 !IFNDEF WINDOWS_SDK_PATH
65 WINDOWS_SDK_PATH = "C:\Program Files\Microsoft SDK"
69 #############################################################
70 ## Nothing more to do below this line!
72 CCNODBG = cl.exe /O2 /DNDEBUG
73 CCDEBUG = cl.exe /Od /Gm /Zi /D_DEBUG /GZ
74 CFLAGSSSL = /DUSE_SSLEAY /I "$(OPENSSL_PATH)/inc32" /I "$(OPENSSL_PATH)/inc32/openssl"
75 CFLAGSZLIB = /DHAVE_ZLIB_H /DHAVE_ZLIB /DHAVE_LIBZ /I "$(ZLIB_PATH)"
76 CFLAGS = /I. /I../include /nologo /W3 /GX /DWIN32 /YX /FD /c /DBUILDING_LIBCURL
77 CFLAGSLIB = /DCURL_STATICLIB
78 LNKDLL = link.exe /DLL
79 LNKLIB = link.exe /lib
80 LFLAGS = /nologo /machine:$(MACHINE)
81 SSLLIBS = libeay32.lib ssleay32.lib
84 WINLIBS = wsock32.lib wldap32.lib
90 CFLAGS = $(CFLAGS) /DUSE_WINDOWS_SSPI /I$(WINDOWS_SDK_PATH)\include
93 ##############################################################
94 # Runtime library configuration
99 !IF "$(RTLIBCFG)" == "static"
105 ######################
108 !IF "$(CFG)" == "release"
109 TARGET = $(LIB_NAME).lib
111 LNK = $(LNKLIB) /out:$(DIROBJ)\$(TARGET)
112 CC = $(CCNODBG) $(RTLIB) $(CFLAGSLIB)
116 ######################
119 !IF "$(CFG)" == "release-zlib"
120 TARGET = $(LIB_NAME).lib
122 LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)"
123 LNK = $(LNKLIB) $(ZLIBLIBS) $(LFLAGSZLIB) /out:$(DIROBJ)\$(TARGET)
124 CC = $(CCNODBG) $(RTLIB) $(CFLAGSZLIB) $(CFLAGSLIB)
128 ######################
131 !IF "$(CFG)" == "release-dll"
132 TARGET = $(LIB_NAME).dll
134 LNK = $(LNKDLL) $(WINLIBS) /out:$(DIROBJ)\$(TARGET) /IMPLIB:$(DIROBJ)\$(IMPLIB_NAME).lib
135 CC = $(CCNODBG) $(RTLIB)
137 RESOURCE = $(DIROBJ)\libcurl.res
140 ######################
143 !IF "$(CFG)" == "release-ssl"
144 TARGET = $(LIB_NAME).lib
146 LFLAGSSSL = "/LIBPATH:$(OPENSSL_PATH)\out32"
147 LNK = $(LNKLIB) $(LFLAGSSSL) /out:$(DIROBJ)\$(TARGET)
148 CC = $(CCNODBG) $(RTLIB) $(CFLAGSSSL) $(CFLAGSLIB)
152 ######################
155 !IF "$(CFG)" == "release-ssl-dll"
156 TARGET = $(LIB_NAME).lib
158 LFLAGSSSL = "/LIBPATH:$(OPENSSL_PATH)\out32dll"
159 LNK = $(LNKLIB) $(WINLIBS) $(SSLLIBS) $(LFLAGSSSL) /out:$(DIROBJ)\$(TARGET)
160 CC = $(CCNODBG) $(RTLIB) $(CFLAGSSSL) $(CFLAGSLIB)
164 ######################
167 !IF "$(CFG)" == "release-ssl-zlib"
168 TARGET = $(LIB_NAME).lib
170 LFLAGSSSL = "/LIBPATH:$(OPENSSL_PATH)\out32"
171 LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)"
172 LNK = $(LNKLIB) $(LFLAGSSSL) $(LFLAGSZLIB) /out:$(DIROBJ)\$(TARGET)
173 CC = $(CCNODBG) $(RTLIB) $(CFLAGSSSL) $(CFLAGSZLIB) $(CFLAGSLIB)
177 ######################
178 # release-dll-ssl-dll
180 !IF "$(CFG)" == "release-dll-ssl-dll"
181 TARGET = $(LIB_NAME).dll
183 LFLAGSSSL = "/LIBPATH:$(OPENSSL_PATH)\out32dll"
184 LNK = $(LNKDLL) $(WINLIBS) $(SSLLIBS) $(LFLAGSSSL) /out:$(DIROBJ)\$(TARGET) /IMPLIB:$(DIROBJ)\$(IMPLIB_NAME).lib
185 CC = $(CCNODBG) $(RTLIB) $(CFLAGSSSL)
187 RESOURCE = $(DIROBJ)\libcurl.res
190 ######################
193 !IF "$(CFG)" == "release-zlib-dll"
194 TARGET = $(LIB_NAME).lib
196 LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)"
197 LNK = $(LNKLIB) $(WINLIBS) $(ZLIBLIBSDLL) $(LFLAGSZLIB) /out:$(DIROBJ)\$(TARGET)
198 CC = $(CCNODBG) $(RTLIB) $(CFLAGSZLIB) $(CFLAGSLIB)
202 ######################
203 # release-ssl-dll-zlib-dll
205 !IF "$(CFG)" == "release-ssl-dll-zlib-dll"
206 TARGET = $(LIB_NAME).lib
208 LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)"
209 LFLAGSSSL = "/LIBPATH:$(OPENSSL_PATH)\out32dll"
210 LNK = $(LNKLIB) $(WINLIBS) $(SSLLIBS) $(ZLIBLIBSDLL) $(LFLAGSSSL) $(LFLAGSZLIB) /out:$(DIROBJ)\$(TARGET)
211 CC = $(CCNODBG) $(RTLIB) $(CFLAGSSSL) $(CFLAGSZLIB) $(CFLAGSLIB)
215 ######################
216 # release-dll-zlib-dll
218 !IF "$(CFG)" == "release-dll-zlib-dll"
219 TARGET = $(LIB_NAME).dll
221 LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)"
222 LNK = $(LNKDLL) $(WINLIBS) $(ZLIBLIBSDLL) $(LFLAGSZLIB) /out:$(DIROBJ)\$(TARGET) /IMPLIB:$(DIROBJ)\$(IMPLIB_NAME).lib
223 CC = $(CCNODBG) $(RTLIB) $(CFLAGSZLIB)
225 RESOURCE = $(DIROBJ)\libcurl.res
228 ######################
229 # release-dll-ssl-dll-zlib-dll
231 !IF "$(CFG)" == "release-dll-ssl-dll-zlib-dll"
232 TARGET = $(LIB_NAME).dll
234 LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)"
235 LFLAGSSSL = "/LIBPATH:$(OPENSSL_PATH)\out32dll"
236 LNK = $(LNKDLL) $(WINLIBS) $(SSLLIBS) $(ZLIBLIBSDLL) $(LFLAGSSSL) $(LFLAGSZLIB) /out:$(DIROBJ)\$(TARGET) /IMPLIB:$(DIROBJ)\$(IMPLIB_NAME).lib
237 CC = $(CCNODBG) $(RTLIB) $(CFLAGSSSL) $(CFLAGSZLIB)
239 RESOURCE = $(DIROBJ)\libcurl.res
242 ######################
245 !IF "$(CFG)" == "debug"
246 TARGET = $(LIB_NAME_DEBUG).lib
248 LNK = $(LNKLIB) /out:$(DIROBJ)\$(TARGET)
249 CC = $(CCDEBUG) $(RTLIBD) $(CFLAGSLIB)
253 ######################
256 !IF "$(CFG)" == "debug-ssl"
257 TARGET = $(LIB_NAME_DEBUG).lib
259 LFLAGSSSL = "/LIBPATH:$(OPENSSL_PATH)\out32"
260 LNK = $(LNKLIB) $(LFLAGSSSL) /out:$(DIROBJ)\$(TARGET)
261 CC = $(CCDEBUG) $(RTLIBD) $(CFLAGSSSL) $(CFLAGSLIB)
265 ######################
268 !IF "$(CFG)" == "debug-zlib"
269 TARGET = $(LIB_NAME_DEBUG).lib
271 LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)"
272 LNK = $(LNKLIB) $(ZLIBLIBS) $(LFLAGSZLIB) /out:$(DIROBJ)\$(TARGET)
273 CC = $(CCDEBUG) $(RTLIBD) $(CFLAGSZLIB) $(CFLAGSLIB)
277 ######################
280 !IF "$(CFG)" == "debug-ssl-dll"
281 TARGET = $(LIB_NAME_DEBUG).lib
283 LFLAGSSSL = /LIBPATH:$(OPENSSL_PATH)\out32dll
284 LNK = $(LNKLIB) $(WINLIBS) $(SSLLIBS) $(LFLAGSSSL) /out:$(DIROBJ)\$(TARGET)
285 CC = $(CCDEBUG) $(RTLIBD) $(CFLAGSSSL) $(CFLAGSLIB)
289 ######################
292 !IF "$(CFG)" == "debug-ssl-zlib"
293 TARGET = $(LIB_NAME_DEBUG).lib
295 LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)"
296 LFLAGSSSL = "/LIBPATH:$(OPENSSL_PATH)\out32"
297 LNK = $(LNKLIB) $(ZLIBLIBS) $(LFLAGSSSL) $(LFLAGSZLIB) /out:$(DIROBJ)\$(TARGET)
298 CC = $(CCDEBUG) $(RTLIBD) $(CFLAGSSSL) $(CFLAGSZLIB) $(CFLAGSLIB)
302 ######################
305 !IF "$(CFG)" == "debug-zlib-dll"
306 TARGET = $(LIB_NAME_DEBUG).lib
308 LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)"
309 LNK = $(LNKLIB) $(WINLIBS) $(ZLIBLIBSDLL) $(LFLAGSZLIB) /out:$(DIROBJ)\$(TARGET)
310 CC = $(CCDEBUG) $(RTLIBD) $(CFLAGSZLIB) $(CFLAGSLIB)
314 ######################
315 # debug-ssl-dll-zlib-dll
317 !IF "$(CFG)" == "debug-ssl-dll-zlib-dll"
318 TARGET = $(LIB_NAME_DEBUG).lib
320 LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)"
321 LFLAGSSSL = "/LIBPATH:$(OPENSSL_PATH)\out32dll"
322 LNK = $(LNKLIB) $(WINLIBS) $(SSLLIBS) $(ZLIBLIBSDLL) $(LFLAGSSSL) $(LFLAGSZLIB) /out:$(DIROBJ)\$(TARGET)
323 CC = $(CCDEBUG) $(RTLIBD) $(CFLAGSSSL) $(CFLAGSZLIB) $(CFLAGSLIB)
327 ######################
330 !IF "$(CFG)" == "debug-dll"
331 TARGET = $(LIB_NAME_DEBUG).dll
333 LNK = $(LNKDLL) $(WINLIBS) /DEBUG /out:$(DIROBJ)\$(TARGET) /IMPLIB:$(DIROBJ)\$(IMPLIB_NAME_DEBUG).lib /PDB:$(DIROBJ)\$(IMPLIB_NAME_DEBUG).pdb
334 CC = $(CCDEBUG) $(RTLIBD)
336 RESOURCE = $(DIROBJ)\libcurl.res
339 ######################
342 !IF "$(CFG)" == "debug-dll-ssl-dll"
343 TARGET = $(LIB_NAME_DEBUG).dll
345 LFLAGSSSL = "/LIBPATH:$(OPENSSL_PATH)\out32dll"
346 LNK = $(LNKDLL) $(WINLIBS) $(SSLLIBS) $(LFLAGSSSL) /DEBUG /out:$(DIROBJ)\$(TARGET) /IMPLIB:$(DIROBJ)\$(IMPLIB_NAME_DEBUG).lib /PDB:$(DIROBJ)\$(IMPLIB_NAME_DEBUG).pdb
347 CC = $(CCDEBUG) $(RTLIBD) $(CFLAGSSSL)
349 RESOURCE = $(DIROBJ)\libcurl.res
352 ######################
355 !IF "$(CFG)" == "debug-dll-zlib-dll"
356 TARGET = $(LIB_NAME_DEBUG).dll
358 LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)"
359 LNK = $(LNKDLL) $(WINLIBS) $(ZLIBLIBSDLL) $(LFLAGSZLIB) /DEBUG /out:$(DIROBJ)\$(TARGET) /IMPLIB:$(DIROBJ)\$(IMPLIB_NAME_DEBUG).lib /PDB:$(DIROBJ)\$(IMPLIB_NAME_DEBUG).pdb
360 CC = $(CCDEBUG) $(RTLIBD) $(CFLAGSZLIB)
362 RESOURCE = $(DIROBJ)\libcurl.res
365 ######################
366 # debug-dll-ssl-dll-zlib-dll
368 !IF "$(CFG)" == "debug-dll-ssl-dll-zlib-dll"
369 TARGET = $(LIB_NAME_DEBUG).dll
371 LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)"
372 LFLAGSSSL = "/LIBPATH:$(OPENSSL_PATH)\out32dll"
373 LNK = $(LNKDLL) $(WINLIBS) $(SSLLIBS) $(ZLIBLIBSDLL) $(LFLAGSSSL) $(LFLAGSZLIB) /DEBUG /out:$(DIROBJ)\$(TARGET) /IMPLIB:$(DIROBJ)\$(IMPLIB_NAME_DEBUG).lib /PDB:$(DIROBJ)\$(IMPLIB_NAME_DEBUG).pdb
374 CC = $(CCDEBUG) $(RTLIBD) $(CFLAGSSSL) $(CFLAGSZLIB)
376 RESOURCE = $(DIROBJ)\libcurl.res
379 #######################
382 !IF "$(CFGSET)" == "FALSE" && "$(CFG)" != ""
383 !MESSAGE Usage: nmake /f makefile.vc6 CFG=<config> <target>
384 !MESSAGE where <config> is one of:
385 !MESSAGE release - release static library
386 !MESSAGE release-ssl - release static library with ssl
387 !MESSAGE release-zlib - release static library with zlib
388 !MESSAGE release-ssl-zlib - release static library with ssl and zlib
389 !MESSAGE release-ssl-dll - release static library with dynamic ssl
390 !MESSAGE release-zlib-dll - release static library with dynamic zlib
391 !MESSAGE release-ssl-dll-zlib-dll - release static library with dynamic ssl and dynamic zlib
392 !MESSAGE release-dll - release dynamic library
393 !MESSAGE release-dll-ssl-dll - release dynamic library with dynamic ssl
394 !MESSAGE release-dll-zlib-dll - release dynamic library with dynamic zlib
395 !MESSAGE release-dll-ssl-dll-zlib-dll - release dynamic library with dynamic ssl and dynamic zlib
396 !MESSAGE debug - debug static library
397 !MESSAGE debug-ssl - debug static library with ssl
398 !MESSAGE debug-zlib - debug static library with zlib
399 !MESSAGE debug-ssl-zlib - debug static library with ssl and zlib
400 !MESSAGE debug-ssl-dll - debug static library with dynamic ssl
401 !MESSAGE debug-zlib-dll - debug static library with dynamic zlib
402 !MESSAGE debug-ssl-dll-zlib-dll - debug static library with dynamic ssl and dynamic zlib
403 !MESSAGE debug-dll - debug dynamic library
404 !MESSAGE debug-dll-ssl-dll - debug dynamic library with dynamic ssl
405 !MESSAGE debug-dll-zlib-dll - debug dynamic library with dynamic zlib1
406 !MESSAGE debug-dll-ssl-dll-zlib-dll - debug dynamic library with dynamic ssl and dynamic zlib
407 !MESSAGE <target> can be left blank in which case all is assumed
408 !ERROR please choose a valid configuration "$(CFG)"
411 #######################
412 # Only the clean target can be used if a config was not provided.
414 !IF "$(CFGSET)" == "FALSE"
416 @-erase /s *.dll 2> NUL
417 @-erase /s *.exp 2> NUL
418 @-erase /s *.idb 2> NUL
419 @-erase /s *.lib 2> NUL
420 @-erase /s *.obj 2> NUL
421 @-erase /s *.pch 2> NUL
422 @-erase /s *.pdb 2> NUL
423 @-erase /s *.res 2> NUL
425 # A config was provided, so the library can be built.
428 $(DIROBJ)\base64.obj \
429 $(DIROBJ)\cookie.obj \
430 $(DIROBJ)\transfer.obj \
431 $(DIROBJ)\escape.obj \
432 $(DIROBJ)\formdata.obj \
435 $(DIROBJ)\http_chunks.obj \
438 $(DIROBJ)\telnet.obj \
439 $(DIROBJ)\parsedate.obj \
440 $(DIROBJ)\getenv.obj \
442 $(DIROBJ)\inet_pton.obj \
443 $(DIROBJ)\hostip.obj \
444 $(DIROBJ)\hostasyn.obj \
445 $(DIROBJ)\hostsyn.obj \
446 $(DIROBJ)\hostares.obj \
447 $(DIROBJ)\hostthre.obj \
448 $(DIROBJ)\hostip4.obj \
449 $(DIROBJ)\hostip6.obj \
450 $(DIROBJ)\inet_ntop.obj \
451 $(DIROBJ)\if2ip.obj \
452 $(DIROBJ)\mprintf.obj \
453 $(DIROBJ)\netrc.obj \
454 $(DIROBJ)\progress.obj \
455 $(DIROBJ)\sendf.obj \
456 $(DIROBJ)\speedcheck.obj \
457 $(DIROBJ)\sslgen.obj \
458 $(DIROBJ)\ssluse.obj \
459 $(DIROBJ)\timeval.obj \
462 $(DIROBJ)\getinfo.obj \
463 $(DIROBJ)\version.obj \
465 $(DIROBJ)\strequal.obj \
466 $(DIROBJ)\strtok.obj \
467 $(DIROBJ)\strtoofft.obj \
468 $(DIROBJ)\connect.obj \
470 $(DIROBJ)\llist.obj \
471 $(DIROBJ)\share.obj \
472 $(DIROBJ)\multi.obj \
473 $(DIROBJ)\http_digest.obj \
474 $(DIROBJ)\http_negotiate.obj \
475 $(DIROBJ)\http_ntlm.obj \
477 $(DIROBJ)\memdebug.obj \
478 $(DIROBJ)\strerror.obj \
479 $(DIROBJ)\select.obj \
480 $(DIROBJ)\content_encoding.obj \
482 $(DIROBJ)\splay.obj \
483 $(DIROBJ)\socks.obj \
489 $(LNK) $(LFLAGS) $(X_OBJS)
490 -xcopy $(DIROBJ)\$(LIB_NAME).dll . /y
491 -xcopy $(DIROBJ)\$(LIB_NAME).lib . /y
492 -xcopy $(DIROBJ)\$(LIB_NAME_DEBUG).dll . /y
493 -xcopy $(DIROBJ)\$(LIB_NAME_DEBUG).lib . /y
494 -xcopy $(DIROBJ)\$(IMPLIB_NAME).lib . /y
495 -xcopy $(DIROBJ)\$(IMPLIB_NAME_DEBUG).lib . /y
496 -xcopy $(DIROBJ)\*.exp . /y
497 -xcopy $(DIROBJ)\*.pdb . /y
502 @if not exist "$(DIROBJ)" mkdir $(DIROBJ)
504 .SUFFIXES: .c .obj .res
506 {.\}.c{$(DIROBJ)\}.obj:
507 $(CC) $(CFLAGS) /Fo"$@" $<
509 debug-dll\libcurl.res \
510 debug-dll-ssl-dll\libcurl.res \
511 debug-dll-zlib-dll\libcurl.res \
512 debug-dll-ssl-dll-zlib-dll\libcurl.res: libcurl.rc
513 rc /dCURLDEBUG=1 /Fo $@ libcurl.rc
515 release-dll\libcurl.res \
516 release-dll-ssl-dll\libcurl.res \
517 release-dll-zlib-dll\libcurl.res \
518 release-dll-ssl-dll-zlib-dll\libcurl.res: libcurl.rc
519 rc /dCURLDEBUG=0 /Fo $@ libcurl.rc
520 !ENDIF # End of case where a config was provided.