Git init
[external/curl.git] / src / Makefile.m32
1 #########################################################################
2 #
3 ## Makefile for building curl.exe with MingW32 (GCC-3.2 or later)
4 ## and optionally OpenSSL (0.9.8), libssh2 (1.2), zlib (1.2.5)
5 ##
6 ## Usage:
7 ## mingw32-make -f Makefile.m32 [SSL=1] [SSH2=1] [ZLIB=1] [IDN=1] [SSPI=1] [IPV6=1] [LDAPS=1] [RTMP=1] [DYN=1]
8 ##
9 ## Hint: you can also set environment vars to control the build, f.e.:
10 ## set ZLIB_PATH=c:/zlib-1.2.5
11 ## set ZLIB=1
12 ##
13 ## Comments to: Troy Engel <tengel@sonic.net> or
14 ##              Joern Hartroth <hartroth@acm.org>
15 #########################################################################
16
17 # Edit the path below to point to the base of your Zlib sources.
18 ifndef ZLIB_PATH
19 ZLIB_PATH = ../../zlib-1.2.5
20 endif
21 # Edit the path below to point to the base of your OpenSSL package.
22 ifndef OPENSSL_PATH
23 OPENSSL_PATH = ../../openssl-0.9.8q
24 endif
25 # Edit the path below to point to the base of your LibSSH2 package.
26 ifndef LIBSSH2_PATH
27 LIBSSH2_PATH = ../../libssh2-1.2.7
28 endif
29 # Edit the path below to point to the base of your libidn package.
30 ifndef LIBIDN_PATH
31 LIBIDN_PATH = ../../libidn-1.18
32 endif
33 # Edit the path below to point to the base of your librtmp package.
34 ifndef LIBRTMP_PATH
35 LIBRTMP_PATH = ../../librtmp-2.3
36 endif
37 # Edit the path below to point to the base of your Novell LDAP NDK.
38 ifndef LDAP_SDK
39 LDAP_SDK = c:/novell/ndk/cldapsdk/win32
40 endif
41
42 # Edit the path below to point to the base of your c-ares package.
43 ifndef LIBCARES_PATH
44 LIBCARES_PATH = ../ares
45 endif
46
47 CC = gcc
48 CFLAGS = -g -O2
49 # comment LDFLAGS below to keep debug info
50 LDFLAGS = -s
51 RC = windres
52 RCFLAGS = --include-dir=../include -O COFF -i
53 RM = del /q /f 2>NUL
54 CP = copy
55
56 # We may need these someday
57 # PERL = perl
58 # NROFF = nroff
59
60 ########################################################
61 ## Nothing more to do below this line!
62
63 INCLUDES = -I. -I.. -I../include -I../lib
64 LINK = $(CC) $(LDFLAGS) -o $@
65
66 curl_PROGRAMS = curl.exe
67 ifdef DYN
68   curl_DEPENDENCIES = ../lib/libcurldll.a ../lib/libcurl.dll
69   curl_LDADD = -L../lib -lcurldll
70 else
71   curl_DEPENDENCIES = ../lib/libcurl.a
72   curl_LDADD = -L../lib -lcurl
73   CFLAGS += -DCURL_STATICLIB
74 endif
75 ifdef ARES
76   ifndef DYN
77     curl_DEPENDENCIES += $(LIBCARES_PATH)/libcares.a
78   endif
79   CFLAGS += -DUSE_ARES
80   curl_LDADD += -L$(LIBCARES_PATH) -lcares
81 endif
82 ifdef RTMP
83   CFLAGS += -DUSE_LIBRTMP
84   curl_LDADD += -L"$(LIBRTMP_PATH)/librtmp" -lrtmp -lwinmm
85 endif
86 ifdef SSH2
87   CFLAGS += -DUSE_LIBSSH2 -DHAVE_LIBSSH2_H
88   curl_LDADD += -L$(LIBSSH2_PATH)/win32 -lssh2
89 endif
90 ifdef SSL
91   CFLAGS += -DUSE_SSLEAY -DHAVE_OPENSSL_ENGINE_H
92   curl_LDADD += -L$(OPENSSL_PATH)/out -leay32 -lssl32
93 endif
94 ifdef ZLIB
95   INCLUDES += -I"$(ZLIB_PATH)"
96   CFLAGS += -DHAVE_LIBZ -DHAVE_ZLIB_H
97   curl_LDADD += -L$(ZLIB_PATH) -lz
98 endif
99 ifdef IDN
100   INCLUDES += -I"$(LIBIDN_PATH)/include"
101   CFLAGS += -DUSE_LIBIDN
102   curl_LDADD += -L$(LIBIDN_PATH)/lib -lidn
103 endif
104 ifdef SSPI
105   CFLAGS += -DUSE_WINDOWS_SSPI
106 endif
107 ifdef IPV6
108   CFLAGS += -DENABLE_IPV6
109 endif
110 ifdef LDAPS
111   CFLAGS += -DHAVE_LDAP_SSL
112 endif
113 ifdef USE_LDAP_NOVELL
114   CFLAGS += -DCURL_HAS_NOVELL_LDAPSDK
115   curl_LDADD += -L"$(LDAP_SDK)/lib/mscvc" -lldapsdk -lldapssl -lldapx
116 endif
117 ifdef USE_LDAP_OPENLDAP
118   CFLAGS += -DCURL_HAS_OPENLDAP_LDAPSDK
119   curl_LDADD += -L"$(LDAP_SDK)/lib" -lldap -llber
120 endif
121 ifndef USE_LDAP_NOVELL
122 ifndef USE_LDAP_OPENLDAP
123 curl_LDADD += -lwldap32
124 endif
125 endif
126 curl_LDADD += -lws2_32
127 COMPILE = $(CC) $(INCLUDES) $(CFLAGS)
128
129 # Makefile.inc provides the CSOURCES and HHEADERS defines
130 include Makefile.inc
131
132 curl_OBJECTS := $(patsubst %.c,%.o,$(strip $(CURL_CFILES)))
133 ifdef DYN
134 curlx_OBJECTS := $(patsubst %.c,%.o,$(notdir $(strip $(CURLX_ONES))))
135 curl_OBJECTS += $(curlx_OBJECTS)
136 vpath %.c ../lib
137 endif
138
139 RESOURCE = curl.res
140
141 .SUFFIXES: .rc .res
142
143 all: curl.exe
144
145 curl.exe: $(RESOURCE) $(curl_OBJECTS) $(curl_DEPENDENCIES)
146         -$(RM) $@
147         $(LINK) $< $(curl_OBJECTS) $(curl_LDADD)
148
149 # We don't have nroff normally under win32
150 # hugehelp.c: ../README.curl ../curl.1 mkhelp.pl
151 #       -$(RM) hugehelp.c
152 #       $(NROFF) -man ../curl.1 | $(PERL) mkhelp.pl ../README.curl > hugehelp.c
153
154 hugehelp.c:
155         @echo Creating $@
156         @$(CP) hugehelp.c.cvs $@
157
158 .c.o:
159         $(COMPILE) -c $<
160
161 .rc.res:
162         $(RC) $(RCFLAGS) $< -o $@
163
164 clean:
165 ifeq "$(wildcard hugehelp.c.cvs)" "hugehelp.c.cvs"
166         -$(RM) hugehelp.c
167 endif
168         -$(RM) $(curl_OBJECTS) $(RESOURCE)
169
170 distclean vclean: clean
171         -$(RM) $(curl_PROGRAMS)
172