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.7
13 ###########################################################################
15 # Edit the path below to point to the base of your Zlib sources.
17 ZLIB_PATH = ../../zlib-1.2.7
19 # Edit the path below to point to the base of your OpenSSL package.
21 OPENSSL_PATH = ../../openssl-0.9.8x
23 # Edit the path below to point to the base of your LibSSH2 package.
25 LIBSSH2_PATH = ../../libssh2-1.4.2
27 # Edit the path below to point to the base of your librtmp package.
29 LIBRTMP_PATH = ../../librtmp-2.3
31 # Edit the path below to point to the base of your libidn package.
33 LIBIDN_PATH = ../../libidn-1.18
35 # Edit the path below to point to the base of your MS IDN package.
36 # Microsoft Internationalized Domain Names (IDN) Mitigation APIs 1.1
37 # http://www.microsoft.com/downloads/en/details.aspx?FamilyID=ad6158d7-ddba-416a-9109-07607425a815
39 WINIDN_PATH = ../../Microsoft IDN Mitigation APIs
41 # Edit the path below to point to the base of your Novell LDAP NDK.
43 LDAP_SDK = c:/novell/ndk/cldapsdk/win32
48 # Edit the path below to point to the base of your c-ares package.
50 LIBCARES_PATH = $(PROOT)/ares
53 # Edit the var below to set to your architecture or set environment var.
60 CFLAGS += -fno-strict-aliasing
64 # comment LDFLAGS below to keep debug info
67 RCFLAGS = --include-dir=$(PROOT)/include -O COFF -i
72 # We may need these someday
76 ########################################################
77 ## Nothing more to do below this line!
79 ifeq ($(findstring -dyn,$(CFG)),-dyn)
82 ifeq ($(findstring -ares,$(CFG)),-ares)
85 ifeq ($(findstring -rtmp,$(CFG)),-rtmp)
90 ifeq ($(findstring -ssh2,$(CFG)),-ssh2)
95 ifeq ($(findstring -ssl,$(CFG)),-ssl)
98 ifeq ($(findstring -zlib,$(CFG)),-zlib)
101 ifeq ($(findstring -idn,$(CFG)),-idn)
104 ifeq ($(findstring -winidn,$(CFG)),-winidn)
107 ifeq ($(findstring -sspi,$(CFG)),-sspi)
110 ifeq ($(findstring -spnego,$(CFG)),-spnego)
113 ifeq ($(findstring -ldaps,$(CFG)),-ldaps)
116 ifeq ($(findstring -ipv6,$(CFG)),-ipv6)
120 INCLUDES = -I. -I.. -I../include -I../lib
123 curl_DEPENDENCIES = $(PROOT)/lib/libcurldll.a $(PROOT)/lib/libcurl.dll
124 curl_LDADD = -L$(PROOT)/lib -lcurldll
126 curl_DEPENDENCIES = $(PROOT)/lib/libcurl.a
127 curl_LDADD = -L$(PROOT)/lib -lcurl
128 CFLAGS += -DCURL_STATICLIB
132 curl_DEPENDENCIES += $(LIBCARES_PATH)/libcares.a
135 curl_LDADD += -L"$(LIBCARES_PATH)" -lcares
138 CFLAGS += -DUSE_LIBRTMP
139 curl_LDADD += -L"$(LIBRTMP_PATH)/librtmp" -lrtmp -lwinmm
142 CFLAGS += -DUSE_LIBSSH2 -DHAVE_LIBSSH2_H
143 curl_LDADD += -L"$(LIBSSH2_PATH)/win32" -lssh2
146 ifndef OPENSSL_LIBPATH
147 ifeq "$(wildcard $(OPENSSL_PATH)/out)" "$(OPENSSL_PATH)/out"
148 OPENSSL_LIBPATH = $(OPENSSL_PATH)/out
149 OPENSSL_LIBS = -leay32 -lssl32
151 ifeq "$(wildcard $(OPENSSL_PATH)/lib)" "$(OPENSSL_PATH)/lib"
152 OPENSSL_LIBPATH = $(OPENSSL_PATH)/lib
153 OPENSSL_LIBS = -lcrypto -lssl
156 CFLAGS += -DUSE_SSLEAY -DHAVE_OPENSSL_ENGINE_H
157 curl_LDADD += -L"$(OPENSSL_LIBPATH)" $(OPENSSL_LIBS)
160 INCLUDES += -I"$(ZLIB_PATH)"
161 CFLAGS += -DHAVE_LIBZ -DHAVE_ZLIB_H
162 curl_LDADD += -L"$(ZLIB_PATH)" -lz
165 CFLAGS += -DUSE_LIBIDN
166 curl_LDADD += -L"$(LIBIDN_PATH)/lib" -lidn
169 CFLAGS += -DUSE_WIN32_IDN
170 curl_LDADD += -L"$(WINIDN_PATH)" -lnormaliz
174 CFLAGS += -DUSE_WINDOWS_SSPI
177 CFLAGS += -DHAVE_SPNEGO
180 CFLAGS += -DENABLE_IPV6 -D_WIN32_WINNT=0x0501
183 CFLAGS += -DHAVE_LDAP_SSL
185 ifdef USE_LDAP_NOVELL
186 CFLAGS += -DCURL_HAS_NOVELL_LDAPSDK
187 curl_LDADD += -L"$(LDAP_SDK)/lib/mscvc" -lldapsdk -lldapssl -lldapx
189 ifdef USE_LDAP_OPENLDAP
190 CFLAGS += -DCURL_HAS_OPENLDAP_LDAPSDK
191 curl_LDADD += -L"$(LDAP_SDK)/lib" -lldap -llber
193 ifndef USE_LDAP_NOVELL
194 ifndef USE_LDAP_OPENLDAP
195 curl_LDADD += -lwldap32
198 curl_LDADD += -lws2_32
200 # Makefile.inc provides the CSOURCES and HHEADERS defines
203 curl_PROGRAMS = curl.exe
204 curl_OBJECTS := $(patsubst %.c,%.o,$(strip $(CURL_CFILES)))
205 curlx_OBJECTS := $(patsubst %.c,%.o,$(notdir $(strip $(CURLX_ONES))))
207 curl_OBJECTS += $(curlx_OBJECTS)
208 vpath %.c $(PROOT)/lib
214 all: $(curl_PROGRAMS)
216 curl.exe: $(RESOURCE) $(curl_OBJECTS) $(curl_DEPENDENCIES)
218 $(CC) $(LDFLAGS) -o $@ $< $(curl_OBJECTS) $(curl_LDADD)
220 # We don't have nroff normally under win32
221 # hugehelp.c: $(PROOT)/README.curl $(PROOT)/curl.1 mkhelp.pl
223 # $(NROFF) -man $(PROOT)/curl.1 | $(PERL) mkhelp.pl $(PROOT)/README.curl > hugehelp.c
227 @$(CP) hugehelp.c.cvs $@
230 $(CC) $(INCLUDES) $(CFLAGS) -c $<
233 $(RC) $(RCFLAGS) $< -o $@
236 ifeq "$(wildcard hugehelp.c.cvs)" "hugehelp.c.cvs"
239 -$(RM) $(curl_OBJECTS) $(curlx_OBJECTS) $(RESOURCE)
241 distclean vclean: clean
242 -$(RM) $(curl_PROGRAMS)