Resync
[CMakeLuaTailorHgBridge.git] / CMakeLua / Utilities / cmcurl-7.19.0 / lib / Makefile.m32
blobe908060f1f24199d1c53652930f08890aa0ad56d
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)
6 ##
7 ## Usage:
8 ## mingw32-make -f Makefile.m32 [SSL=1] [SSH2=1] [ZLIB=1] [SSPI=1] [IPV6=1] [DYN=1]
9 ##
10 ## Hint: you can also set environment vars to control the build, f.e.:
11 ## set ZLIB_PATH=c:/zlib-1.2.3
12 ## set ZLIB=1
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.
19 ifndef ZLIB_PATH
20 ZLIB_PATH = ../../zlib-1.2.3
21 endif
22 # Edit the path below to point to the base of your OpenSSL package.
23 ifndef OPENSSL_PATH
24 OPENSSL_PATH = ../../openssl-0.9.8g
25 endif
26 # Edit the path below to point to the base of your LibSSH2 package.
27 ifndef LIBSSH2_PATH
28 LIBSSH2_PATH = ../../libssh2-0.18
29 endif
30 # Edit the path below to point to the base of your Novell LDAP NDK.
31 ifndef LDAP_SDK
32 LDAP_SDK = c:/novell/ndk/cldapsdk/win32
33 endif
35 ARES_LIB = ../ares
37 CC = gcc
38 AR = ar
39 # comment LDFLAGS below to keep debug info
40 LDFLAGS = -s
41 RANLIB = ranlib
42 RC = windres
43 RCFLAGS = --include-dir=../include -DCURLDEBUG=0 -O COFF -i
44 RM = del /q /f > NUL 2>&1
45 STRIP = strip -g
47 ########################################################
48 ## Nothing more to do below this line!
50 INCLUDES = -I. -I../include
51 CFLAGS = -g -O2 -DBUILDING_LIBCURL
52 ifdef ARES
53   INCLUDES += -I$(ARES_LIB)
54   CFLAGS += -DUSE_ARES
55   DLL_LIBS += -L$(ARES_LIB) -lcares
56   libcurl_dll_DEPENDENCIES = $(ARES_LIB)/libcares.a
57 endif
58 ifdef SSH2
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
62 endif
63 ifdef SSL
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
69 endif
70 ifdef ZLIB
71   INCLUDES += -I"$(ZLIB_PATH)"
72   CFLAGS += -DHAVE_LIBZ -DHAVE_ZLIB_H
73   DLL_LIBS += -L$(ZLIB_PATH) -lz
74 endif
75 ifdef SSPI
76   CFLAGS += -DUSE_WINDOWS_SSPI
77 endif
78 ifdef IPV6
79   CFLAGS += -DENABLE_IPV6
80 endif
81 ifdef LDAPS
82   CFLAGS += -DHAVE_LDAP_SSL
83 endif
84 ifdef USE_LDAP_NOVELL
85   INCLUDES += -I"$(LDAP_SDK)/inc"
86   CFLAGS += -DCURL_HAS_NOVELL_LDAPSDK
87   DLL_LIBS += -L"$(LDAP_SDK)/lib/mscvc" -lldapsdk -lldapssl -lldapx
88 endif
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
93 endif
94 ifndef USE_LDAP_NOVELL
95 ifndef USE_LDAP_OPENLDAP
96 DLL_LIBS += -lwldap32
97 endif
98 endif
99 DLL_LIBS += -lws2_32
100 COMPILE = $(CC) $(INCLUDES) $(CFLAGS)
102 # Makefile.inc provides the CSOURCES and HHEADERS defines
103 include Makefile.inc
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
114 .SUFFIXES: .rc .res
116 all: $(libcurl_a_LIBRARY) $(libcurl_dll_LIBRARY)
118 $(libcurl_a_LIBRARY): $(libcurl_a_OBJECTS) $(libcurl_a_DEPENDENCIES)
119         -$(RM) $@
120         $(AR) cru $@ $(libcurl_a_OBJECTS)
121         $(RANLIB) $@
122         $(STRIP) $@
124 # remove the last line above to keep debug info
126 $(libcurl_dll_LIBRARY): $(libcurl_a_OBJECTS) $(RESOURCE) $(libcurl_dll_DEPENDENCIES)
127         -$(RM) $@
128         $(CC) $(LDFLAGS) -shared -Wl,--out-implib,$(libcurl_dll_a_LIBRARY) \
129           -o $@ $(libcurl_a_OBJECTS) $(RESOURCE) $(DLL_LIBS)
131 .c.o:
132         $(COMPILE) -c $<
134 .rc.res:
135         $(RC) $(RCFLAGS) $< -o $@
137 clean:
138         -$(RM) $(libcurl_a_OBJECTS) $(RESOURCE)
140 distrib: clean
141         -$(RM) $(libcurl_a_LIBRARY) $(libcurl_dll_LIBRARY) $(libcurl_dll_a_LIBRARY)
143 FORCE: ;
145 $(ARES_LIB)/libcares.a:
146         $(MAKE) -C $(ARES_LIB) -f Makefile.m32