removed CFLAGS from linking.
[platform/upstream/curl.git] / src / Makefile.m32
1 #############################################################
2 # $Id$
3 #
4 ## Makefile for building curl.exe with MingW32 (GCC-3.2) and
5 ## optionally OpenSSL (0.9.8)
6 ##
7 ## Use: make -f Makefile.m32 [SSL=1] [SSH2=1] [DYN=1]
8 ##
9 ## Comments to: Troy Engel <tengel@sonic.net> or
10 ##              Joern Hartroth <hartroth@acm.org>
11
12 ifndef OPENSSL_PATH
13 OPENSSL_PATH = ../../openssl-0.9.8d
14 endif
15 ifndef LIBSSH2_PATH
16 LIBSSH2_PATH = ../../libssh2-0.14
17 endif
18 ifndef ZLIB_PATH
19 ZLIB_PATH = ../../zlib-1.2.3
20 endif
21
22 CC = gcc
23 RC = windres
24 RCFLAGS = --include-dir=../include -O COFF -i
25 RM = rm -f
26 STRIP = strip -s
27
28 # We may need these someday
29 # PERL = perl
30 # NROFF = nroff
31
32 ########################################################
33 ## Nothing more to do below this line!
34
35 INCLUDES = -I. -I.. -I../include -I../lib -I$(ZLIB_PATH)
36 CFLAGS = -g -O2
37 LDFLAGS =
38 COMPILE = $(CC) $(INCLUDES) $(CFLAGS)
39 LINK = $(CC) $(LDFLAGS) -o $@
40
41 curl_PROGRAMS = curl.exe
42 ifdef DYN
43   curl_DEPENDENCIES = ../lib/libcurldll.a ../lib/libcurl.dll
44   curl_LDADD = -L../lib -lcurldll
45 else
46   curl_DEPENDENCIES = ../lib/libcurl.a
47   curl_LDADD = -L../lib -lcurl
48   COMPILE += -DCURL_STATICLIB
49 endif
50 ifdef SSH2
51   CFLAGS += -DUSE_LIBSSH2 -DHAVE_LIBSSH2_H
52   curl_LDADD += -L$(LIBSSH2_PATH)/win32 -lssh2
53 endif
54 ifdef SSL
55   CFLAGS += -DUSE_SSLEAY -DHAVE_OPENSSL_ENGINE_H
56   curl_LDADD += -L$(OPENSSL_PATH)/out -leay32 -lssl32
57 endif
58 curl_LDADD += -lwsock32 -lws2_32 -lwinmm -L$(ZLIB_PATH) -lz
59
60 # Makefile.inc provides the CSOURCES and HHEADERS defines
61 include Makefile.inc
62
63 curl_OBJECTS := $(patsubst %.c,%.o,$(notdir $(strip $(CURL_SOURCES) ../lib/timeval.c)))
64 # curlx_OBJECTS := $(patsubst %.c,%.o,$(notdir $(strip $(CURLX_ONES))))
65 # vpath %.c ../lib
66
67 .SUFFIXES: .rc .res
68
69 all: curl.exe
70
71 curl.exe: curl.res $(curl_OBJECTS) $(curl_DEPENDENCIES)
72         $(RM) $@
73         $(LINK) $< $(curl_OBJECTS) $(curl_LDADD)
74         $(STRIP) $@
75
76 timeval.o: ../lib/timeval.c
77         $(COMPILE) -c $<
78
79 # We don't have nroff normally under win32
80 # hugehelp.c: ../README.curl ../curl.1 mkhelp.pl
81 #       $(RM) hugehelp.c
82 #       $(NROFF) -man ../curl.1 | $(PERL) mkhelp.pl ../README.curl > hugehelp.c
83
84 .rc.res:
85         $(RC) $(RCFLAGS) $< -o $@
86
87 .c.o:
88         $(COMPILE) -c $<
89
90 .s.o:
91         $(COMPILE) -c $<
92
93 .S.o:
94         $(COMPILE) -c $<
95
96 clean:
97         $(RM) $(curl_OBJECTS) curl.exe
98
99 distrib: clean
100         $(RM) $(curl_PROGRAMS)