enabled ares build.
[platform/upstream/curl.git] / lib / Makefile.m32
1 #############################################################
2 # $Id$
3 #
4 ## Makefile for building libcurl.a with MingW32 (GCC-3.2) and
5 ## optionally OpenSSL (0.9.8)
6 ##
7 ## Use: make -f Makefile.m32 [SSL=1] [SSH2=1] [DYN=1]
8 ##
9 ## Comments to: Troy Engel <tengel@sonic.net> or
10 ##              Joern Hartroth <hartroth@acm.org>
11
12 ifndef OPENSSL_PATH
13 OPENSSL_PATH = ../../openssl-0.9.8d
14 endif
15 ifndef LIBSSH2_PATH
16 LIBSSH2_PATH = ../../libssh2-0.14
17 endif
18 ifndef ZLIB_PATH
19 ZLIB_PATH = ../../zlib-1.2.3
20 endif
21
22 ARES_LIB = ../ares
23
24 CC = gcc
25 AR = ar
26 RM = rm -f
27 RANLIB = ranlib
28 STRIP = strip -g
29
30 ########################################################
31 ## Nothing more to do below this line!
32
33 INCLUDES = -I. -I../include
34 CFLAGS = -g -O2 -DBUILDING_LIBCURL -DHAVE_LONGLONG
35 ifdef ARES
36   INCLUDES += -I$(ARES_LIB)
37   CFLAGS += -DUSE_ARES
38   DLL_LIBS += -L$(ARES_LIB) -lcares
39 endif
40 ifdef SSH2
41   INCLUDES += -I"$(LIBSSH2_PATH)/include" -I"$(LIBSSH2_PATH)/win32"
42   CFLAGS += -DUSE_LIBSSH2 -DHAVE_LIBSSH2_H
43   DLL_LIBS += -L$(LIBSSH2_PATH)/win32 -lssh2
44 endif
45 ifdef SSL
46   INCLUDES += -I"$(OPENSSL_PATH)/outinc" -I"$(OPENSSL_PATH)/outinc/openssl"
47   CFLAGS += -DUSE_SSLEAY -DUSE_OPENSSL -DHAVE_OPENSSL_ENGINE_H -DHAVE_OPENSSL_PKCS12_H \
48             -DHAVE_ENGINE_LOAD_BUILTIN_ENGINES -DOPENSSL_NO_KRB5 \
49             -DCURL_WANTS_CA_BUNDLE_ENV
50   DLL_LIBS += -L$(OPENSSL_PATH)/out -leay32 -lssl32
51 endif
52 ifdef ZLIB
53   INCLUDES += -I"$(ZLIB_PATH)"
54   CFLAGS += -DHAVE_LIBZ -DHAVE_ZLIB_H
55   DLL_LIBS += -L$(ZLIB_PATH) -lz
56 endif
57 ifdef SSPI
58   CFLAGS += -DUSE_WINDOWS_SSPI
59 endif
60 ifdef IPV6
61   CFLAGS += -DENABLE_IPV6
62 endif
63 COMPILE = $(CC) $(INCLUDES) $(CFLAGS)
64
65 # Makefile.inc provides the CSOURCES and HHEADERS defines
66 include Makefile.inc
67
68 libcurl_a_OBJECTS := $(patsubst %.c,%.o,$(strip $(CSOURCES)))
69
70 libcurl_a_LIBRARIES = libcurl.a
71 libcurl_a_DEPENDENCIES = $(strip $(CSOURCES) $(HHEADERS))
72
73 all: libcurl.a libcurl.dll libcurldll.a
74
75 libcurl.a: $(libcurl_a_OBJECTS) $(libcurl_a_DEPENDENCIES)
76         $(RM) libcurl.a
77         $(AR) cru libcurl.a $(libcurl_a_OBJECTS)
78         $(RANLIB) libcurl.a
79         $(STRIP) $@
80
81 RESOURCE = libcurl.res
82
83 # remove the last line above to keep debug info
84
85 libcurl.dll libcurldll.a: $(libcurl_a_OBJECTS) $(RESOURCE)
86         $(RM) $@
87         $(CC) -s -shared -Wl,--out-implib,libcurldll.a -o libcurl.dll \
88           $(libcurl_a_OBJECTS) $(RESOURCE) $(DLL_LIBS) -lws2_32 -lwinmm
89
90 # remove the above '-s' to keep debug info
91
92 .c.o:
93         $(COMPILE) -c $<
94
95 libcurl.res: libcurl.rc
96         windres -DCURLDEBUG=0 -O COFF -o $@ -i $^
97
98 clean:
99         $(RM) $(libcurl_a_OBJECTS) $(RESOURCE)
100
101 distrib: clean
102         $(RM) $(libcurl_a_LIBRARIES)
103