Rename CURL_SOURCES macro; revert previous rename of curl_SOURCES macro.
[platform/upstream/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] [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.8o
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.6
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 Novell LDAP NDK.
34 ifndef LDAP_SDK
35 LDAP_SDK = c:/novell/ndk/cldapsdk/win32
36 endif
37
38 # Edit the path below to point to the base of your c-ares package.
39 ifndef LIBCARES_PATH
40 LIBCARES_PATH = ../ares
41 endif
42
43 CC = gcc
44 CFLAGS = -g -O2
45 # comment LDFLAGS below to keep debug info
46 LDFLAGS = -s
47 RC = windres
48 RCFLAGS = --include-dir=../include -O COFF -i
49 RM = del /q /f > NUL 2>&1
50 CP = copy
51
52 # We may need these someday
53 # PERL = perl
54 # NROFF = nroff
55
56 ########################################################
57 ## Nothing more to do below this line!
58
59 INCLUDES = -I. -I.. -I../include -I../lib
60 LINK = $(CC) $(LDFLAGS) -o $@
61
62 curl_PROGRAMS = curl.exe
63 ifdef DYN
64   curl_DEPENDENCIES = ../lib/libcurldll.a ../lib/libcurl.dll
65   curl_LDADD = -L../lib -lcurldll
66 else
67   curl_DEPENDENCIES = ../lib/libcurl.a
68   curl_LDADD = -L../lib -lcurl
69   CFLAGS += -DCURL_STATICLIB
70 endif
71 ifdef ARES
72   ifndef DYN
73     curl_DEPENDENCIES += $(LIBCARES_PATH)/libcares.a
74   endif
75   CFLAGS += -DUSE_ARES
76   curl_LDADD += -L$(LIBCARES_PATH) -lcares
77 endif
78 ifdef SSH2
79   CFLAGS += -DUSE_LIBSSH2 -DHAVE_LIBSSH2_H
80   curl_LDADD += -L$(LIBSSH2_PATH)/win32 -lssh2
81 endif
82 ifdef SSL
83   CFLAGS += -DUSE_SSLEAY -DHAVE_OPENSSL_ENGINE_H
84   curl_LDADD += -L$(OPENSSL_PATH)/out -leay32 -lssl32
85 endif
86 ifdef ZLIB
87   INCLUDES += -I"$(ZLIB_PATH)"
88   CFLAGS += -DHAVE_LIBZ -DHAVE_ZLIB_H
89   curl_LDADD += -L$(ZLIB_PATH) -lz
90 endif
91 ifdef IDN
92   INCLUDES += -I"$(LIBIDN_PATH)/include"
93   CFLAGS += -DUSE_LIBIDN
94   curl_LDADD += -L$(LIBIDN_PATH)/lib -lidn
95 endif
96 ifdef SSPI
97   CFLAGS += -DUSE_WINDOWS_SSPI
98 endif
99 ifdef IPV6
100   CFLAGS += -DENABLE_IPV6
101 endif
102 ifdef LDAPS
103   CFLAGS += -DHAVE_LDAP_SSL
104 endif
105 ifdef USE_LDAP_NOVELL
106   CFLAGS += -DCURL_HAS_NOVELL_LDAPSDK
107   curl_LDADD += -L"$(LDAP_SDK)/lib/mscvc" -lldapsdk -lldapssl -lldapx
108 endif
109 ifdef USE_LDAP_OPENLDAP
110   CFLAGS += -DCURL_HAS_OPENLDAP_LDAPSDK
111   curl_LDADD += -L"$(LDAP_SDK)/lib" -lldap -llber
112 endif
113 ifndef USE_LDAP_NOVELL
114 ifndef USE_LDAP_OPENLDAP
115 curl_LDADD += -lwldap32
116 endif
117 endif
118 curl_LDADD += -lws2_32
119 COMPILE = $(CC) $(INCLUDES) $(CFLAGS)
120
121 # Makefile.inc provides the CSOURCES and HHEADERS defines
122 include Makefile.inc
123
124 curl_OBJECTS := $(patsubst %.c,%.o,$(strip $(CURL_CFILES)))
125 ifdef DYN
126 curlx_OBJECTS := $(patsubst %.c,%.o,$(notdir $(strip $(CURLX_ONES))))
127 curl_OBJECTS += $(curlx_OBJECTS)
128 vpath %.c ../lib
129 endif
130
131 RESOURCE = curl.res
132
133 .SUFFIXES: .rc .res
134
135 all: curl.exe
136
137 curl.exe: $(RESOURCE) $(curl_OBJECTS) $(curl_DEPENDENCIES)
138         -$(RM) $@
139         $(LINK) $< $(curl_OBJECTS) $(curl_LDADD)
140
141 # We don't have nroff normally under win32
142 # hugehelp.c: ../README.curl ../curl.1 mkhelp.pl
143 #       -$(RM) hugehelp.c
144 #       $(NROFF) -man ../curl.1 | $(PERL) mkhelp.pl ../README.curl > hugehelp.c
145
146 hugehelp.c:
147         @echo Creating $@
148         @$(CP) hugehelp.c.cvs $@
149
150 .c.o:
151         $(COMPILE) -c $<
152
153 .rc.res:
154         $(RC) $(RCFLAGS) $< -o $@
155
156 clean:
157 ifeq "$(wildcard hugehelp.c.cvs)" "hugehelp.c.cvs"
158         -$(RM) hugehelp.c
159 endif
160         -$(RM) $(curl_OBJECTS) $(RESOURCE)
161
162 distrib: clean
163         -$(RM) $(curl_PROGRAMS)
164
165