Hi,

The attached patch slightly improve the VC Makefile (it should not
have any functional change for existing options):

- Support for installed libraries and their development files instead
of using their source tree (subject to change and not necessary
correct)

- Support for SSH2 (release-ssh2-ssl-dll-zlib for now, will add other later)

- custom name for generated curl libraries or for the input libraries
  - we use a standard naming for our builds:
   . <libname>.lib for DLL import lib
   . <libname>_a.lib for static lib
   . <libname>_a_debug.lib for debug static lib
   . <libname>_debug.lib for debug DLL import lib

- Make USE_IPV6 a makefile argument


The existing way of calling these makefiles should still work. However
a call like:

nmake /f Makefile.vc9 WINDOWS_SSPI=1 USE_IPV6=1
WITH_DEVEL=g:\php-sdk\lib_builds\vc9\x86\deps
CFG=release-ssh2-ssl-dll-zlib

is now possible as well. Where WITH_DEVEL is the equivalent of a
/usr/local/include /lib /bin.

I would also like to make a slightly larger change, to use !include to
import VC specific flags definition instead of having to use sed/msys'
make to do it. Any comment or objection, both on this patch and the
next one?

-- 
Pierre

@pierrejoye | http://blog.thepimp.net | http://www.libgd.org
diff --git a/lib/Makefile.vc6 b/lib/Makefile.vc6
index 2e18e14..e026d18 100644
--- a/lib/Makefile.vc6
+++ b/lib/Makefile.vc6
@@ -44,15 +44,24 @@
 #
 # Stem for static libs and DLLs
 #
+!IFNDEF LIB_NAME
 LIB_NAME       = libcurl
-LIB_NAME_DEBUG = libcurld
+!IFNDEF LIB_NAME_DEBUG
+LIB_NAME_DEBUG = $(LIB_NAME)d
+!ENDIF
+!ENDIF
 
 #
 # Stem for DLL import libs
 #
-IMPLIB_NAME       = libcurl_imp
-IMPLIB_NAME_DEBUG = libcurld_imp
+!IFNDEF IMPLIB_NAME
+IMPLIB_NAME       = $(LIB_NAME)_imp
+!IFNDEF IMPLIB_NAME_DEBUG
+IMPLIB_NAME_DEBUG = $(LIB_NAME_DEBUG)_imp
+!ENDIF
+!ENDIF
 
+!IFDEF WITH_DEVEL
 !IFNDEF OPENSSL_PATH
 OPENSSL_PATH   = ../../openssl-0.9.8o
 !ENDIF
@@ -61,6 +70,7 @@ OPENSSL_PATH   = ../../openssl-0.9.8o
 ZLIB_PATH  = ../../zlib-1.2.5
 !ENDIF
 
+!ENDIF
 !IFNDEF MACHINE
 MACHINE  = X86
 !ENDIF
@@ -87,21 +97,47 @@ WINDOWS_SDK_PATH = "C:\Program Files\Microsoft SDK"
 
 #############################################################
 ## Nothing more to do below this line!
-
 CCNODBG    = cl.exe /O2 /DNDEBUG
 CCDEBUG    = cl.exe /Od /Gm /Zi /D_DEBUG /GZ
-CFLAGSSSL  = /DUSE_SSLEAY /I "$(OPENSSL_PATH)/inc32" /I 
"$(OPENSSL_PATH)/inc32/openssl"
-CFLAGSZLIB = /DHAVE_ZLIB_H /DHAVE_ZLIB /DHAVE_LIBZ /I "$(ZLIB_PATH)"
-CFLAGS     = /I. /I../include /nologo /W3 /GX /DWIN32 /YX /FD /c 
/DBUILDING_LIBCURL
-CFLAGSLIB  = /DCURL_STATICLIB
+LFLAGS     = /nologo /machine:$(MACHINE)
 LNKDLL     = link.exe /DLL
 LNKLIB     = link.exe /lib
-LFLAGS     = /nologo /machine:$(MACHINE)
+
+CFLAGSLIB  = /DCURL_STATICLIB
+CFLAGS     = /I. /I../include /nologo /W3 /GX /DWIN32 /YX /FD /c 
/DBUILDING_LIBCURL
+
+CFLAGSZLIB = /DHAVE_ZLIB_H /DHAVE_ZLIB /DHAVE_LIBZ
+
+CFLAGSSSH   = /DHAVE_LIBSSH2 /DHAVE_LIBSSH2_H /DLIBSSH2_WIN32 
/DLIBSSH2_LIBRARY /DUSE_LIBSSH2
 SSLLIBS    = libeay32.lib ssleay32.lib
