1 #########################################################################
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] [IDN=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 libidn package.
32 LIBIDN_PATH = ../../libidn-1.9
34 # Edit the path below to point to the base of your Novell LDAP NDK.
36 LDAP_SDK = c:/novell/ndk/cldapsdk/win32
43 # comment LDFLAGS below to keep debug info
47 RCFLAGS = --include-dir=../include -DCURLDEBUG=0 -O COFF -i
48 RM = del /q /f > NUL 2>&1
51 ########################################################
52 ## Nothing more to do below this line!
54 INCLUDES = -I. -I../include
55 CFLAGS = -g -O2 -DBUILDING_LIBCURL
57 INCLUDES += -I$(ARES_LIB)
59 DLL_LIBS += -L$(ARES_LIB) -lcares
60 libcurl_dll_DEPENDENCIES = $(ARES_LIB)/libcares.a
63 INCLUDES += -I"$(LIBSSH2_PATH)/include" -I"$(LIBSSH2_PATH)/win32"
64 CFLAGS += -DUSE_LIBSSH2 -DHAVE_LIBSSH2_H
65 DLL_LIBS += -L$(LIBSSH2_PATH)/win32 -lssh2
68 INCLUDES += -I"$(OPENSSL_PATH)/outinc" -I"$(OPENSSL_PATH)/outinc/openssl"
69 CFLAGS += -DUSE_SSLEAY -DUSE_OPENSSL -DHAVE_OPENSSL_ENGINE_H -DHAVE_OPENSSL_PKCS12_H \
70 -DHAVE_ENGINE_LOAD_BUILTIN_ENGINES -DOPENSSL_NO_KRB5 \
71 -DCURL_WANTS_CA_BUNDLE_ENV
72 DLL_LIBS += -L$(OPENSSL_PATH)/out -leay32 -lssl32
75 INCLUDES += -I"$(ZLIB_PATH)"
76 CFLAGS += -DHAVE_LIBZ -DHAVE_ZLIB_H
77 DLL_LIBS += -L$(ZLIB_PATH) -lz
80 INCLUDES += -I"$(LIBIDN_PATH)/include"
81 CFLAGS += -DUSE_LIBIDN
82 DLL_LIBS += -L$(LIBIDN_PATH)/lib -lidn
85 CFLAGS += -DUSE_WINDOWS_SSPI
88 CFLAGS += -DENABLE_IPV6
91 CFLAGS += -DHAVE_LDAP_SSL
94 INCLUDES += -I"$(LDAP_SDK)/inc"
95 CFLAGS += -DCURL_HAS_NOVELL_LDAPSDK
96 DLL_LIBS += -L"$(LDAP_SDK)/lib/mscvc" -lldapsdk -lldapssl -lldapx
98 ifdef USE_LDAP_OPENLDAP
99 INCLUDES += -I"$(LDAP_SDK)/include"
100 CFLAGS += -DCURL_HAS_OPENLDAP_LDAPSDK
101 DLL_LIBS += -L"$(LDAP_SDK)/lib" -lldap -llber
103 ifndef USE_LDAP_NOVELL
104 ifndef USE_LDAP_OPENLDAP
105 DLL_LIBS += -lwldap32
109 COMPILE = $(CC) $(INCLUDES) $(CFLAGS)
111 # Makefile.inc provides the CSOURCES and HHEADERS defines
114 libcurl_dll_LIBRARY = libcurl.dll
115 libcurl_dll_a_LIBRARY = libcurldll.a
116 libcurl_a_LIBRARY = libcurl.a
118 libcurl_a_OBJECTS := $(patsubst %.c,%.o,$(strip $(CSOURCES)))
119 libcurl_a_DEPENDENCIES := $(strip $(CSOURCES) $(HHEADERS))
121 RESOURCE = libcurl.res
125 all: $(libcurl_a_LIBRARY) $(libcurl_dll_LIBRARY)
127 $(libcurl_a_LIBRARY): $(libcurl_a_OBJECTS) $(libcurl_a_DEPENDENCIES)
129 $(AR) cru $@ $(libcurl_a_OBJECTS)
133 # remove the last line above to keep debug info
135 $(libcurl_dll_LIBRARY): $(libcurl_a_OBJECTS) $(RESOURCE) $(libcurl_dll_DEPENDENCIES)
137 $(CC) $(LDFLAGS) -shared -Wl,--out-implib,$(libcurl_dll_a_LIBRARY) \
138 -o $@ $(libcurl_a_OBJECTS) $(RESOURCE) $(DLL_LIBS)
144 $(RC) $(RCFLAGS) $< -o $@
147 -$(RM) $(libcurl_a_OBJECTS) $(RESOURCE)
150 -$(RM) $(libcurl_a_LIBRARY) $(libcurl_dll_LIBRARY) $(libcurl_dll_a_LIBRARY)
154 $(ARES_LIB)/libcares.a:
155 $(MAKE) -C $(ARES_LIB) -f Makefile.m32