1!IF "$(MODE)"=="static"
2TARGET = $(LIB_NAME_STATIC)
3AS_DLL = false
4CFGSET=true
5!ELSEIF "$(MODE)"=="dll"
6TARGET = $(LIB_NAME_DLL)
7AS_DLL = true
8CFGSET=true
9!ELSE
10!MESSAGE Invalid mode: $(MODE)
11
12#######################
13# Usage
14#
15
16!MESSAGE Usage: nmake /f makefile.vc mode=<static or dll> <options>
17!MESSAGE where <options> is one or many of:
18!MESSAGE   VC=<6,7,8,9,10>              - VC versions
19!MESSAGE   WITH_DEVEL=<path>            - Paths for the development files (SSL, zlib, etc.)
20!MESSAGE                                  Default to sibbling directory deps: ../deps
21!MESSAGE                                  Libraries can be fetched at http://pecl2.php.net/downloads/php-windows-builds/
22!MESSAGE                                  Uncompress them into the deps folder.
23!MESSAGE   WITH_SSL=<dll or static>     - Enable OpenSSL support, DLL or static
24!MESSAGE   WITH_ZLIB=<dll or static>    - Enable ZLib support, DLL or static
25!MESSAGE   WITH_SSH2=<dll or static>    - Enable LIbSSH2 support, DLL or static
26!MESSAGE   USE_SSSPI=<yes or no>        - Enable SSPI support, default to yes
27!MESSAGE   USE_IPV6=<yes or no>         - Enable IPV6, default to yes
28!MESSAGE   DEBUG=<yes or no>            - Debug builds
29!MESSAGE   USE_IDN=<yes or no>          - Wheter or not to use IDN Windows APIs. Requires Windows Vista or later.
30!MESSAGE                                  or to install http://www.microsoft.com/downloads/details.aspx?FamilyID=AD6158D7-DDBA-416A-9109-07607425A815
31!MESSAGE   GEN_PDB=<yes or no>          - Generate Program Database (debug symbols release build)
32!ERROR please choose a valid mode
33
34!ENDIF
35
36!INCLUDE "../lib/Makefile.inc"
37LIBCURL_OBJS=$(CSOURCES:.c=.obj)
38
39top_srcdir=..
40!INCLUDE "../src/Makefile.inc"
41
42# hugehelp has a special rule
43CURL_OBJS= $(CURL_CFILES:hugehelp.c=)
44
45CURL_OBJS=$(CURL_OBJS:.c=.obj)
46
47# default options
48!IFNDEF USE_SSPI
49USE_SSPI=true
50!ENDIF
51
52!IFNDEF USE_IPV6
53USE_IPV6=true
54!ENDIF
55
56!IFNDEF USE_IDN
57USE_IDN=true
58!ENDIF
59
60CONFIG_NAME_LIB = libcurl
61
62!IF "$(WITH_SSL)"=="dll"
63USE_SSL      = true
64SSL=dll
65!ELSEIF "$(WITH_SSL)"=="static"
66USE_SSL      = true
67SSL=static
68!ENDIF
69
70!IF "$(WITH_ZLIB)"=="dll"
71USE_ZLIB     = true
72zlib=dll
73!ELSEIF "$(WITH_ZLIB)"=="static"
74USE_ZLIB    = true
75ZLIB=static
76!ENDIF
77
78!IF "$(WITH_SSH2)"=="dll"
79USE_SSH2    = true
80SSH2=dll
81!ELSEIF "$(WITH_SSH2)"=="static"
82USE_SSH2      = true
83SSH2=static
84!ENDIF
85
86!IF "$(DEBUG)"=="yes"
87CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-debug
88!ELSE
89CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-release
90!ENDIF
91
92!IF "$(AS_DLL)" == "true"
93CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-dll
94!ELSE
95CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-static
96!ENDIF
97
98!IF "$(USE_SSL)"=="true"
99CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-ssl-$(SSL)
100!ENDIF
101
102!IF "$(USE_ZLIB)"=="true"
103CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-zlib-$(ZLIB)
104!ENDIF
105
106!IF "$(USE_SSH2)"=="true"
107CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-ssh2-$(SSH2)
108!ENDIF
109
110!IF "$(USE_IPV6)"=="true"
111CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-ipv6
112!ENDIF
113
114!IF "$(USE_SSPI)"=="true"
115CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-sspi
116!ENDIF
117
118!MESSAGE configuration name: $(CONFIG_NAME_LIB)
119
120BUILD_DIR=../builds/$(CONFIG_NAME_LIB)
121LIBCURL_DIROBJ = ..\builds\$(CONFIG_NAME_LIB)-obj-lib
122CURL_DIROBJ = ..\builds\$(CONFIG_NAME_LIB)-obj-curl
123DIRDIST = ..\builds\$(CONFIG_NAME_LIB)\
124
125$(MODE):
126	@SET LIBCURL_DIROBJ=$(LIBCURL_DIROBJ)
127	@SET MACRO_NAME=LIBCURL_OBJS
128	@SET OUTFILE=LIBCURL_OBJS.inc
129	@gen_resp_file.bat $(LIBCURL_OBJS)
130	@SET LIBCURL_DIROBJ=$(CURL_DIROBJ)
131	@SET MACRO_NAME=CURL_OBJS
132	@SET OUTFILE=CURL_OBJS.inc
133	@gen_resp_file.bat $(CURL_OBJS)
134	@$(MAKE) /NOLOGO /F MakefileBuild.vc
135
136copy_from_lib:
137	echo copying .c...
138	FOR %%i IN ($(CURLX_ONES:/=\)) DO copy %%i ..\src\
139