1#***************************************************************************
2#                                  _   _ ____  _
3#  Project                     ___| | | |  _ \| |
4#                             / __| | | | |_) | |
5#                            | (__| |_| |  _ <| |___
6#                             \___|\___/|_| \_\_____|
7#
8# Copyright (C) 2005 - 2008, Gisle Vanem <gvanem@yahoo.no>.
9# Copyright (C) 2005 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
10#
11# This software is licensed as described in the file COPYING, which
12# you should have received as part of this distribution. The terms
13# are also available at https://curl.haxx.se/docs/copyright.html.
14#
15# You may opt to use, copy, modify, merge, publish, distribute and/or sell
16# copies of the Software, and permit persons to whom the Software is
17# furnished to do so, under the terms of the COPYING file.
18#
19# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
20# KIND, either express or implied.
21#
22#***************************************************************************
23
24#
25#  Watcom / OpenWatcom / Win32 makefile for curl.
26#
27
28.ERASE
29
30!if $(__VERSION__) < 1280
31!message !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
32!message ! This Open Watcom version is too old and is no longer supported !
33!message !     Please download latest version from www.openwatcom.org     !
34!message !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
35!error Unsupported version of Open Watcom
36!endif
37
38!ifndef %watcom
39!error WATCOM environment variable not set!
40!endif
41
42# In order to process Makefile.inc wmake must be called with -u switch!
43!ifndef %MAKEFLAGS
44!error You MUST call wmake with the -u switch!
45!endif
46
47!ifdef %libname
48LIBNAME = $(%libname)
49!else
50LIBNAME = libcurl
51!endif
52
53TARGETS = curl.exe
54
55CC = wcc386
56LD = wlink
57AR = wlib
58RC = wrc
59
60!ifdef __LOADDLL__
61!  loaddll wcc386  wccd386
62!  loaddll wpp386  wppd386
63!  loaddll wlib    wlibd
64!  loaddll wlink   wlinkd
65!endif
66
67!ifdef __UNIX__
68CP = cp
69MD = mkdir -p
70!else
71CP = copy 2>NUL
72MD = mkdir
73!endif
74!if $(__VERSION__) > 1290
75RD = rm -rf
76!else ifdef __UNIX__
77RD = rm -rf
78!else
79RD = rmdir /q /s 2>NUL
80!endif
81
82SYS_INCL = -I"$(%watcom)/h/nt" -I"$(%watcom)/h"
83
84CFLAGS = -3r -mf -hc -zff -zgf -zq -zm -s -fr=con -w2 -fpi -oilrtfm &
85         -wcd=201 -bt=nt -bc -d+ -dWIN32 -dHAVE_STRTOLL             &
86         -I"../include" -I"../lib" $(SYS_INCL)
87
88!ifdef %debug
89DEBUG  = -dDEBUG=1 -dDEBUGBUILD
90CFLAGS += -d3 $(DEBUG)
91!else
92CFLAGS += -d0
93!endif
94
95!ifdef %use_ipv6
96CFLAGS += -d_WIN32_WINNT=0x0501 -dENABLE_IPV6
97!endif
98
99!ifdef %use_ssl
100CFLAGS += -wcd=138 -dUSE_OPENSSL -dUSE_OPENSSL -I"$(OPENSSL_ROOT)/inc32"
101!endif
102
103!ifdef %curl_static
104CFLAGS += -DCURL_STATICLIB
105!else
106CFLAGS += -br
107!endif
108
109#
110# Change to suite.
111#
112!ifdef %zlib_root
113ZLIB_ROOT = $(%zlib_root)
114!else
115ZLIB_ROOT = ../../zlib-1.2.8
116!endif
117
118!ifdef %libssh2_root
119LIBSSH2_ROOT = $(%libssh2_root)
120!else
121LIBSSH2_ROOT = ../../libssh2-1.5.0
122!endif
123
124!ifdef %librtmp_root
125LIBRTMP_ROOT = $(%librtmp_root)
126!else
127LIBRTMP_ROOT = ../../rtmpdump-2.3
128!endif
129
130!ifdef %openssl_root
131OPENSSL_ROOT = $(%openssl_root)
132!else
133OPENSSL_ROOT = ../../openssl-1.0.2a
134!endif
135
136!ifdef %ares_root
137ARES_ROOT = $(%ares_root)
138!else
139ARES_ROOT = ../ares
140!endif
141
142OBJ_DIR  = WC_Win32.obj
143LINK_ARG = $(OBJ_DIR)/wlink.arg
144
145!include Makefile.inc
146
147OBJS1 = $(OBJ_DIR)/$(CURL_CFILES)
148!ifndef %curl_static
149OBJS1 += $(CURLX_CFILES:../lib/=)
150!endif
151OBJS2 = $(OBJS1: = $(OBJ_DIR)/)
152OBJS = $(OBJS2:.c=.obj)
153
154RESOURCE = $(OBJ_DIR)/curl.res
155
156DIRS = $(OBJ_DIR)
157
158all: tool_hugehelp.c $(DIRS) $(TARGETS) .SYMBOLIC
159	@echo Welcome to curl
160
161clean: .SYMBOLIC
162	-rm -f $(OBJS)
163	-rm -f $(RESOURCE) $(LINK_ARG)
164
165vclean distclean: clean .SYMBOLIC
166	-$(RD) $(OBJ_DIR)
167	-rm -f curl.exe curl.sym tool_hugehelp.c
168
169tool_hugehelp.c: tool_hugehelp.c.cvs
170	$(CP) $[@ $^@
171
172tool_hugehelp.c.cvs: .EXISTSONLY
173	$(CP) tool_hugehelp.c $^@
174
175$(DIRS):
176	-$(MD) $^@
177
178curl.exe: $(OBJS) $(RESOURCE)
179	%create $(LINK_ARG)
180	@%append $(LINK_ARG) system nt
181!ifdef %debug
182	@%append $(LINK_ARG) debug all
183	@%append $(LINK_ARG) option symfile
184!endif
185	@%append $(LINK_ARG) option quiet, caseexact, eliminate
186	@%append $(LINK_ARG) option map=$(OBJ_DIR)/$^&.map
187	@%append $(LINK_ARG) option res=$(RESOURCE)
188	@%append $(LINK_ARG) file { $(OBJS) }
189!ifndef %curl_static
190	@%append $(LINK_ARG) library ../lib/$(LIBNAME)_imp.lib
191!else
192	@%append $(LINK_ARG) library ../lib/$(LIBNAME).lib
193	@%append $(LINK_ARG) library wldap32.lib
194! ifdef %use_zlib
195	@%append $(LINK_ARG) library '$(ZLIB_ROOT)/zlib.lib'
196! endif
197! ifdef %use_rtmp
198	@%append $(LINK_ARG) library '$(LIBRTMP_ROOT)/librtmp/librtmp.lib'
199	@%append $(LINK_ARG) library winmm.lib
200! endif
201! ifdef %use_ssh2
202	@%append $(LINK_ARG) library '$(LIBSSH2_ROOT)/win32/libssh2.lib'
203! endif
204! ifdef %use_ssl
205	@%append $(LINK_ARG) library '$(OPENSSL_ROOT)/out32/libeay32.lib'
206	@%append $(LINK_ARG) library '$(OPENSSL_ROOT)/out32/ssleay32.lib'
207! endif
208! ifdef %use_ares
209	@%append $(LINK_ARG) library '$(ARES_ROOT)/cares.lib'
210! endif
211! ifdef %use_winidn
212!  if $(__VERSION__) > 1290
213	@%append $(LINK_ARG) library normaliz.lib
214!  else
215	@%append $(LINK_ARG) import '_IdnToAscii@20' 'NORMALIZ.DLL'.'IdnToAscii'
216	@%append $(LINK_ARG) import '_IdnToUnicode@20' 'NORMALIZ.DLL'.'IdnToUnicode'
217!  endif
218! endif
219!endif
220!ifeq USE_WATT32 1
221	@%append $(LINK_ARG) library '$(%watt_root)/lib/wattcpw_imp.lib'
222!else
223	@%append $(LINK_ARG) library ws2_32.lib
224!endif
225	$(LD) name $^@ @$(LINK_ARG)
226
227$(RESOURCE): curl.rc
228	$(RC) $(DEBUG) -q -r -zm -bt=nt -I"../include" $(SYS_INCL) $[@ -fo=$^@
229
230# suffix search path - vpath-like hack
231.c: ../lib
232
233.c{$(OBJ_DIR)}.obj:
234	$(CC) $(CFLAGS) $[@ -fo=$^@
235