+
+WINLIBS    = ws2_32.lib wldap32.lib
+
+!IFDEF WITH_DEVEL
+# we only need one lib/include path, ingore the LFLAG<libname>
+LFLAGS=$(LFLAGS) "/LIBPATH:$(WITH_DEVEL)\lib"
+CFLAGS=$(CFLAGS) /I "$(WITH_DEVEL)\include"
+
+# curl uses non standard include path, w/o openssl prefix
+CFLAGSSSL  = /DUSE_SSLEAY /I "$(WITH_DEVEL)\include\openssl"
+
+ZLIBLIBSDLL= zlib.lib
+ZLIBLIBS   = zlib_a.lib
+
+SSH2LIBSDLL = libssh2.lib
+SSH2LIBS    = libssh2_a.lib
+
+CFLAGSSH=/I$(WITH_DEVEL)/include/libssh2
+
+!ELSE
+LFLAGSSSL = "/LIBPATH:$(OPENSSL_PATH)\lib"
+CFLAGSSSL  = /DUSE_SSLEAY /I "$(OPENSSL_PATH)/inc32" /I 
"$(OPENSSL_PATH)/inc32/openssl"
+
+LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)"
+CFLAGSZLIB = $(CFLAGSZLIB) /I "$(ZLIB_PATH)"
 ZLIBLIBSDLL= zdll.lib
 ZLIBLIBS   = zlib.lib
-WINLIBS    = ws2_32.lib wldap32.lib
-CFLAGS     = $(CFLAGS)
+!ENDIF
 
 CFGSET     = FALSE
 
@@ -124,7 +160,6 @@ RTLIB  = /MT
 RTLIBD = /MTd
 !ENDIF
 
-
 ######################
 # release
 
@@ -262,6 +297,18 @@ CFGSET   = TRUE
 RESOURCE = $(DIROBJ)\libcurl.res
 !ENDIF
 
+
+######################
+# release-ssh2-ssl-dll-zlib
+
+!IF "$(CFG)" == "release-ssh2-ssl-dll-zlib"
+TARGET   = $(LIB_NAME).lib
+DIROBJ   = $(CFG)
+LNK      = $(LNKLIB) $(WINLIBS) $(SSLLIBS) $(ZLIBLIBS)  $(SSH2LIBS) 
$(LFLAGSSSL) $(LFLAGSZLIB) $(LFLAGSSSH) /out:$(DIROBJ)\$(TARGET)
+CC       = $(CCNODBG) $(RTLIB) $(CFLAGSSSL) $(CFLAGSZLIB) $(CFLAGSLIB)  
$(CFLAGSSSH2)
+CFGSET   = TRUE
+!ENDIF
+
 ######################
 # debug
 
@@ -402,7 +449,7 @@ RESOURCE = $(DIROBJ)\libcurl.res
 #######################
 # Usage
 #
-!IF "$(CFGSET)" == "FALSE" && "$(CFG)" != ""
+!IF ("$(CFGSET)" == "FALSE" && "$(CFG)" != "") || "$(CFG)"== ""
 !MESSAGE Usage: nmake /f makefile.vc6 CFG=<config> <target>
 !MESSAGE where <config> is one of:
 !MESSAGE   release                      - release static library
@@ -416,6 +463,7 @@ RESOURCE = $(DIROBJ)\libcurl.res
 !MESSAGE   release-dll-ssl-dll          - release dynamic library with dynamic 
ssl
 !MESSAGE   release-dll-zlib-dll         - release dynamic library with dynamic 
zlib
 !MESSAGE   release-dll-ssl-dll-zlib-dll - release dynamic library with dynamic 
ssl and dynamic zlib
+!MESSAGE   release-ssh2-ssl-dll-zlib    - release static library with dynamic 
ssl, static zlib and static ssh2
 !MESSAGE   debug                        - debug static library
 !MESSAGE   debug-ssl                    - debug static library with ssl
 !MESSAGE   debug-zlib                   - debug static library with zlib
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html

Reply via email to