Changed the makefile so the doc/examples/ programs are never built in a
[platform/upstream/curl.git] / docs / examples / Makefile.m32
1 #########################################################################
2 # $Id$
3 #
4 ## Makefile for building curl examples with MingW32
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
13 ##
14 #########################################################################
15
16 # Edit the path below to point to the base of your Zlib sources.
17 ifndef ZLIB_PATH
18 ZLIB_PATH = ../../zlib-1.2.3
19 endif
20 # Edit the path below to point to the base of your OpenSSL package.
21 ifndef OPENSSL_PATH
22 OPENSSL_PATH = ../../openssl-0.9.8g
23 endif
24 # Edit the path below to point to the base of your LibSSH2 package.
25 ifndef LIBSSH2_PATH
26 LIBSSH2_PATH = ../../libssh2-0.18
27 endif
28 # Edit the path below to point to the base of your Novell LDAP NDK.
29 ifndef LDAP_SDK
30 LDAP_SDK = c:/novell/ndk/cldapsdk/win32
31 endif
32
33 PROOT = ../..
34 ARES_LIB = $(PROOT)/ares
35
36 SSL = 1
37 ZLIB = 1
38
39 CC = gcc
40 CFLAGS = -g -O2 -Wall
41 # comment LDFLAGS below to keep debug info
42 LDFLAGS = -s
43 RC = windres
44 RCFLAGS = --include-dir=$(PROOT)/include -O COFF -i
45 RM = del /q /f > NUL 2>&1
46 CP = copy
47
48 ########################################################
49 ## Nothing more to do below this line!
50
51 INCLUDES = -I. -I$(PROOT) -I$(PROOT)/include -I$(PROOT)/lib
52 LINK = $(CC) $(LDFLAGS) -o $@
53
54 curl_PROGRAMS = curl.exe
55 ifdef DYN
56   curl_DEPENDENCIES = $(PROOT)/lib/libcurldll.a $(PROOT)/lib/libcurl.dll
57   curl_LDADD = -L$(PROOT)/lib -lcurldll
58 else
59   curl_DEPENDENCIES = $(PROOT)/lib/libcurl.a
60   curl_LDADD = -L$(PROOT)/lib -lcurl
61   CFLAGS += -DCURL_STATICLIB
62 endif
63 ifdef ARES
64   ifndef DYN
65     curl_DEPENDENCIES += $(ARES_LIB)/libcares.a
66   endif
67   CFLAGS += -DUSE_ARES
68   curl_LDADD += -L$(ARES_LIB) -lcares
69 endif
70 ifdef SSH2
71   CFLAGS += -DUSE_LIBSSH2 -DHAVE_LIBSSH2_H
72   curl_LDADD += -L$(LIBSSH2_PATH)/win32 -lssh2
73 endif
74 ifdef SSL
75   INCLUDES += -I"$(OPENSSL_PATH)/outinc"
76   CFLAGS += -DUSE_SSLEAY -DHAVE_OPENSSL_ENGINE_H
77   ifdef DYN
78     curl_LDADD += -L$(OPENSSL_PATH)/out -leay32 -lssl32
79   else
80     curl_LDADD += -L$(OPENSSL_PATH)/out -lssl -lcrypto -lgdi32
81   endif
82 endif
83 ifdef ZLIB
84   INCLUDES += -I"$(ZLIB_PATH)"
85   CFLAGS += -DHAVE_LIBZ -DHAVE_ZLIB_H
86   curl_LDADD += -L$(ZLIB_PATH) -lz
87 endif
88 ifdef SSPI
89   CFLAGS += -DUSE_WINDOWS_SSPI
90 endif
91 ifdef IPV6
92   CFLAGS += -DENABLE_IPV6
93 endif
94 ifdef LDAPS
95   CFLAGS += -DHAVE_LDAP_SSL
96 endif
97 ifdef USE_LDAP_NOVELL
98   CFLAGS += -DCURL_HAS_NOVELL_LDAPSDK
99   curl_LDADD += -L"$(LDAP_SDK)/lib/mscvc" -lldapsdk -lldapssl -lldapx
100 endif
101 ifdef USE_LDAP_OPENLDAP
102   CFLAGS += -DCURL_HAS_OPENLDAP_LDAPSDK
103   curl_LDADD += -L"$(LDAP_SDK)/lib" -lldap -llber
104 endif
105 ifndef USE_LDAP_NOVELL
106 ifndef USE_LDAP_OPENLDAP
107 curl_LDADD += -lwldap32
108 endif
109 endif
110 curl_LDADD += -lws2_32 -lwinmm
111 COMPILE = $(CC) $(INCLUDES) $(CFLAGS)
112
113 # Makefile.inc provides the check_PROGRAMS and COMPLICATED_EXAMPLES defines
114 include Makefile.inc
115
116 example_PROGRAMS := $(patsubst %,%.exe,$(strip $(check_PROGRAMS)))
117
118 .SUFFIXES: .rc .res .o .exe
119
120
121 all: $(example_PROGRAMS)
122
123 .o.exe: $(curl_DEPENDENCIES)
124         $(LINK) $< $(curl_LDADD)
125
126 .c.o:
127         $(COMPILE) -c $<
128
129 .rc.res:
130         $(RC) $(RCFLAGS) $< -o $@
131
132 clean:
133         $(RM) $(example_PROGRAMS)
134
135