1########################################################################### 2# 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) 5## 6## Usage: mingw32-make -f Makefile.m32 CFG=-feature1[-feature2][-feature3][...] 7## Example: mingw32-make -f Makefile.m32 CFG=-zlib-ssl-spi-winidn 8## 9## Hint: you can also set environment vars to control the build, f.e.: 10## set ZLIB_PATH=c:/zlib-1.2.5 11## set ZLIB=1 12# 13########################################################################### 14 15# Edit the path below to point to the base of your Zlib sources. 16ifndef ZLIB_PATH 17ZLIB_PATH = ../../zlib-1.2.5 18endif 19# Edit the path below to point to the base of your OpenSSL package. 20ifndef OPENSSL_PATH 21OPENSSL_PATH = ../../openssl-0.9.8r 22endif 23ifndef OPENSSL_LIBPATH 24OPENSSL_LIBPATH = $(OPENSSL_PATH)/out 25endif 26ifndef OPENSSL_LIBS 27OPENSSL_LIBS = -leay32 -lssl32 28endif 29# Edit the path below to point to the base of your LibSSH2 package. 30ifndef LIBSSH2_PATH 31LIBSSH2_PATH = ../../libssh2-1.3.0 32endif 33# Edit the path below to point to the base of your librtmp package. 34ifndef LIBRTMP_PATH 35LIBRTMP_PATH = ../../librtmp-2.3 36endif 37# Edit the path below to point to the base of your libidn package. 38ifndef LIBIDN_PATH 39LIBIDN_PATH = ../../libidn-1.18 40endif 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 44ifndef WINIDN_PATH 45WINIDN_PATH = ../../Microsoft IDN Mitigation APIs 46endif 47# Edit the path below to point to the base of your Novell LDAP NDK. 48ifndef LDAP_SDK 49LDAP_SDK = c:/novell/ndk/cldapsdk/win32 50endif 51 52PROOT = .. 53 54# Edit the path below to point to the base of your c-ares package. 55ifndef LIBCARES_PATH 56LIBCARES_PATH = $(PROOT)/ares 57endif 58 59# Edit the var below to set to your architecture or set environment var. 60ifndef ARCH 61ARCH = w32 62endif 63 64CC = gcc 65CFLAGS = -g -O2 -Wall 66CFLAGS += -fno-strict-aliasing 67ifeq ($(ARCH),w64) 68CFLAGS += -D_AMD64_ 69endif 70# comment LDFLAGS below to keep debug info 71LDFLAGS = -s 72RC = windres 73RCFLAGS = --include-dir=$(PROOT)/include -O COFF -i 74 75RM = del /q /f 2>NUL 76CP = copy 77 78# We may need these someday 79# PERL = perl 80# NROFF = nroff 81 82######################################################## 83## Nothing more to do below this line! 84 85ifeq ($(findstring -dyn,$(CFG)),-dyn) 86DYN = 1 87endif 88ifeq ($(findstring -ares,$(CFG)),-ares) 89ARES = 1 90endif 91ifeq ($(findstring -rtmp,$(CFG)),-rtmp) 92RTMP = 1 93SSL = 1 94ZLIB = 1 95endif 96ifeq ($(findstring -ssh2,$(CFG)),-ssh2) 97SSH2 = 1 98SSL = 1 99ZLIB = 1 100endif 101ifeq ($(findstring -ssl,$(CFG)),-ssl) 102SSL = 1 103endif 104ifeq ($(findstring -zlib,$(CFG)),-zlib) 105ZLIB = 1 106endif 107ifeq ($(findstring -idn,$(CFG)),-idn) 108IDN = 1 109endif 110ifeq ($(findstring -winidn,$(CFG)),-winidn) 111WINIDN = 1 112endif 113ifeq ($(findstring -sspi,$(CFG)),-sspi) 114SSPI = 1 115endif 116ifeq ($(findstring -spnego,$(CFG)),-spnego) 117SPNEGO = 1 118endif 119ifeq ($(findstring -ldaps,$(CFG)),-ldaps) 120LDAPS = 1 121endif 122ifeq ($(findstring -ipv6,$(CFG)),-ipv6) 123IPV6 = 1 124endif 125 126INCLUDES = -I. -I.. -I../include -I../lib 127 128ifdef DYN 129 curl_DEPENDENCIES = $(PROOT)/lib/libcurldll.a $(PROOT)/lib/libcurl.dll 130 curl_LDADD = -L$(PROOT)/lib -lcurldll 131else 132 curl_DEPENDENCIES = $(PROOT)/lib/libcurl.a 133 curl_LDADD = -L$(PROOT)/lib -lcurl 134 CFLAGS += -DCURL_STATICLIB 135endif 136ifdef ARES 137 ifndef DYN 138 curl_DEPENDENCIES += $(LIBCARES_PATH)/libcares.a 139 endif 140 CFLAGS += -DUSE_ARES 141 curl_LDADD += -L"$(LIBCARES_PATH)" -lcares 142endif 143ifdef RTMP 144 CFLAGS += -DUSE_LIBRTMP 145 curl_LDADD += -L"$(LIBRTMP_PATH)/librtmp" -lrtmp -lwinmm 146endif 147ifdef SSH2 148 CFLAGS += -DUSE_LIBSSH2 -DHAVE_LIBSSH2_H 149 curl_LDADD += -L"$(LIBSSH2_PATH)/win32" -lssh2 150endif 151ifdef SSL 152 CFLAGS += -DUSE_SSLEAY -DHAVE_OPENSSL_ENGINE_H 153 curl_LDADD += -L"$(OPENSSL_LIBPATH)" $(OPENSSL_LIBS) 154endif 155ifdef ZLIB 156 INCLUDES += -I"$(ZLIB_PATH)" 157 CFLAGS += -DHAVE_LIBZ -DHAVE_ZLIB_H 158 curl_LDADD += -L"$(ZLIB_PATH)" -lz 159endif 160ifdef IDN 161 CFLAGS += -DUSE_LIBIDN 162 curl_LDADD += -L"$(LIBIDN_PATH)/lib" -lidn 163else 164ifdef WINIDN 165 CFLAGS += -DUSE_WIN32_IDN 166 curl_LDADD += -L"$(WINIDN_PATH)" -lnormaliz 167endif 168endif 169ifdef SSPI 170 CFLAGS += -DUSE_WINDOWS_SSPI 171endif 172ifdef SPNEGO 173 CFLAGS += -DHAVE_SPNEGO 174endif 175ifdef IPV6 176 CFLAGS += -DENABLE_IPV6 -D_WIN32_WINNT=0x0501 177endif 178ifdef LDAPS 179 CFLAGS += -DHAVE_LDAP_SSL 180endif 181ifdef USE_LDAP_NOVELL 182 CFLAGS += -DCURL_HAS_NOVELL_LDAPSDK 183 curl_LDADD += -L"$(LDAP_SDK)/lib/mscvc" -lldapsdk -lldapssl -lldapx 184endif 185ifdef USE_LDAP_OPENLDAP 186 CFLAGS += -DCURL_HAS_OPENLDAP_LDAPSDK 187 curl_LDADD += -L"$(LDAP_SDK)/lib" -lldap -llber 188endif 189ifndef USE_LDAP_NOVELL 190ifndef USE_LDAP_OPENLDAP 191curl_LDADD += -lwldap32 192endif 193endif 194curl_LDADD += -lws2_32 195 196# Makefile.inc provides the CSOURCES and HHEADERS defines 197include Makefile.inc 198 199curl_PROGRAMS = curl.exe 200curl_OBJECTS := $(patsubst %.c,%.o,$(strip $(CURL_CFILES))) 201curlx_OBJECTS := $(patsubst %.c,%.o,$(notdir $(strip $(CURLX_ONES)))) 202ifdef DYN 203curl_OBJECTS += $(curlx_OBJECTS) 204vpath %.c $(PROOT)/lib 205endif 206 207RESOURCE = curl.res 208 209 210all: $(curl_PROGRAMS) 211 212curl.exe: $(RESOURCE) $(curl_OBJECTS) $(curl_DEPENDENCIES) 213 -$(RM) $@ 214 $(CC) $(LDFLAGS) -o $@ $< $(curl_OBJECTS) $(curl_LDADD) 215 216# We don't have nroff normally under win32 217# hugehelp.c: $(PROOT)/README.curl $(PROOT)/curl.1 mkhelp.pl 218# -$(RM) hugehelp.c 219# $(NROFF) -man $(PROOT)/curl.1 | $(PERL) mkhelp.pl $(PROOT)/README.curl > hugehelp.c 220 221hugehelp.c: 222 @echo Creating $@ 223 @$(CP) hugehelp.c.cvs $@ 224 225%.o: %.c 226 $(CC) $(INCLUDES) $(CFLAGS) -c $< 227 228%.res: %.rc 229 $(RC) $(RCFLAGS) $< -o $@ 230 231clean: 232ifeq "$(wildcard hugehelp.c.cvs)" "hugehelp.c.cvs" 233 -$(RM) hugehelp.c 234endif 235 -$(RM) $(curl_OBJECTS) $(curlx_OBJECTS) $(RESOURCE) 236 237distclean vclean: clean 238 -$(RM) $(curl_PROGRAMS) 239 240