Merge branch 'imap' of https://github.com/bnoordhuis/curl into bnoordhuis-imap
[platform/upstream/curl.git] / docs / examples / Makefile.m32
1 #***************************************************************************
2 #                                  _   _ ____  _
3 #  Project                     ___| | | |  _ \| |
4 #                             / __| | | | |_) | |
5 #                            | (__| |_| |  _ <| |___
6 #                             \___|\___/|_| \_\_____|
7 #
8 # Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
9 #
10 # This software is licensed as described in the file COPYING, which
11 # you should have received as part of this distribution. The terms
12 # are also available at http://curl.haxx.se/docs/copyright.html.
13 #
14 # You may opt to use, copy, modify, merge, publish, distribute and/or sell
15 # copies of the Software, and permit persons to whom the Software is
16 # furnished to do so, under the terms of the COPYING file.
17 #
18 # This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19 # KIND, either express or implied.
20 #
21 ###########################################################################
22 #########################################################################
23 #
24 ## Makefile for building curl examples with MingW32
25 ## and optionally OpenSSL (0.9.8), libssh2 (0.18), zlib (1.2.3)
26 ##
27 ## Usage:
28 ## mingw32-make -f Makefile.m32 [SSL=1] [SSH2=1] [ZLIB=1] [SSPI=1] [IPV6=1] [DYN=1]
29 ##
30 ## Hint: you can also set environment vars to control the build, f.e.:
31 ## set ZLIB_PATH=c:/zlib-1.2.3
32 ## set ZLIB=1
33 ##
34 #########################################################################
35
36 # Edit the path below to point to the base of your Zlib sources.
37 ifndef ZLIB_PATH
38 ZLIB_PATH = ../../zlib-1.2.3
39 endif
40 # Edit the path below to point to the base of your OpenSSL package.
41 ifndef OPENSSL_PATH
42 OPENSSL_PATH = ../../openssl-0.9.8k
43 endif
44 # Edit the path below to point to the base of your LibSSH2 package.
45 ifndef LIBSSH2_PATH
46 LIBSSH2_PATH = ../../libssh2-1.2
47 endif
48 # Edit the path below to point to the base of your Novell LDAP NDK.
49 ifndef LDAP_SDK
50 LDAP_SDK = c:/novell/ndk/cldapsdk/win32
51 endif
52
53 PROOT = ../..
54 ARES_LIB = $(PROOT)/ares
55
56 SSL = 1
57 ZLIB = 1
58
59 CC = gcc
60 CFLAGS = -g -O2 -Wall
61 # comment LDFLAGS below to keep debug info
62 LDFLAGS = -s
63 RC = windres
64 RCFLAGS = --include-dir=$(PROOT)/include -O COFF -i
65 RM = del /q /f > NUL 2>&1
66 CP = copy
67
68 ########################################################
69 ## Nothing more to do below this line!
70
71 INCLUDES = -I. -I$(PROOT) -I$(PROOT)/include -I$(PROOT)/lib
72 LINK = $(CC) $(LDFLAGS) -o $@
73
74 ifdef DYN
75   curl_DEPENDENCIES = $(PROOT)/lib/libcurldll.a $(PROOT)/lib/libcurl.dll
76   curl_LDADD = -L$(PROOT)/lib -lcurldll
77 else
78   curl_DEPENDENCIES = $(PROOT)/lib/libcurl.a
79   curl_LDADD = -L$(PROOT)/lib -lcurl
80   CFLAGS += -DCURL_STATICLIB
81 endif
82 ifdef ARES
83   ifndef DYN
84     curl_DEPENDENCIES += $(ARES_LIB)/libcares.a
85   endif
86   CFLAGS += -DUSE_ARES
87   curl_LDADD += -L$(ARES_LIB) -lcares
88 endif
89 ifdef SSH2
90   CFLAGS += -DUSE_LIBSSH2 -DHAVE_LIBSSH2_H
91   curl_LDADD += -L$(LIBSSH2_PATH)/win32 -lssh2
92 endif
93 ifdef SSL
94   INCLUDES += -I"$(OPENSSL_PATH)/outinc"
95   CFLAGS += -DUSE_SSLEAY -DHAVE_OPENSSL_ENGINE_H
96   ifdef DYN
97     curl_LDADD += -L$(OPENSSL_PATH)/out -leay32 -lssl32
98   else
99     curl_LDADD += -L$(OPENSSL_PATH)/out -lssl -lcrypto -lgdi32
100   endif
101 endif
102 ifdef ZLIB
103   INCLUDES += -I"$(ZLIB_PATH)"
104   CFLAGS += -DHAVE_LIBZ -DHAVE_ZLIB_H
105   curl_LDADD += -L$(ZLIB_PATH) -lz
106 endif
107 ifdef SSPI
108   CFLAGS += -DUSE_WINDOWS_SSPI
109 endif
110 ifdef IPV6
111   CFLAGS += -DENABLE_IPV6
112 endif
113 ifdef LDAPS
114   CFLAGS += -DHAVE_LDAP_SSL
115 endif
116 ifdef USE_LDAP_NOVELL
117   CFLAGS += -DCURL_HAS_NOVELL_LDAPSDK
118   curl_LDADD += -L"$(LDAP_SDK)/lib/mscvc" -lldapsdk -lldapssl -lldapx
119 endif
120 ifdef USE_LDAP_OPENLDAP
121   CFLAGS += -DCURL_HAS_OPENLDAP_LDAPSDK
122   curl_LDADD += -L"$(LDAP_SDK)/lib" -lldap -llber
123 endif
124 ifndef USE_LDAP_NOVELL
125 ifndef USE_LDAP_OPENLDAP
126 curl_LDADD += -lwldap32
127 endif
128 endif
129 curl_LDADD += -lws2_32
130 COMPILE = $(CC) $(INCLUDES) $(CFLAGS)
131
132 # Makefile.inc provides the check_PROGRAMS and COMPLICATED_EXAMPLES defines
133 include Makefile.inc
134
135 example_PROGRAMS := $(patsubst %,%.exe,$(strip $(check_PROGRAMS)))
136
137 .SUFFIXES: .rc .res .o .exe
138
139
140 all: $(example_PROGRAMS)
141
142 .o.exe: $(curl_DEPENDENCIES)
143         $(LINK) $< $(curl_LDADD)
144
145 .c.o:
146         $(COMPILE) -c $<
147
148 .rc.res:
149         $(RC) $(RCFLAGS) $< -o $@
150
151 clean:
152         $(RM) $(example_PROGRAMS)
153
154