1 #########################################################################
2 # $Id: Makefile.m32,v 1.1.1.1 2008-09-23 16:32:05 hoffman Exp $
4 ## Makefile for building libcurl.a with MingW32 (GCC-3.2)
5 ## and optionally OpenSSL (0.9.8), libssh2 (0.18), zlib (1.2.3)
8 ## mingw32-make -f Makefile.m32 [SSL=1] [SSH2=1] [ZLIB=1] [SSPI=1] [IPV6=1] [DYN=1]
10 ## Hint: you can also set environment vars to control the build, f.e.:
11 ## set ZLIB_PATH=c:/zlib-1.2.3
14 ## Comments to: Troy Engel <tengel@sonic.net> or
15 ## Joern Hartroth <hartroth@acm.org>
16 #########################################################################
18 # Edit the path below to point to the base of your Zlib sources.
20 ZLIB_PATH = ../../zlib-1.2.3
22 # Edit the path below to point to the base of your OpenSSL package.
24 OPENSSL_PATH = ../../openssl-0.9.8g
26 # Edit the path below to point to the base of your LibSSH2 package.
28 LIBSSH2_PATH = ../../libssh2-0.18
30 # Edit the path below to point to the base of your Novell LDAP NDK.
32 LDAP_SDK = c:/novell/ndk/cldapsdk/win32
39 # comment LDFLAGS below to keep debug info
43 RCFLAGS = --include-dir=../include -DCURLDEBUG=0 -O COFF -i
44 RM = del /q /f > NUL 2>&1
47 ########################################################
48 ## Nothing more to do below this line!
50 INCLUDES = -I. -I../include
51 CFLAGS = -g -O2 -DBUILDING_LIBCURL
53 INCLUDES += -I$(ARES_LIB)
55 DLL_LIBS += -L$(ARES_LIB) -lcares
56 libcurl_dll_DEPENDENCIES = $(ARES_LIB)/libcares.a
59 INCLUDES += -I"$(LIBSSH2_PATH)/include" -I"$(LIBSSH2_PATH)/win32"
60 CFLAGS += -DUSE_LIBSSH2 -DHAVE_LIBSSH2_H
61 DLL_LIBS += -L$(LIBSSH2_PATH)/win32 -lssh2
64 INCLUDES += -I"$(OPENSSL_PATH)/outinc" -I"$(OPENSSL_PATH)/outinc/openssl"
65 CFLAGS += -DUSE_SSLEAY -DUSE_OPENSSL -DHAVE_OPENSSL_ENGINE_H -DHAVE_OPENSSL_PKCS12_H \
66 -DHAVE_ENGINE_LOAD_BUILTIN_ENGINES -DOPENSSL_NO_KRB5 \
67 -DCURL_WANTS_CA_BUNDLE_ENV
68 DLL_LIBS += -L$(OPENSSL_PATH)/out -leay32 -lssl32
71 INCLUDES += -I"$(ZLIB_PATH)"
72 CFLAGS += -DHAVE_LIBZ -DHAVE_ZLIB_H
73 DLL_LIBS += -L$(ZLIB_PATH) -lz
76 CFLAGS += -DUSE_WINDOWS_SSPI
79 CFLAGS += -DENABLE_IPV6
82 CFLAGS += -DHAVE_LDAP_SSL
85 INCLUDES += -I"$(LDAP_SDK)/inc"
86 CFLAGS += -DCURL_HAS_NOVELL_LDAPSDK
87 DLL_LIBS += -L"$(LDAP_SDK)/lib/mscvc" -lldapsdk -lldapssl -lldapx
89 ifdef USE_LDAP_OPENLDAP
90 INCLUDES += -I"$(LDAP_SDK)/include"
91 CFLAGS += -DCURL_HAS_OPENLDAP_LDAPSDK
92 DLL_LIBS += -L"$(LDAP_SDK)/lib" -lldap -llber
94 ifndef USE_LDAP_NOVELL
95 ifndef USE_LDAP_OPENLDAP
100 COMPILE = $(CC) $(INCLUDES) $(CFLAGS)
102 # Makefile.inc provides the CSOURCES and HHEADERS defines
105 libcurl_dll_LIBRARY = libcurl.dll
106 libcurl_dll_a_LIBRARY = libcurldll.a
107 libcurl_a_LIBRARY = libcurl.a
109 libcurl_a_OBJECTS := $(patsubst %.c,%.o,$(strip $(CSOURCES)))
110 libcurl_a_DEPENDENCIES := $(strip $(CSOURCES) $(HHEADERS))
112 RESOURCE = libcurl.res
116 all: $(libcurl_a_LIBRARY) $(libcurl_dll_LIBRARY)
118 $(libcurl_a_LIBRARY): $(libcurl_a_OBJECTS) $(libcurl_a_DEPENDENCIES)
120 $(AR) cru $@ $(libcurl_a_OBJECTS)
124 # remove the last line above to keep debug info
126 $(libcurl_dll_LIBRARY): $(libcurl_a_OBJECTS) $(RESOURCE) $(libcurl_dll_DEPENDENCIES)
128 $(CC) $(LDFLAGS) -shared -Wl,--out-implib,$(libcurl_dll_a_LIBRARY) \
129 -o $@ $(libcurl_a_OBJECTS) $(RESOURCE) $(DLL_LIBS)
135 $(RC) $(RCFLAGS) $< -o $@
138 -$(RM) $(libcurl_a_OBJECTS) $(RESOURCE)
141 -$(RM) $(libcurl_a_LIBRARY) $(libcurl_dll_LIBRARY) $(libcurl_dll_a_LIBRARY)
145 $(ARES_LIB)/libcares.a:
146 $(MAKE) -C $(ARES_LIB) -f Makefile.m32