1 ###########################################################################
3 ## Makefile for building curl.exe with MingW (GCC-3.2 or later)
4 ## and optionally OpenSSL (0.9.8), libssh2 (1.3), zlib (1.2.5), librtmp (2.3)
6 ## Usage: mingw32-make -f Makefile.m32 CFG=-feature1[-feature2][-feature3][...]
7 ## Example: mingw32-make -f Makefile.m32 CFG=-zlib-ssl-spi-winidn
9 ## Hint: you can also set environment vars to control the build, f.e.:
10 ## set ZLIB_PATH=c:/zlib-1.2.5
13 ###########################################################################
15 # Edit the path below to point to the base of your Zlib sources.
17 ZLIB_PATH = ../../zlib-1.2.5
19 # Edit the path below to point to the base of your OpenSSL package.
21 OPENSSL_PATH = ../../openssl-0.9.8r
23 ifndef OPENSSL_LIBPATH
24 OPENSSL_LIBPATH = $(OPENSSL_PATH)/out
27 OPENSSL_LIBS = -leay32 -lssl32
29 # Edit the path below to point to the base of your LibSSH2 package.
31 LIBSSH2_PATH = ../../libssh2-1.3.0
33 # Edit the path below to point to the base of your librtmp package.
35 LIBRTMP_PATH = ../../librtmp-2.3
37 # Edit the path below to point to the base of your libidn package.
39 LIBIDN_PATH = ../../libidn-1.18
41 # Edit the path below to point to the base of your MS idndlpackage.
42 # Microsoft Internationalized Domain Names (IDN) Mitigation APIs 1.1
43 # http://www.microsoft.com/downloads/en/details.aspx?FamilyID=ad6158d7-ddba-416a-9109-07607425a815
45 WINIDN_PATH = ../../Microsoft IDN Mitigation APIs
47 # Edit the path below to point to the base of your Novell LDAP NDK.
49 LDAP_SDK = c:/novell/ndk/cldapsdk/win32
54 # Edit the path below to point to the base of your c-ares package.
56 LIBCARES_PATH = $(PROOT)/ares
59 # Edit the var below to set to your architecture or set environment var.
66 CFLAGS += -fno-strict-aliasing
70 # comment LDFLAGS below to keep debug info
73 RCFLAGS = --include-dir=$(PROOT)/include -O COFF -i
78 # We may need these someday
82 ########################################################
83 ## Nothing more to do below this line!
85 ifeq ($(findstring -dyn,$(CFG)),-dyn)
88 ifeq ($(findstring -ares,$(CFG)),-ares)
91 ifeq ($(findstring -rtmp,$(CFG)),-rtmp)
96 ifeq ($(findstring -ssh2,$(CFG)),-ssh2)
101 ifeq ($(findstring -ssl,$(CFG)),-ssl)
104 ifeq ($(findstring -zlib,$(CFG)),-zlib)
107 ifeq ($(findstring -idn,$(CFG)),-idn)
110 ifeq ($(findstring -winidn,$(CFG)),-winidn)
113 ifeq ($(findstring -sspi,$(CFG)),-sspi)
116 ifeq ($(findstring -spnego,$(CFG)),-spnego)
119 ifeq ($(findstring -ldaps,$(CFG)),-ldaps)
122 ifeq ($(findstring -ipv6,$(CFG)),-ipv6)
126 INCLUDES = -I. -I.. -I../include -I../lib
129 curl_DEPENDENCIES = $(PROOT)/lib/libcurldll.a $(PROOT)/lib/libcurl.dll
130 curl_LDADD = -L$(PROOT)/lib -lcurldll
132 curl_DEPENDENCIES = $(PROOT)/lib/libcurl.a
133 curl_LDADD = -L$(PROOT)/lib -lcurl
134 CFLAGS += -DCURL_STATICLIB
138 curl_DEPENDENCIES += $(LIBCARES_PATH)/libcares.a
141 curl_LDADD += -L"$(LIBCARES_PATH)" -lcares
144 CFLAGS += -DUSE_LIBRTMP
145 curl_LDADD += -L"$(LIBRTMP_PATH)/librtmp" -lrtmp -lwinmm
148 CFLAGS += -DUSE_LIBSSH2 -DHAVE_LIBSSH2_H
149 curl_LDADD += -L"$(LIBSSH2_PATH)/win32" -lssh2
152 CFLAGS += -DUSE_SSLEAY -DHAVE_OPENSSL_ENGINE_H
153 curl_LDADD += -L"$(OPENSSL_LIBPATH)" $(OPENSSL_LIBS)
156 INCLUDES += -I"$(ZLIB_PATH)"
157 CFLAGS += -DHAVE_LIBZ -DHAVE_ZLIB_H
158 curl_LDADD += -L"$(ZLIB_PATH)" -lz
161 CFLAGS += -DUSE_LIBIDN
162 curl_LDADD += -L"$(LIBIDN_PATH)/lib" -lidn
165 CFLAGS += -DUSE_WIN32_IDN
166 curl_LDADD += -L"$(WINIDN_PATH)" -lnormaliz
170 CFLAGS += -DUSE_WINDOWS_SSPI
173 CFLAGS += -DHAVE_SPNEGO
176 CFLAGS += -DENABLE_IPV6 -D_WIN32_WINNT=0x0501
179 CFLAGS += -DHAVE_LDAP_SSL
181 ifdef USE_LDAP_NOVELL
182 CFLAGS += -DCURL_HAS_NOVELL_LDAPSDK
183 curl_LDADD += -L"$(LDAP_SDK)/lib/mscvc" -lldapsdk -lldapssl -lldapx
185 ifdef USE_LDAP_OPENLDAP
186 CFLAGS += -DCURL_HAS_OPENLDAP_LDAPSDK
187 curl_LDADD += -L"$(LDAP_SDK)/lib" -lldap -llber
189 ifndef USE_LDAP_NOVELL
190 ifndef USE_LDAP_OPENLDAP
191 curl_LDADD += -lwldap32
194 curl_LDADD += -lws2_32
196 # Makefile.inc provides the CSOURCES and HHEADERS defines
199 curl_PROGRAMS = curl.exe
200 curl_OBJECTS := $(patsubst %.c,%.o,$(strip $(CURL_CFILES)))
201 curlx_OBJECTS := $(patsubst %.c,%.o,$(notdir $(strip $(CURLX_ONES))))
203 curl_OBJECTS += $(curlx_OBJECTS)
204 vpath %.c $(PROOT)/lib
210 all: $(curl_PROGRAMS)
212 curl.exe: $(RESOURCE) $(curl_OBJECTS) $(curl_DEPENDENCIES)
214 $(CC) $(LDFLAGS) -o $@ $< $(curl_OBJECTS) $(curl_LDADD)
216 # We don't have nroff normally under win32
217 # hugehelp.c: $(PROOT)/README.curl $(PROOT)/curl.1 mkhelp.pl
219 # $(NROFF) -man $(PROOT)/curl.1 | $(PERL) mkhelp.pl $(PROOT)/README.curl > hugehelp.c
223 @$(CP) hugehelp.c.cvs $@
226 $(CC) $(INCLUDES) $(CFLAGS) -c $<
229 $(RC) $(RCFLAGS) $< -o $@
232 ifeq "$(wildcard hugehelp.c.cvs)" "hugehelp.c.cvs"
235 -$(RM) $(curl_OBJECTS) $(curlx_OBJECTS) $(RESOURCE)
237 distclean vclean: clean
238 -$(RM) $(curl_PROGRAMS)