Windows build: alternative makefile
authorPierre Joye <pierre.php@gmail.com>
Fri, 28 Jan 2011 21:19:44 +0000 (22:19 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Fri, 28 Jan 2011 21:24:39 +0000 (22:24 +0100)
This is a separate makefile for MSVC builds. It is deliberately put in
another dir than src/ and lib/ to allow a different build experience
than the previous - at least during a period. Eventually we should
unify.

Makefile.am
winbuild/BUILD.WINDOWS.txt [new file with mode: 0644]
winbuild/Makefile.vc [new file with mode: 0644]
winbuild/MakefileBuild.vc [new file with mode: 0644]
winbuild/gen_resp_file.bat [new file with mode: 0644]

index f78821c..e562010 100644 (file)
@@ -30,10 +30,13 @@ CMake/CurlTests.c CMake/FindOpenSSL.cmake CMake/FindZLIB.cmake              \
 CMake/OtherTests.cmake CMake/Platforms/WindowsCache.cmake              \
 CMake/Utilities.cmake include/curl/curlbuild.h.cmake
 
+WINBUILD_DIST = winbuild/BUILD.WINDOWS.txt winbuild/gen_resp_file.bat  \
+winbuild/MakefileBuild.vc winbuild/Makefile.vc
+
 EXTRA_DIST = CHANGES COPYING maketgz Makefile.dist curl-config.in      \
  curl-style.el sample.emacs RELEASE-NOTES buildconf    \
  libcurl.pc.in vc6curl.dsw MacOSX-Framework Android.mk $(CMAKE_DIST)   \
- Makefile.msvc.names
+ Makefile.msvc.names $(WINBUILD_DIST)
 
 bin_SCRIPTS = curl-config
 
diff --git a/winbuild/BUILD.WINDOWS.txt b/winbuild/BUILD.WINDOWS.txt
new file mode 100644 (file)
index 0000000..488faeb
--- /dev/null
@@ -0,0 +1,68 @@
+Building with Visual C++, prerequises\r
+=====================================\r
+   This document describes how to compile, build and install curl and libcurl\r
+   from sources using the Visual C++ build tool. To build with VC++, you will\r
+   of course have to first install VC++. The minimum required version of\r
+   VC is 6 (part of Visual Studio 6). However using a more recent version like\r
+   2008 (vc9) is strongly recommended.\r
+\r
+   VC++ is also part of the Windows Platform SDK. You do not have to install\r
+   the full Visual Studio or Visual C++ if all you want is to build curl.\r
+\r
+   The Platform SDK can be fetched here, freely:\r
+\r
+    http://msdn.microsoft.com/en-us/windows/bb980924\r
+\r
+   If you wish to support zlib, openssl, ssh2, you will have to download\r
+   them separately and copy them to the deps directory as shown below:\r
+   \r
+   somedirectory\\r
+    |_curl-src\r
+    | |_winbuild\r
+    |\r
+    |_deps\r
+      |_ lib\r
+      |_ include\r
+      |_ bin\r
+\r
+   It is also possible to create the deps directory in some other random\r
+   places and tell the Makefile its location using the WITH_DEVEL option.\r
+\r
+Building with Visual C++\r
+========================\r
+\r
+Open a Visual Studio Command prompt or the SDK CMD shell.\r
+\r
+    Using the CMD Shell:\r
+     choose the right environment via the setenv command (see setenv /?)\r
+     for the full list of options. setenv /xp /x86 /release for example.\r
+\r
+    Using the Visual Studio command prompt Shell:\r
+     Everything is already pre-configured by calling one of the command\r
+     prompt.\r
+\r
+Once you are in the consonle, go to the winbuild directory in the Curl \r
+sources:\r
+    cd curl-src\winbuild\r
+\r
+Then you can call nmake /f makefile with the desired options (see below).\r
+The builds will be in the top src directory, builds\ directory, in \r
+a directory named using the options given to the nmake call.\r
+\r
+nmake /f makefile.vc mode=<static or dll> <options>\r
+where <options> is one or many of:\r
+  VC=<6,7,8,9,10>              - VC versions\r
+  WITH_DEVEL=<path>            - Paths for the development files (SSL, zlib, etc.)\r
+                                 Default to sibbling directory deps: ../deps\r
+                                 Libraries can be fetched at http://pecl2.php.net/downloads/php-windows-builds/\r
+                                 Uncompress them into the deps folder.\r
+  WITH_SSL=<dll or static>     - Enable OpenSSL support, DLL or static\r
+  WITH_ZLIB=<dll or static>    - Enable ZLib support, DLL or static\r
+  WITH_SSH2=<dll or static>    - Enable LIbSSH2 support, DLL or static\r
+  USE_SSSPI=<yes or no>        - Enable SSPI support, default to yes\r
+  USE_IPV6=<yes or no>         - Enable IPV6, default to yes\r
+  DEBUG=<yes or no>            - Debug builds\r
+  USE_IDN=<yes or no>          - Wheter or not to use IDN Windows APIs. Requires Windows Vista or later.\r
+                                 or to install http://www.microsoft.com/downloads/details.aspx?FamilyID=AD6158D7-DDBA-416A-9109-07607425A815\r
+  GEN_PDB=<yes or no>          - Generate Program Database (debug symbols release build)\r
+\r
diff --git a/winbuild/Makefile.vc b/winbuild/Makefile.vc
new file mode 100644 (file)
index 0000000..be4aca3
--- /dev/null
@@ -0,0 +1,138 @@
+!IF "$(MODE)"=="static"\r
+TARGET = $(LIB_NAME_STATIC)\r
+AS_DLL = false\r
+CFGSET=true\r
+!ELSEIF "$(MODE)"=="dll"\r
+TARGET = $(LIB_NAME_DLL)\r
+AS_DLL = true\r
+CFGSET=true\r
+!ELSE\r
+!MESSAGE Invalid mode: $(MODE)\r
+\r
+#######################\r
+# Usage\r
+#\r
+\r
+!MESSAGE Usage: nmake /f makefile.vc mode=<static or dll> <options>\r
+!MESSAGE where <options> is one or many of:\r
+!MESSAGE   VC=<6,7,8,9,10>              - VC versions\r
+!MESSAGE   WITH_DEVEL=<path>            - Paths for the development files (SSL, zlib, etc.)\r
+!MESSAGE                                  Default to sibbling directory deps: ../deps\r
+!MESSAGE                                  Libraries can be fetched at http://pecl2.php.net/downloads/php-windows-builds/\r
+!MESSAGE                                  Uncompress them into the deps folder.\r
+!MESSAGE   WITH_SSL=<dll or static>     - Enable OpenSSL support, DLL or static\r
+!MESSAGE   WITH_ZLIB=<dll or static>    - Enable ZLib support, DLL or static\r
+!MESSAGE   WITH_SSH2=<dll or static>    - Enable LIbSSH2 support, DLL or static\r
+!MESSAGE   USE_SSSPI=<yes or no>        - Enable SSPI support, default to yes\r
+!MESSAGE   USE_IPV6=<yes or no>         - Enable IPV6, default to yes\r
+!MESSAGE   DEBUG=<yes or no>            - Debug builds\r
+!MESSAGE   USE_IDN=<yes or no>          - Wheter or not to use IDN Windows APIs. Requires Windows Vista or later.\r
+!MESSAGE                                  or to install http://www.microsoft.com/downloads/details.aspx?FamilyID=AD6158D7-DDBA-416A-9109-07607425A815\r
+!MESSAGE   GEN_PDB=<yes or no>          - Generate Program Database (debug symbols release build)\r
+!ERROR please choose a valid mode\r
+\r
+!ENDIF\r
+\r
+!INCLUDE "../lib/Makefile.inc"\r
+LIBCURL_OBJS=$(CSOURCES:.c=.obj)\r
+\r
+top_srcdir=..\r
+!INCLUDE "../src/Makefile.inc"\r
+\r
+# hugehelp has a special rule\r
+CURL_OBJS= $(CURL_CFILES:hugehelp.c=)\r
+\r
+CURL_OBJS=$(CURL_OBJS:.c=.obj)\r
+\r
+# default options\r
+!IFNDEF USE_SSPI\r
+USE_SSPI=true\r
+!ENDIF\r
+\r
+!IFNDEF USE_IPV6\r
+USE_IPV6=true\r
+!ENDIF\r
+\r
+!IFNDEF USE_IDN\r
+USE_IDN=true\r
+!ENDIF\r
+\r
+CONFIG_NAME_LIB = libcurl\r
+\r
+!IF "$(WITH_SSL)"=="dll"\r
+USE_SSL      = true\r
+SSL=dll\r
+!ELSEIF "$(WITH_SSL)"=="static"\r
+USE_SSL      = true\r
+SSL=dll\r
+!ENDIF\r
+\r
+!IF "$(WITH_ZLIB)"=="dll"\r
+USE_ZLIB     = true\r
+zlib=dll\r
+!ELSEIF "$(WITH_ZLIB)"=="static"\r
+USE_ZLIB    = true\r
+ZLIB=static\r
+!ENDIF\r
+\r
+!IF "$(WITH_SSH2)"=="dll"\r
+USE_SSH2    = true\r
+SSH2=dll\r
+!ELSEIF "$(WITH_SSH2)"=="static"\r
+USE_SSH2      = true\r
+SSH2=static\r
+!ENDIF\r
+\r
+!IF "$(DEBUG)"=="yes"\r
+CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-debug\r
+!ELSE\r
+CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-release\r
+!ENDIF\r
+\r
+!IF "$(AS_DLL)" == "true"\r
+CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-dll\r
+!ELSE\r
+CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-static\r
+!ENDIF\r
+\r
+!IF "$(USE_SSL)"=="true"\r
+CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-ssl-$(SSL)\r
+!ENDIF\r
+\r
+!IF "$(USE_ZLIB)"=="true"\r
+CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-zlib-$(ZLIB)\r
+!ENDIF\r
+\r
+!IF "$(USE_SSH2)"=="true"\r
+CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-ssh2-$(SSH2)\r
+!ENDIF\r
+\r
+!IF "$(USE_IPV6)"=="true"\r
+CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-ipv6\r
+!ENDIF\r
+\r
+!IF "$(USE_SSPI)"=="true"\r
+CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-sspi\r
+!ENDIF\r
+\r
+!MESSAGE configuration name: $(CONFIG_NAME_LIB)\r
+\r
+BUILD_DIR=../builds/$(CONFIG_NAME_LIB)\r
+LIBCURL_DIROBJ = ..\builds\$(CONFIG_NAME_LIB)-obj-lib\r
+CURL_DIROBJ = ..\builds\$(CONFIG_NAME_LIB)-obj-curl\r
+DIRDIST = ..\builds\$(CONFIG_NAME_LIB)\\r
+\r
+$(MODE):\r
+       @SET LIBCURL_DIROBJ=$(LIBCURL_DIROBJ)\r
+       @SET MACRO_NAME=LIBCURL_OBJS\r
+       @SET OUTFILE=LIBCURL_OBJS.inc\r
+       @gen_resp_file.bat $(LIBCURL_OBJS)\r
+       @SET LIBCURL_DIROBJ=$(CURL_DIROBJ)\r
+       @SET MACRO_NAME=CURL_OBJS\r
+       @SET OUTFILE=CURL_OBJS.inc\r
+       @gen_resp_file.bat $(CURL_OBJS)\r
+       @$(MAKE) /NOLOGO /F MakefileBuild.vc\r
+\r
+copy_from_lib:\r
+       echo copying .c...\r
+       FOR %%i IN ($(CURLX_ONES:/=\)) DO copy %%i ..\src\\r
diff --git a/winbuild/MakefileBuild.vc b/winbuild/MakefileBuild.vc
new file mode 100644 (file)
index 0000000..3d915bf
--- /dev/null
@@ -0,0 +1,426 @@
+#***************************************************************************
+#                                  _   _ ____  _
+#  Project                     ___| | | |  _ \| |
+#                             / __| | | | |_) | |
+#                            | (__| |_| |  _ <| |___
+#                             \___|\___/|_| \_\_____|
+#
+# Copyright (C) 1999 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al.
+#
+# This software is licensed as described in the file COPYING, which
+# you should have received as part of this distribution. The terms
+# are also available at http://curl.haxx.se/docs/copyright.html.
+#
+# You may opt to use, copy, modify, merge, publish, distribute and/or sell
+# copies of the Software, and permit persons to whom the Software is
+# furnished to do so, under the terms of the COPYING file.
+#
+# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+# KIND, either express or implied.
+#
+#***************************************************************************
+
+###########################################################################
+#
+# Makefile for building libcurl with MSVC 6, 7, 8, 9 and 10
+#
+# Usage: see usage message below
+#        Should be invoked from winbuild directory
+#        Edit the paths and desired library name
+#        SSL path is only required if you intend compiling
+#        with SSL.
+#
+# This make file leaves the result either a .lib or .dll file
+# in the \lib directory. It should be called from the \lib
+# directory.
+#
+# An option would have been to allow the source directory to
+# be specified, but I saw no requirement.
+#
+# Another option would have been to leave the .lib and .dll
+# files in the "cfg" directory, but then the make file
+# in \src would need to be changed.
+#
+##############################################################
+
+CFGSET=FALSE
+WINBUILD_DIR=`cd`
+ZIP        = zip.exe
+
+!IF "$(VC)"=="6"
+CC_NODEBUG  = cl.exe /O2 /DNDEBUG
+CC_DEBUG    = cl.exe /Od /Gm /Zi /D_DEBUG /GZ
+CFLAGS     = /I. /I../include /nologo /W3 /GX /DWIN32 /YX /FD /c /DBUILDING_LIBCURL
+!ELSE
+CC_NODEBUG  = cl.exe /O2 /DNDEBUG
+CC_DEBUG    = cl.exe /Od /D_DEBUG /RTC1 /Z7 /LDd /W3
+CFLAGS      = /I. /I../include /nologo /W3 /EHsc /DWIN32 /FD /c /DBUILDING_LIBCURL
+!ENDIF
+
+LFLAGS     = /nologo /machine:$(MACHINE)
+LNKDLL     = link.exe /DLL
+LNKLIB     = link.exe /lib
+
+CFLAGS_PDB = /Zi
+LFLAGS_PDB = /incremental:no /opt:ref,icf
+
+CFLAGS_LIBCURL_STATIC  = /DCURL_STATICLIB
+
+LIB_NAME_STATIC        = libcurl_a.lib
+LIB_NAME_STATIC_DEBUG  = libcurl_a_debug.lib
+LIB_NAME_DLL           = libcurl.dll
+LIB_NAME_IMP           = libcurl.lib
+LIB_NAME_DLL_DEBUG     = libcurl_debug.dll
+LIB_NAME_IMP_DEBUG     = libcurl_debug.lib
+
+# CURL Command section
+PROGRAM_NAME = curl.exe
+CURL_CFLAGS   =  /I../lib /I../include /nologo /W3 /EHsc /DWIN32 /FD /c
+CURL_LFLAGS   = /nologo /out:$(DIRDIST)\bin\$(PROGRAM_NAME) /subsystem:console /machine:$(MACHINE)
+CURL_RESFLAGS = /i../include
+
+#############################################################
+## Nothing more to do below this line!
+LIBCURL_SRC_DIR = ..\lib
+CURL_SRC_DIR = ..\src
+
+!IFNDEF WITH_DEVEL
+WITH_DEVEL          = ../../deps
+!ENDIF
+DEVEL_INCLUDE  = $(WITH_DEVEL)/include
+DEVEL_LIB      = $(WITH_DEVEL)/lib
+DEVEL_BIN      = $(WITH_DEVEL)/bin
+
+CFLAGS         = $(CFLAGS) /I"$(DEVEL_INCLUDE)"
+LFLAGS         = $(LFLAGS) "/LIBPATH:$(DEVEL_LIB)"
+
+!IF "$(WITH_SSL)"=="dll"
+SSL_LIBS     = libeay32.lib ssleay32.lib
+USE_SSL      = true
+SSL=dll
+!ELSEIF "$(WITH_SSL)"=="static"
+SSL_LIBS     = libeay32.lib ssleay32.lib
+USE_SSL      = true
+SSL=dll
+!ENDIF
+
+!IFDEF USE_SSL
+SSL_CFLAGS   = /DUSE_SSLEAY /I"$(DEVEL_INCLUDE)/openssl"
+!ENDIF
+
+!IF "$(WITH_ZLIB)"=="dll"
+ZLIB_LIBS   = zlib.lib
+ZLIB_CFLAGS = /DHAVE_ZLIB_H /DHAVE_ZLIB /DHAVE_LIBZ
+USE_ZLIB     = true
+zlib=dll
+!ELSEIF "$(WITH_ZLIB)"=="static"
+ZLIB_LIBS   = zlib_a.lib
+ZLIB_CFLAGS = /DHAVE_ZLIB_H /DHAVE_ZLIB /DHAVE_LIBZ
+USE_ZLIB    = true
+ZLIB=static
+!ENDIF
+
+!IFDEF USE_ZLIB
+ZLIB_CFLAGS = /DHAVE_ZLIB_H /DHAVE_ZLIB /DHAVE_LIBZ
+!ENDIF
+
+!IF "$(WITH_SSH2)"=="dll"
+SSH2_LIBS   = libssh2.lib
+USE_SSH2    = true
+SSH2=dll
+!ELSEIF "$(WITH_SSH2)"=="static"
+SSH2_LIBS   = libssh2_a_debug.lib
+USE_SSH2    = true
+SSH2=static
+!ENDIF
+
+!IFDEF USE_SSH2
+SSH2_CFLAGS   = /DHAVE_LIBSSH2 /DHAVE_LIBSSH2_H /DLIBSSH2_WIN32 /DLIBSSH2_LIBRARY /DUSE_LIBSSH2
+SSH2_CFLAGS   = $(SSH2_CFLAGS) /I$(WITH_DEVEL)/include/libssh2
+!ENDIF
+
+!IFNDEF USE_SSPI
+USE_SSPI=yes
+!ENDIF
+
+!IF "$(USE_SSPI)"=="yes"
+CFLAGS_SSPI = /DUSE_WINDOWS_SSPI
+USE_SSPI=true
+!ENDIF
+
+!IFNDEF USE_IPV6
+USE_IPV6=yes
+!ENDIF
+
+!IFNDEF USE_IDN
+USE_IDN   =true
+!ELSEIF "$(USE_IDN)"=="yes"
+USE_IDN   =true
+!ENDIF
+
+!IF "$(USE_IDN)"=="true"
+CFLAGS    = $(CFLAGS) /DUSE_WIN32_IDN
+LFLAGS    = $(LFLAGS) Normaliz.lib
+!ENDIF
+
+!IF "$(USE_IPV6)"=="yes"
+CFLAGS = $(CFLAGS) /DUSE_IPV6
+USE_IPV6=true
+!ENDIF
+
+!IF "$(GEN_PDB)"=="yes"
+GEN_PDB=true
+!ENDIF
+
+!IFNDEF MACHINE
+MACHINE = X86
+!ENDIF
+
+!IFDEF EMBEND_MANIFEST
+MANIFESTTOOL = mt -manifest $(DIRDIST)\$(PROGRAM_NAME).manifest -outputresource:$(DIRDIST)\$(PROGRAM_NAME);1
+!ENDIF
+
+# Runtime library configuration
+!IF "$(RTLIBCFG)" == "static"
+RTLIB  = /MT
+RTLIB_DEBUG = /MTd
+!ELSE
+RTLIB   = /MD
+RTLIB_DEBUG  = /MDd
+!ENDIF
+
+!IF "$(MODE)"=="static"
+TARGET = $(LIB_NAME_STATIC)
+CURL_LIBCURL_LIBNAME=$(LIB_NAME_STATIC)
+AS_DLL = false
+CFGSET=true
+!ELSEIF "$(MODE)"=="dll"
+TARGET = $(LIB_NAME_DLL)
+CURL_LIBCURL_LIBNAME=$(LIB_NAME_IMP)
+AS_DLL = true
+CFGSET=true
+!ENDIF
+
+WIN_LIBS    = ws2_32.lib wldap32.lib
+!IF "$(CFGSET)" == "FALSE"
+!ERROR please choose a valid mode
+!ENDIF
+
+CONFIG_NAME_LIB = libcurl
+
+# CURL_XX macros are for the curl.exe command
+
+!IF "$(DEBUG)"=="yes"
+RC_FLAGS = /dDEBUGBUILD=1 /Fo $@ $(LIBCURL_SRC_DIR)\libcurl.rc
+CC              = $(CC_DEBUG) $(RTLIB_DEBUG)
+
+CURL_CC         = $(CC)
+CURL_RC_FLAGS = /i../include /dDEBUGBUILD=1 /Fo $@ $(CURL_SRC_DIR)\curl.rc
+CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-debug
+!ELSE
+RC_FLAGS = /dDEBUGBUILD=0 /Fo $@ $(LIBCURL_SRC_DIR)\libcurl.rc
+CC              = $(CC_NODEBUG) $(RTLIB)
+
+CURL_CC         = $(CC)
+CURL_RC_FLAGS = /i../include /dDEBUGBUILD=0 /Fo $@ $(CURL_SRC_DIR)\curl.rc
+CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-release
+!ENDIF
+
+CURL_CC = $(CURL_CC) $(CURL_CFLAGS)
+
+!IF "$(AS_DLL)" == "true"
+
+LNK      = $(LNKDLL) $(WIN_LIBS) /out:$(LIB_DIROBJ)\$(TARGET)
+!IF "$(DEBUG)"=="yes"
+TARGET    = $(LIB_NAME_DLL_DEBUG)
+LNK       = $(LNK) /DEBUG /IMPLIB:$(LIB_DIROBJ)\$(LIB_NAME_IMP_DEBUG)
+CURL_LIBS = /IMPLIB:$(LIB_DIROBJ)\$(LIB_NAME_IMP_DEBUG)
+!ELSE
+TARGET    = $(LIB_NAME_DLL)
+LNK       = $(LNK)  /IMPLIB:$(LIB_DIROBJ)\$(LIB_NAME_IMP)
+CURL_LIBS = /IMPLIB:$(LIB_DIROBJ)\$(LIB_NAME_IMP)
+!ENDIF
+RESOURCE = $(LIB_DIROBJ)\libcurl.res
+CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-dll
+
+# AS_DLL
+!ELSE
+
+!IF "$(DEBUG)"=="yes"
+TARGET   = $(LIB_NAME_STATIC_DEBUG)
+!ELSE
+TARGET   = $(LIB_NAME_STATIC)
+!ENDIF
+LNK      = $(LNKLIB) $(WIN_LIBS) /out:$(LIB_DIROBJ)\$(TARGET)
+CC       = $(CC) $(CFLAGS_LIBCURL_STATIC)
+CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-static
+
+# AS_DLL
+!ENDIF
+
+!IF "$(USE_SSL)"=="true"
+CFLAGS = $(CFLAGS) $(SSL_CFLAGS)
+LFLAGS = $(LFLAGS) $(SSL_LFLAGS) $(SSL_LIBS)
+CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-ssl-$(SSL)
+!ENDIF
+
+!IF "$(USE_ZLIB)"=="true"
+CFLAGS = $(CFLAGS) $(ZLIB_CFLAGS)
+LFLAGS = $(LFLAGS) $(ZLIB_LFLAGS) $(ZLIB_LIBS)
+CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-zlib-$(ZLIB)
+!ENDIF
+
+!IF "$(USE_SSH2)"=="true"
+CFLAGS = $(CFLAGS) $(SSH2_CFLAGS)
+LFLAGS = $(LFLAGS) $(SSH2_LFLAGS) $(SSH2_LIBS)
+CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-ssh2-$(SSH2)
+!ENDIF
+
+!IF "$(USE_IPV6)"=="true"
+CFLAGS = $(CFLAGS) $(CFLAGS_IPV6)
+CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-ipv6
+!ENDIF
+
+!IF "$(USE_SSPI)"=="true"
+CFLAGS = $(CFLAGS) $(CFLAGS_SSPI)
+CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-sspi
+!ENDIF
+
+!IF "$(GEN_PDB)"=="true"
+CFLAGS = $(CFLAGS) $(CFLAGS_PDB)
+LFLAGS = $(LFLAGS) $(LFLAGS_PDB)
+!ENDIF
+
+LIB_DIROBJ = ..\builds\$(CONFIG_NAME_LIB)-obj-lib
+CURL_DIROBJ = ..\builds\$(CONFIG_NAME_LIB)-obj-curl
+DIRDIST = ..\builds\$(CONFIG_NAME_LIB)\
+
+#
+# curl.exe
+#
+CURL_LINK = link.exe /incremental:no /libpath:"$(DIRDIST)\lib"
+
+#!IF "$(CFG)" == "release-ssh2-ssl-dll-zlib"
+#TARGET   = $(LIB_NAME_STATIC)
+#LNK      = $(LNKLIB) $(WINLIBS) $(SSLLIBS) $(ZLIBLIBS)  $(SSH2LIBS) $(SSL_LFLAGS) $(ZLIB_LFLAGS) $(LFLAGSSSH) /out:$(LIB_DIROBJ)\$(TARGET)
+#CC       = $(CCNODBG) $(RTLIB) $(SSL_CFLAGS) $(ZLIB_CFLAGS) $(CFLAGSLIB)  $(SSH2_CFLAGS)
+#CFGSET   = TRUE
+#!ENDIF
+
+#######################
+# Only the clean target can be used if a config was not provided.
+#
+!IF "$(CFGSET)" == "FALSE"
+clean:
+       @-erase /s *.dll 2> NUL
+       @-erase /s *.exp 2> NUL
+       @-erase /s *.idb 2> NUL
+       @-erase /s *.lib 2> NUL
+       @-erase /s *.obj 2> NUL
+       @-erase /s *.pch 2> NUL
+       @-erase /s *.pdb 2> NUL
+       @-erase /s *.res 2> NUL
+!ELSE
+# A mode was provided, so the library can be built.
+#
+!include CURL_OBJS.inc
+!include LIBCURL_OBJS.inc
+
+LIB_OBJS= $(LIBCURL_OBJS)
+EXE_OBJS= $(CURL_OBJS)
+
+all : $(TARGET) $(PROGRAM_NAME)
+
+package: $(TARGET)
+       @cd $(DIRDIST)
+       @-$(ZIP) -9 -q -r ..\$(CONFIG_NAME_LIB).zip .>nul 2<&1
+       @cd $(MAKEDIR)
+
+$(TARGET): $(LIB_OBJS) $(LIB_DIROBJ) $(DISTDIR)
+       @echo Using SSL: $(USE_SSL)
+       @echo Using SSH2: $(USE_SSH2)
+       @echo Using ZLIB: $(USE_ZLIB)
+       @echo Using SSPI: $(USE_SSPI)
+       @echo Using SSPI: $(LFLAGS)
+       @echo Gen PDB:    $(GEN_PDB)
+       @echo Debug:      $(DEBUG)
+       $(LNK) $(LFLAGS) $(LIB_OBJS)
+       @echo Copying libs...
+       @if exist $(LIB_DIROBJ)\$(LIB_NAME_DLL) copy $(LIB_DIROBJ)\$(LIB_NAME_DLL)       $(DIRDIST)\bin\ /y >nul 2<&1
+       @if exist $(LIB_DIROBJ)\$(LIB_NAME_STATIC) copy $(LIB_DIROBJ)\$(LIB_NAME_STATIC)    $(DIRDIST)\lib\ /y >nul 2<&1
+       @if exist $(LIB_DIROBJ)\$(LIB_NAME_DLL_DEBUG) copy $(LIB_DIROBJ)\$(LIB_NAME_DLL_DEBUG) $(DIRDIST)\bin\ /y >nul 2<&1
+       @if exist $(LIB_DIROBJ)\$(LIB_NAME_STATIC_DEBUG) copy $(LIB_DIROBJ)\$(LIB_NAME_STATIC_DEBUG) $(DIRDIST)\lib\ /y >nul 2<&1
+       @if exist $(LIB_DIROBJ)\$(LIB_NAME_IMP) copy $(LIB_DIROBJ)\$(LIB_NAME_IMP)       $(DIRDIST)\lib\ /y >nul 2<&1
+       @if exist $(LIB_DIROBJ)\$(LIB_NAME_IMP_DEBUG) copy $(LIB_DIROBJ)\$(LIB_NAME_IMP_DEBUG) $(DIRDIST)\lib >nul 2<&1
+       @-copy $(LIB_DIROBJ)\*.exp                 $(DIRDIST)\lib /y >nul 2<&1
+       @-copy $(LIB_DIROBJ)\*.pdb                 $(DIRDIST)\lib /y >nul 2<&1
+       @-copy ..\include\curl\*.h   $(DIRDIST)\include\curl\ /y  >nul 2<&1
+
+$(LIB_OBJS): $(LIB_DIROBJ) $(DIRDIST)
+
+$(DIRDIST):
+       @if not exist "$(DIRDIST)\bin" mkdir $(DIRDIST)\bin
+       @if not exist "$(DIRDIST)\include" mkdir $(DIRDIST)\include
+       @if not exist "$(DIRDIST)\include\curl" mkdir $(DIRDIST)\include\curl
+       @if not exist "$(DIRDIST)\lib" mkdir $(DIRDIST)\lib
+
+$(LIB_DIROBJ):
+       @if not exist "$(LIB_DIROBJ)" mkdir $(LIB_DIROBJ)
+
+$(CURL_DIROBJ):
+       @if not exist "$(CURL_DIROBJ)" mkdir $(CURL_DIROBJ)
+# we need a lib dir for the portability functions from libcurl
+# we use the .c directly here
+       @if not exist "$(CURL_DIROBJ)" mkdir $(CURL_DIROBJ)\lib
+
+.SUFFIXES: .c .obj .res
+
+{$(LIBCURL_SRC_DIR)\}.c{$(LIB_DIROBJ)\}.obj:
+       $(CC) $(CFLAGS) /Fo"$@"  $<
+
+$(LIB_DIROBJ)\libcurl.res: $(LIBCURL_SRC_DIR)\libcurl.rc
+       rc $(RC_FLAGS)
+
+#
+# curl.exe
+#
+
+
+!IF "$(MODE)"=="static"
+!IF "$(DEBUG)"=="yes"
+CURL_LIBCURL_LIBNAME=$(LIB_NAME_STATIC_DEBUG)
+!ELSE
+CURL_LIBCURL_LIBNAME=$(LIB_NAME_STATIC)
+!ENDIF
+!ELSEIF "$(MODE)"=="dll"
+!IF "$(DEBUG)"=="yes"
+CURL_LIBCURL_LIBNAME=$(LIB_NAME_IMP_DEBUG)
+!ELSE
+CURL_LIBCURL_LIBNAME=$(LIB_NAME_IMP)
+!ENDIF
+!ENDIF
+
+CURL_FROM_LIBCURL=$(CURL_DIROBJ)\hugehelp.obj \
+ $(CURL_DIROBJ)\nonblock.obj \
+ $(CURL_DIROBJ)\rawstr.obj \
+ $(CURL_DIROBJ)\strtoofft.obj
+$(PROGRAM_NAME): $(CURL_DIROBJ) $(CURL_FROM_LIBCURL) $(EXE_OBJS)
+       $(CURL_LINK) $(CURL_LFLAGS) $(CURL_LIBCURL_LIBNAME) $(WIN_LIBS) $(CURL_FROM_LIBCURL) $(EXE_OBJS)
+       $(MANIFESTTOOL)
+
+{$(CURL_SRC_DIR)\}.c{$(CURL_DIROBJ)\}.obj:
+       $(CC) $(CURL_CFLAGS) /Fo"$@"  $<
+
+$(CURL_DIROBJ)\hugehelp.obj: $(CURL_SRC_DIR)\hugehelp.c
+       $(CURL_CC) $(CURL_CFLAGS) /Zm200 /Fo"$@" $(CURL_SRC_DIR)\hugehelp.c
+$(CURL_DIROBJ)\nonblock.obj: ../lib/nonblock.c
+       $(CURL_CC) $(CURL_CFLAGS) /Fo"$@" ../lib/nonblock.c
+$(CURL_DIROBJ)\rawstr.obj: ../lib/rawstr.c
+       $(CURL_CC) $(CURL_CFLAGS) /Fo"$@" ../lib/rawstr.c
+$(CURL_DIROBJ)\strtoofft.obj: ../lib/strtoofft.c
+       $(CURL_CC) $(CURL_CFLAGS) /Fo"$@" ../lib/strtoofft.c
+$(CURL_DIROBJ)\curl.res: $(CURL_SRC_DIR)\curl.rc
+       rc $(CURL_RC_FLAGS)
+
+!ENDIF  # End of case where a config was provided.
diff --git a/winbuild/gen_resp_file.bat b/winbuild/gen_resp_file.bat
new file mode 100644 (file)
index 0000000..c2fa667
--- /dev/null
@@ -0,0 +1,6 @@
+@echo OFF\r
+@del %OUTFILE%\r
+@echo %MACRO_NAME% = \> %OUTFILE%\r
+@for %%i in (%*) do @echo              %LIBCURL_DIROBJ%/%%i \>>  %OUTFILE%\r
+@echo. >>  %OUTFILE%\r
+:END\r