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,11,12>        - VC versions
19!MESSAGE   WITH_DEVEL=<path>            - Paths for the development files (SSL, zlib, etc.)
20!MESSAGE                                  Defaults 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   ENABLE_IDN=<yes or no>       - Enable use of Windows IDN APIs, defaults to yes
27!MESSAGE                                  Requires Windows Vista or later, or installation from:
28!MESSAGE                                  http://www.microsoft.com/downloads/details.aspx?FamilyID=AD6158D7-DDBA-416A-9109-07607425A815
29!MESSAGE   ENABLE_IPV6=<yes or no>      - Enable IPv6, defaults to yes
30!MESSAGE   ENABLE_SSPI=<yes or no>      - Enable SSPI support, defaults to yes
31!MESSAGE   ENABLE_SPNEGO=<yes or no>    - Enable Simple and Protected GSSAPI Negotiation Mechanism, defaults to yes
32!MESSAGE   ENABLE_WINSSL=<yes or no>    - Enable native Windows SSL support, defaults to yes
33!MESSAGE   GEN_PDB=<yes or no>          - Generate Program Database (debug symbols for release build)
34!MESSAGE   DEBUG=<yes or no>            - Debug builds
35!MESSAGE   MACHINE=<x86 or x64>         - Target architecture (default x64 on AMD64, x86 on others)
36!ERROR please choose a valid mode
37
38!ENDIF
39
40!INCLUDE "../lib/Makefile.inc"
41LIBCURL_OBJS=$(CSOURCES:.c=.obj)
42
43!INCLUDE "../src/Makefile.inc"
44
45# tool_hugehelp has a special rule
46CURL_OBJS=$(CURL_CFILES:tool_hugehelp.c=)
47
48CURL_OBJS=$(CURL_OBJS:.c=.obj)
49
50
51# backwards compatible check for USE_SSPI
52!IFDEF USE_SSPI
53ENABLE_SSPI = $(USE_SSPI)
54!ENDIF
55
56# default options
57!IFNDEF MACHINE
58!IF "$(PROCESSOR_ARCHITECTURE)"=="AMD64"
59MACHINE = x64
60!ELSE
61MACHINE = x86
62!ENDIF
63!ENDIF
64
65!IFNDEF ENABLE_IDN
66USE_IDN = true
67!ELSEIF "$(ENABLE_IDN)"=="yes"
68USE_IDN = true
69!ELSEIF "$(ENABLE_IDN)"=="no"
70USE_IDN = false
71!ENDIF
72
73!IFNDEF ENABLE_IPV6
74USE_IPV6 = true
75!ELSEIF "$(ENABLE_IPV6)"=="yes"
76USE_IPV6 = true
77!ELSEIF "$(ENABLE_IPV6)"=="no"
78USE_IPV6 = false
79!ENDIF
80
81!IFNDEF ENABLE_SSPI
82USE_SSPI = true
83!ELSEIF "$(ENABLE_SSPI)"=="yes"
84USE_SSPI = true
85!ELSEIF "$(ENABLE_SSPI)"=="no"
86USE_SSPI = false
87!ENDIF
88
89!IFNDEF ENABLE_SPNEGO
90USE_SPNEGO = true
91!ELSEIF "$(ENABLE_SPNEGO)"=="yes"
92USE_SPNEGO = true
93!ELSEIF "$(ENABLE_SPNEGO)"=="no"
94USE_SPNEGO = false
95!ENDIF
96
97!IFNDEF ENABLE_WINSSL
98USE_WINSSL = $(USE_SSPI)
99!ELSEIF "$(ENABLE_WINSSL)"=="yes"
100USE_WINSSL = true
101!ELSEIF "$(ENABLE_WINSSL)"=="no"
102USE_WINSSL = false
103!ENDIF
104
105CONFIG_NAME_LIB = libcurl
106
107!IF "$(WITH_SSL)"=="dll"
108USE_SSL = true
109SSL     = dll
110!ELSEIF "$(WITH_SSL)"=="static"
111USE_SSL = true
112SSL     = static
113!ENDIF
114
115!IF "$(WITH_ZLIB)"=="dll"
116USE_ZLIB = true
117ZLIB     = dll
118!ELSEIF "$(WITH_ZLIB)"=="static"
119USE_ZLIB = true
120ZLIB     = static
121!ENDIF
122
123!IF "$(WITH_SSH2)"=="dll"
124USE_SSH2 = true
125SSH2     = dll
126!ELSEIF "$(WITH_SSH2)"=="static"
127USE_SSH2 = true
128SSH2     = static
129!ENDIF
130
131CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-vc$(VC)-$(MACHINE)
132
133!IF "$(DEBUG)"=="yes"
134CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-debug
135!ELSE
136CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-release
137!ENDIF
138
139!IF "$(AS_DLL)"=="true"
140CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-dll
141!ELSE
142CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-static
143!ENDIF
144
145!IF "$(USE_SSL)"=="true"
146CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-ssl-$(SSL)
147!ENDIF
148
149!IF "$(USE_ZLIB)"=="true"
150CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-zlib-$(ZLIB)
151!ENDIF
152
153!IF "$(USE_SSH2)"=="true"
154CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-ssh2-$(SSH2)
155!ENDIF
156
157!IF "$(USE_IPV6)"=="true"
158CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-ipv6
159!ENDIF
160
161!IF "$(USE_SSPI)"=="true"
162CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-sspi
163!ENDIF
164
165!IF "$(USE_SPNEGO)"=="true"
166CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-spnego
167!ENDIF
168
169!IF "$(USE_WINSSL)"=="true"
170CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-winssl
171!ENDIF
172
173!MESSAGE configuration name: $(CONFIG_NAME_LIB)
174
175BUILD_DIR=../builds/$(CONFIG_NAME_LIB)
176LIBCURL_DIROBJ = ..\builds\$(CONFIG_NAME_LIB)-obj-lib
177CURL_DIROBJ = ..\builds\$(CONFIG_NAME_LIB)-obj-curl
178DIRDIST = ..\builds\$(CONFIG_NAME_LIB)\
179
180$(MODE):
181	@SET DIROBJ=$(LIBCURL_DIROBJ)
182	@SET MACRO_NAME=LIBCURL_OBJS
183	@SET OUTFILE=LIBCURL_OBJS.inc
184	@gen_resp_file.bat $(LIBCURL_OBJS)
185
186	@SET DIROBJ=$(CURL_DIROBJ)
187	@SET MACRO_NAME=CURL_OBJS
188	@SET OUTFILE=CURL_OBJS.inc
189	@gen_resp_file.bat $(CURL_OBJS)
190
191	@SET CONFIG_NAME_LIB=$(CONFIG_NAME_LIB)
192	@SET MACHINE=$(MACHINE)
193	@SET USE_IDN=$(USE_IDN)
194	@SET USE_IPV6=$(USE_IPV6)
195	@SET USE_SSPI=$(USE_SSPI)
196	@SET USE_SPNEGO=$(USE_SPNEGO)
197	@SET USE_WINSSL=$(USE_WINSSL)
198	@$(MAKE) /NOLOGO /F MakefileBuild.vc
199
200copy_from_lib:
201	echo copying .c...
202	FOR %%i IN ($(CURLX_ONES:/=\)) DO copy %%i ..\src\
203