1 #***************************************************************************
3 # Project ___| | | | _ \| |
5 # | (__| |_| | _ <| |___
6 # \___|\___/|_| \_\_____|
8 # Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
10 # This software is licensed as described in the file COPYING, which
11 # you should have received as part of this distribution. The terms
12 # are also available at http://curl.haxx.se/docs/copyright.html.
14 # You may opt to use, copy, modify, merge, publish, distribute and/or sell
15 # copies of the Software, and permit persons to whom the Software is
16 # furnished to do so, under the terms of the COPYING file.
18 # This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19 # KIND, either express or implied.
21 ###########################################################################
23 ## Makefile for building curl examples with MingW (GCC-3.2 or later)
24 ## and optionally OpenSSL (0.9.8), libssh2 (1.3), zlib (1.2.5), librtmp (2.3)
26 ## Usage: mingw32-make -f Makefile.m32 CFG=-feature1[-feature2][-feature3][...]
27 ## Example: mingw32-make -f Makefile.m32 CFG=-zlib-ssl-spi-winidn
29 ## Hint: you can also set environment vars to control the build, f.e.:
30 ## set ZLIB_PATH=c:/zlib-1.2.8
33 ###########################################################################
35 # Edit the path below to point to the base of your Zlib sources.
37 ZLIB_PATH = ../../../zlib-1.2.8
39 # Edit the path below to point to the base of your OpenSSL package.
41 OPENSSL_PATH = ../../../openssl-0.9.8y
43 # Edit the path below to point to the base of your LibSSH2 package.
45 LIBSSH2_PATH = ../../../libssh2-1.4.3
47 # Edit the path below to point to the base of your librtmp package.
49 LIBRTMP_PATH = ../../../librtmp-2.3
51 # Edit the path below to point to the base of your libidn package.
53 LIBIDN_PATH = ../../../libidn-1.18
55 # Edit the path below to point to the base of your MS IDN package.
56 # Microsoft Internationalized Domain Names (IDN) Mitigation APIs 1.1
57 # http://www.microsoft.com/downloads/en/details.aspx?FamilyID=ad6158d7-ddba-416a-9109-07607425a815
59 WINIDN_PATH = ../../../Microsoft IDN Mitigation APIs
61 # Edit the path below to point to the base of your Novell LDAP NDK.
63 LDAP_SDK = c:/novell/ndk/cldapsdk/win32
68 # Edit the path below to point to the base of your c-ares package.
70 LIBCARES_PATH = $(PROOT)/ares
73 # Edit the var below to set to your architecture or set environment var.
78 CC = $(CROSSPREFIX)gcc
80 CFLAGS += -fno-strict-aliasing
84 # comment LDFLAGS below to keep debug info
86 RC = $(CROSSPREFIX)windres
87 RCFLAGS = --include-dir=$(PROOT)/include -O COFF -i
89 # Platform-dependent helper tool macros
90 ifeq ($(findstring /sh,$(SHELL)),/sh)
95 #COPYR = -cp -afr $1/* $2
96 COPYR = -rsync -aC $1/* $2
102 ifeq "$(OS)" "Windows_NT"
103 DEL = -del 2>NUL /q /f $(subst /,\,$1)
104 RMDIR = -rd 2>NUL /q /s $(subst /,\,$1)
106 DEL = -del 2>NUL $(subst /,\,$1)
107 RMDIR = -deltree 2>NUL /y $(subst /,\,$1)
109 MKDIR = -md 2>NUL $(subst /,\,$1)
110 COPY = -copy 2>NUL /y $(subst /,\,$1) $(subst /,\,$2)
111 COPYR = -xcopy 2>NUL /q /y /e $(subst /,\,$1) $(subst /,\,$2)
112 TOUCH = copy 2>&1>NUL /b $(subst /,\,$1) +,,
114 ECHONL = $(ComSpec) /c echo.
117 ########################################################
118 ## Nothing more to do below this line!
120 ifeq ($(findstring -dyn,$(CFG)),-dyn)
123 ifeq ($(findstring -ares,$(CFG)),-ares)
126 ifeq ($(findstring -rtmp,$(CFG)),-rtmp)
131 ifeq ($(findstring -ssh2,$(CFG)),-ssh2)
136 ifeq ($(findstring -ssl,$(CFG)),-ssl)
139 ifeq ($(findstring -zlib,$(CFG)),-zlib)
142 ifeq ($(findstring -idn,$(CFG)),-idn)
145 ifeq ($(findstring -winidn,$(CFG)),-winidn)
148 ifeq ($(findstring -sspi,$(CFG)),-sspi)
151 ifeq ($(findstring -spnego,$(CFG)),-spnego)
154 ifeq ($(findstring -ldaps,$(CFG)),-ldaps)
157 ifeq ($(findstring -ipv6,$(CFG)),-ipv6)
160 ifeq ($(findstring -metalink,$(CFG)),-metalink)
163 ifeq ($(findstring -winssl,$(CFG)),-winssl)
168 INCLUDES = -I. -I$(PROOT) -I$(PROOT)/include -I$(PROOT)/lib
171 curl_DEPENDENCIES = $(PROOT)/lib/libcurldll.a $(PROOT)/lib/libcurl.dll
172 curl_LDADD = -L$(PROOT)/lib -lcurldll
174 curl_DEPENDENCIES = $(PROOT)/lib/libcurl.a
175 curl_LDADD = -L$(PROOT)/lib -lcurl
176 CFLAGS += -DCURL_STATICLIB
181 curl_DEPENDENCIES += $(LIBCARES_PATH)/libcares.a
184 curl_LDADD += -L"$(LIBCARES_PATH)" -lcares
187 CFLAGS += -DUSE_LIBRTMP
188 curl_LDADD += -L"$(LIBRTMP_PATH)/librtmp" -lrtmp -lwinmm
191 CFLAGS += -DUSE_LIBSSH2 -DHAVE_LIBSSH2_H
192 curl_LDADD += -L"$(LIBSSH2_PATH)/win32" -lssh2
195 ifndef OPENSSL_LIBPATH
196 OPENSSL_LIBS = -lssl -lcrypto
197 ifeq "$(wildcard $(OPENSSL_PATH)/out)" "$(OPENSSL_PATH)/out"
198 OPENSSL_LIBPATH = $(OPENSSL_PATH)/out
200 OPENSSL_LIBS = -lssl32 -leay32
203 ifeq "$(wildcard $(OPENSSL_PATH)/lib)" "$(OPENSSL_PATH)/lib"
204 OPENSSL_LIBPATH = $(OPENSSL_PATH)/lib
208 OPENSSL_LIBS += -lgdi32 -lcrypt32
210 CFLAGS += -DUSE_SSLEAY
211 curl_LDADD += -L"$(OPENSSL_LIBPATH)" $(OPENSSL_LIBS)
214 INCLUDES += -I"$(ZLIB_PATH)"
215 CFLAGS += -DHAVE_LIBZ -DHAVE_ZLIB_H
216 curl_LDADD += -L"$(ZLIB_PATH)" -lz
219 CFLAGS += -DUSE_LIBIDN
220 curl_LDADD += -L"$(LIBIDN_PATH)/lib" -lidn
223 CFLAGS += -DUSE_WIN32_IDN
224 curl_LDADD += -L"$(WINIDN_PATH)" -lnormaliz
228 CFLAGS += -DUSE_WINDOWS_SSPI
230 CFLAGS += -DUSE_SCHANNEL
234 CFLAGS += -DHAVE_SPNEGO
237 CFLAGS += -DENABLE_IPV6 -D_WIN32_WINNT=0x0501
240 CFLAGS += -DHAVE_LDAP_SSL
242 ifdef USE_LDAP_NOVELL
243 CFLAGS += -DCURL_HAS_NOVELL_LDAPSDK
244 curl_LDADD += -L"$(LDAP_SDK)/lib/mscvc" -lldapsdk -lldapssl -lldapx
246 ifdef USE_LDAP_OPENLDAP
247 CFLAGS += -DCURL_HAS_OPENLDAP_LDAPSDK
248 curl_LDADD += -L"$(LDAP_SDK)/lib" -lldap -llber
250 ifndef USE_LDAP_NOVELL
251 ifndef USE_LDAP_OPENLDAP
252 curl_LDADD += -lwldap32
255 curl_LDADD += -lws2_32
257 # Makefile.inc provides the check_PROGRAMS and COMPLICATED_EXAMPLES defines
260 check_PROGRAMS := $(patsubst %,%.exe,$(strip $(check_PROGRAMS)))
261 check_PROGRAMS += ftpuploadresume.exe synctime.exe
266 all: $(check_PROGRAMS)
268 %.exe: %.o $(curl_DEPENDENCIES)
269 $(CC) $(LDFLAGS) -o $@ $< $(curl_LDADD)
272 $(CC) $(INCLUDES) $(CFLAGS) -c $<
275 $(RC) $(RCFLAGS) $< -o $@
278 @$(call DEL, $(check_PROGRAMS:.exe=.o))
280 distclean vclean: clean
281 @$(call DEL, $(check_PROGRAMS))