1 #########################################################################
3 ## Makefile for building libcurl.a with MingW32 (GCC-3.2 or later)
4 ## and optionally OpenSSL (0.9.8), libssh2 (1.2), zlib (1.2.5)
7 ## mingw32-make -f Makefile.m32 [SSL=1] [SSH2=1] [ZLIB=1] [IDN=1] [SSPI=1] [IPV6=1] [LDAPS=1] [RTMP=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.5
13 ## Comments to: Troy Engel <tengel@sonic.net> or
14 ## Joern Hartroth <hartroth@acm.org>
15 #########################################################################
17 # Edit the path below to point to the base of your Zlib sources.
19 ZLIB_PATH = ../../zlib-1.2.5
21 # Edit the path below to point to the base of your OpenSSL package.
23 OPENSSL_PATH = ../../openssl-0.9.8q
25 # Edit the path below to point to the base of your LibSSH2 package.
27 LIBSSH2_PATH = ../../libssh2-1.2.7
29 # Edit the path below to point to the base of your libidn package.
31 LIBIDN_PATH = ../../libidn-1.18
33 # Edit the path below to point to the base of your librtmp package.
35 LIBRTMP_PATH = ../../librtmp-2.3
37 # Edit the path below to point to the base of your Novell LDAP NDK.
39 LDAP_SDK = c:/novell/ndk/cldapsdk/win32
42 # Edit the path below to point to the base of your c-ares package.
44 LIBCARES_PATH = ../ares
49 # comment LDFLAGS below to keep debug info
53 RCFLAGS = --include-dir=../include -DDEBUGBUILD=0 -O COFF -i
57 ########################################################
58 ## Nothing more to do below this line!
60 INCLUDES = -I. -I../include
61 CFLAGS = -g -O2 -DBUILDING_LIBCURL
63 INCLUDES += -I$(LIBCARES_PATH)
65 DLL_LIBS += -L$(LIBCARES_PATH) -lcares
66 libcurl_dll_DEPENDENCIES = $(LIBCARES_PATH)/libcares.a
69 INCLUDES += -I"$(LIBRTMP_PATH)"
70 CFLAGS += -DUSE_LIBRTMP
71 DLL_LIBS += -L"$(LIBRTMP_PATH)/librtmp" -lrtmp -lwinmm
74 INCLUDES += -I"$(LIBSSH2_PATH)/include" -I"$(LIBSSH2_PATH)/win32"
75 CFLAGS += -DUSE_LIBSSH2 -DHAVE_LIBSSH2_H
76 DLL_LIBS += -L$(LIBSSH2_PATH)/win32 -lssh2
79 INCLUDES += -I"$(OPENSSL_PATH)/outinc" -I"$(OPENSSL_PATH)/outinc/openssl"
80 CFLAGS += -DUSE_SSLEAY -DUSE_OPENSSL -DHAVE_OPENSSL_ENGINE_H -DHAVE_OPENSSL_PKCS12_H \
81 -DHAVE_ENGINE_LOAD_BUILTIN_ENGINES -DOPENSSL_NO_KRB5 \
82 -DCURL_WANTS_CA_BUNDLE_ENV
83 DLL_LIBS += -L$(OPENSSL_PATH)/out -leay32 -lssl32
86 INCLUDES += -I"$(ZLIB_PATH)"
87 CFLAGS += -DHAVE_LIBZ -DHAVE_ZLIB_H
88 DLL_LIBS += -L$(ZLIB_PATH) -lz
91 INCLUDES += -I"$(LIBIDN_PATH)/include"
92 CFLAGS += -DUSE_LIBIDN
93 DLL_LIBS += -L$(LIBIDN_PATH)/lib -lidn
96 CFLAGS += -DUSE_WINDOWS_SSPI
99 CFLAGS += -DENABLE_IPV6
102 CFLAGS += -DHAVE_LDAP_SSL
104 ifdef USE_LDAP_NOVELL
105 INCLUDES += -I"$(LDAP_SDK)/inc"
106 CFLAGS += -DCURL_HAS_NOVELL_LDAPSDK
107 DLL_LIBS += -L"$(LDAP_SDK)/lib/mscvc" -lldapsdk -lldapssl -lldapx
109 ifdef USE_LDAP_OPENLDAP
110 INCLUDES += -I"$(LDAP_SDK)/include"
111 CFLAGS += -DCURL_HAS_OPENLDAP_LDAPSDK
112 DLL_LIBS += -L"$(LDAP_SDK)/lib" -lldap -llber
114 ifndef USE_LDAP_NOVELL
115 ifndef USE_LDAP_OPENLDAP
116 DLL_LIBS += -lwldap32
120 COMPILE = $(CC) $(INCLUDES) $(CFLAGS)
122 # Makefile.inc provides the CSOURCES and HHEADERS defines
125 libcurl_dll_LIBRARY = libcurl.dll
126 libcurl_dll_a_LIBRARY = libcurldll.a
127 libcurl_a_LIBRARY = libcurl.a
129 libcurl_a_OBJECTS := $(patsubst %.c,%.o,$(strip $(CSOURCES)))
130 libcurl_a_DEPENDENCIES := $(strip $(CSOURCES) $(HHEADERS))
132 RESOURCE = libcurl.res
136 all: $(libcurl_a_LIBRARY) $(libcurl_dll_LIBRARY)
138 $(libcurl_a_LIBRARY): $(libcurl_a_OBJECTS) $(libcurl_a_DEPENDENCIES)
140 $(AR) cru $@ $(libcurl_a_OBJECTS)
144 # remove the last line above to keep debug info
146 $(libcurl_dll_LIBRARY): $(libcurl_a_OBJECTS) $(RESOURCE) $(libcurl_dll_DEPENDENCIES)
148 $(CC) $(LDFLAGS) -shared -Wl,--out-implib,$(libcurl_dll_a_LIBRARY) \
149 -o $@ $(libcurl_a_OBJECTS) $(RESOURCE) $(DLL_LIBS)
155 $(RC) $(RCFLAGS) $< -o $@
158 -$(RM) $(libcurl_a_OBJECTS) $(RESOURCE)
160 distclean vclean: clean
161 -$(RM) $(libcurl_a_LIBRARY) $(libcurl_dll_LIBRARY) $(libcurl_dll_a_LIBRARY)
165 $(LIBCARES_PATH)/libcares.a:
166 $(MAKE) -C $(LIBCARES_PATH) -f Makefile.m32