1 #########################################################################
3 ## Makefile for building curl examples with MingW32
4 ## and optionally OpenSSL (0.9.8), libssh2 (0.18), zlib (1.2.3)
7 ## mingw32-make -f Makefile.m32 [SSL=1] [SSH2=1] [ZLIB=1] [SSPI=1] [IPV6=1] [DYN=1]
9 ## Hint: you can also set environment vars to control the build, f.e.:
10 ## set ZLIB_PATH=c:/zlib-1.2.3
13 #########################################################################
15 # Edit the path below to point to the base of your Zlib sources.
17 ZLIB_PATH = ../../zlib-1.2.3
19 # Edit the path below to point to the base of your OpenSSL package.
21 OPENSSL_PATH = ../../openssl-0.9.8k
23 # Edit the path below to point to the base of your LibSSH2 package.
25 LIBSSH2_PATH = ../../libssh2-1.2
27 # Edit the path below to point to the base of your Novell LDAP NDK.
29 LDAP_SDK = c:/novell/ndk/cldapsdk/win32
33 ARES_LIB = $(PROOT)/ares
40 # comment LDFLAGS below to keep debug info
43 RCFLAGS = --include-dir=$(PROOT)/include -O COFF -i
44 RM = del /q /f > NUL 2>&1
47 ########################################################
48 ## Nothing more to do below this line!
50 INCLUDES = -I. -I$(PROOT) -I$(PROOT)/include -I$(PROOT)/lib
51 LINK = $(CC) $(LDFLAGS) -o $@
54 curl_DEPENDENCIES = $(PROOT)/lib/libcurldll.a $(PROOT)/lib/libcurl.dll
55 curl_LDADD = -L$(PROOT)/lib -lcurldll
57 curl_DEPENDENCIES = $(PROOT)/lib/libcurl.a
58 curl_LDADD = -L$(PROOT)/lib -lcurl
59 CFLAGS += -DCURL_STATICLIB
63 curl_DEPENDENCIES += $(ARES_LIB)/libcares.a
66 curl_LDADD += -L$(ARES_LIB) -lcares
69 CFLAGS += -DUSE_LIBSSH2 -DHAVE_LIBSSH2_H
70 curl_LDADD += -L$(LIBSSH2_PATH)/win32 -lssh2
73 INCLUDES += -I"$(OPENSSL_PATH)/outinc"
74 CFLAGS += -DUSE_SSLEAY -DHAVE_OPENSSL_ENGINE_H
76 curl_LDADD += -L$(OPENSSL_PATH)/out -leay32 -lssl32
78 curl_LDADD += -L$(OPENSSL_PATH)/out -lssl -lcrypto -lgdi32
82 INCLUDES += -I"$(ZLIB_PATH)"
83 CFLAGS += -DHAVE_LIBZ -DHAVE_ZLIB_H
84 curl_LDADD += -L$(ZLIB_PATH) -lz
87 CFLAGS += -DUSE_WINDOWS_SSPI
90 CFLAGS += -DENABLE_IPV6
93 CFLAGS += -DHAVE_LDAP_SSL
96 CFLAGS += -DCURL_HAS_NOVELL_LDAPSDK
97 curl_LDADD += -L"$(LDAP_SDK)/lib/mscvc" -lldapsdk -lldapssl -lldapx
99 ifdef USE_LDAP_OPENLDAP
100 CFLAGS += -DCURL_HAS_OPENLDAP_LDAPSDK
101 curl_LDADD += -L"$(LDAP_SDK)/lib" -lldap -llber
103 ifndef USE_LDAP_NOVELL
104 ifndef USE_LDAP_OPENLDAP
105 curl_LDADD += -lwldap32
108 curl_LDADD += -lws2_32
109 COMPILE = $(CC) $(INCLUDES) $(CFLAGS)
111 # Makefile.inc provides the check_PROGRAMS and COMPLICATED_EXAMPLES defines
114 example_PROGRAMS := $(patsubst %,%.exe,$(strip $(check_PROGRAMS)))
116 .SUFFIXES: .rc .res .o .exe
119 all: $(example_PROGRAMS)
121 .o.exe: $(curl_DEPENDENCIES)
122 $(LINK) $< $(curl_LDADD)
128 $(RC) $(RCFLAGS) $< -o $@
131 $(RM) $(example_PROGRAMS)