1#***************************************************************************
2#                                  _   _ ____  _
3#  Project                     ___| | | |  _ \| |
4#                             / __| | | | |_) | |
5#                            | (__| |_| |  _ <| |___
6#                             \___|\___/|_| \_\_____|
7#
8# Copyright (C) 2005 - 2009, Gisle Vanem <gvanem@yahoo.no>.
9# Copyright (C) 2005 - 2017, 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 libcurl.
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
52TARGETS = $(LIBNAME).dll $(LIBNAME).lib
53
54CC = wcc386
55LD = wlink
56AR = wlib
57RC = wrc
58
59!ifdef __LOADDLL__
60!  loaddll wcc386  wccd386
61!  loaddll wpp386  wppd386
62!  loaddll wlib    wlibd
63!  loaddll wlink   wlinkd
64!endif
65
66!ifdef __LINUX__
67CP = cp
68MD = mkdir -p
69!else
70CP = copy 2>NUL
71MD = mkdir
72!endif
73!if $(__VERSION__) > 1290
74RD = rm -rf
75!else ifdef __UNIX__
76RD = rm -rf
77!else
78RD = rmdir /q /s 2>NUL
79!endif
80
81SYS_INCL = -I"$(%watcom)/h/nt" -I"$(%watcom)/h"
82
83CFLAGS = -3r -mf -hc -zff -zgf -zq -zm -zc -s -fr=con -w2 -fpi -oilrtfm &
84         -wcd=201 -bt=nt -d+ -dWIN32 &
85         -dBUILDING_LIBCURL -I. -I"../include" $(SYS_INCL)
86
87!ifdef %debug
88DEBUG  = -dDEBUG=1 -dDEBUGBUILD
89CFLAGS += -d3 $(DEBUG)
90!else
91CFLAGS += -d0
92!endif
93
94!ifdef %use_ipv6
95CFLAGS += -d_WIN32_WINNT=0x0501 -dENABLE_IPV6
96!endif
97
98!ifdef %use_sspi
99CFLAGS += -dUSE_WINDOWS_SSPI
100!endif
101
102!ifdef %use_winssl
103CFLAGS += -dUSE_WINDOWS_SSPI
104CFLAGS += -DUSE_SCHANNEL
105!endif
106
107!ifdef %use_winidn
108CFLAGS += -dWINVER=0x0600 -dUSE_WIN32_IDN
109!  if $(__VERSION__) <= 1290
110CFLAGS += -dWANT_IDN_PROTOTYPES
111!  endif
112!endif
113
114#
115# Change to suite.
116#
117!ifdef %zlib_root
118ZLIB_ROOT = $(%zlib_root)
119!else
120ZLIB_ROOT = ../../zlib-1.2.8
121!endif
122
123!ifdef %libssh2_root
124LIBSSH2_ROOT = $(%libssh2_root)
125!else
126LIBSSH2_ROOT = ../../libssh2-1.5.0
127!endif
128
129!ifdef %librtmp_root
130LIBRTMP_ROOT = $(%librtmp_root)
131!else
132LIBRTMP_ROOT = ../../rtmpdump-2.3
133!endif
134
135!ifdef %openssl_root
136OPENSSL_ROOT = $(%openssl_root)
137!else
138OPENSSL_ROOT = ../../openssl-1.0.2a
139!endif
140
141!ifdef %ares_root
142ARES_ROOT = $(%ares_root)
143!else
144ARES_ROOT = ../ares
145!endif
146
147!ifdef %use_zlib
148CFLAGS += -dHAVE_ZLIB_H -dHAVE_LIBZ -I"$(ZLIB_ROOT)"
149!endif
150
151!ifdef %use_rtmp
152CFLAGS += -dUSE_LIBRTMP -I"$(LIBRTMP_ROOT)"
153!endif
154
155!ifdef %use_ssh2
156CFLAGS += -DUSE_LIBSSH2 -DHAVE_LIBSSH2_H -I"$(LIBSSH2_ROOT)/include" -I"$(LIBSSH2_ROOT)/win32"
157!endif
158
159!ifdef %use_ssl
160CFLAGS += -wcd=138 -dUSE_OPENSSL -I"$(OPENSSL_ROOT)/inc32"
161!endif
162
163!ifdef %use_ares
164CFLAGS += -dUSE_ARES -I"$(ARES_ROOT)"
165!endif
166
167!ifdef %use_watt32
168CFLAGS += -dUSE_WATT32 -I"$(%watt_root)/inc"
169!endif
170
171OBJ_BASE = WC_Win32.obj
172!if $(__VERSION__) > 1290
173OBJ_STAT = $(OBJ_BASE)/stat
174OBJ_DYN  = $(OBJ_BASE)/dyn
175!else ifdef __UNIX__
176OBJ_STAT = $(OBJ_BASE)/stat
177OBJ_DYN  = $(OBJ_BASE)/dyn
178!else
179OBJ_STAT = $(OBJ_BASE)\stat
180OBJ_DYN  = $(OBJ_BASE)\dyn
181!endif
182
183LINK_ARG = $(OBJ_DYN)/wlink.arg
184LIB_ARG  = $(OBJ_STAT)/wlib.arg
185
186!include Makefile.inc
187
188OBJS1 = ./$(CSOURCES:.c=.obj)
189OBJS2 = $(OBJS1:vtls/=)
190OBJS3 = $(OBJS2:vauth/=)
191OBJS4 = $(OBJS3: = ./)
192OBJS_STAT = $(OBJS4:./=$(OBJ_STAT)/)
193OBJS_DYN  = $(OBJS4:./=$(OBJ_DYN)/)
194
195RESOURCE   = $(OBJ_DYN)/libcurl.res
196
197DIRS = $(OBJ_BASE) $(OBJ_BASE)/stat $(OBJ_BASE)/dyn
198
199.c : vauth vtls
200
201all: $(DIRS) $(TARGETS) .SYMBOLIC
202	@echo Welcome to libcurl
203
204clean: .SYMBOLIC
205	-rm -f $(OBJS_STAT)
206	-rm -f $(OBJS_DYN)
207	-rm -f $(RESOURCE) $(LINK_ARG) $(LIB_ARG)
208
209vclean distclean: clean .SYMBOLIC
210	-rm -f $(TARGETS) $(LIBNAME).map $(LIBNAME).sym
211	-$(RD) $(OBJ_STAT)
212	-$(RD) $(OBJ_DYN)
213	-$(RD) $(OBJ_BASE)
214
215$(DIRS):
216	-$(MD) $^@
217
218$(LIBNAME).dll: $(OBJS_DYN) $(RESOURCE) $(__MAKEFILES__)
219	%create $(LINK_ARG)
220	@%append $(LINK_ARG) system nt dll
221!ifdef %debug
222	@%append $(LINK_ARG) debug all
223	@%append $(LINK_ARG) option symfile
224!endif
225	@%append $(LINK_ARG) option quiet, caseexact, eliminate
226	@%append $(LINK_ARG) option map=$(OBJ_DYN)/$(LIBNAME).map
227	@%append $(LINK_ARG) option implib=$(LIBNAME)_imp.lib
228	@%append $(LINK_ARG) option res=$(RESOURCE)
229	@for %f in ($(OBJS_DYN)) do @%append $(LINK_ARG) file %f
230	@%append $(LINK_ARG) library wldap32.lib
231!ifdef %use_watt32
232	@%append $(LINK_ARG) library '$(%watt_root)/lib/wattcpw_imp.lib'
233!else
234	@%append $(LINK_ARG) library ws2_32.lib
235!endif
236!ifdef %use_zlib
237	@%append $(LINK_ARG) library '$(ZLIB_ROOT)/zlib.lib'
238!endif
239!ifdef %use_rtmp
240	@%append $(LINK_ARG) library '$(LIBRTMP_ROOT)/librtmp/librtmp.lib'
241!endif
242!ifdef %use_ssh2
243	@%append $(LINK_ARG) library '$(LIBSSH2_ROOT)/win32/libssh2.lib'
244!endif
245!ifdef %use_ssl
246	@%append $(LINK_ARG) library '$(OPENSSL_ROOT)/out32/libeay32.lib'
247	@%append $(LINK_ARG) library '$(OPENSSL_ROOT)/out32/ssleay32.lib'
248!endif
249!ifdef %use_ares
250	@%append $(LINK_ARG) library '$(ARES_ROOT)/cares.lib'
251!endif
252!ifdef %use_winidn
253!  if $(__VERSION__) > 1290
254	@%append $(LINK_ARG) library normaliz.lib
255!  else
256	@%append $(LINK_ARG) import '_IdnToAscii@20' 'NORMALIZ.DLL'.'IdnToAscii'
257	@%append $(LINK_ARG) import '_IdnToUnicode@20' 'NORMALIZ.DLL'.'IdnToUnicode'
258!  endif
259!endif
260	$(LD) name $^@ @$(LINK_ARG)
261
262$(LIBNAME).lib: $(OBJS_STAT)
263	%create $(LIB_ARG)
264	@for %f in ($<) do @%append $(LIB_ARG) +- %f
265	$(AR) -q -b -c -pa $^@ @$(LIB_ARG)
266
267$(RESOURCE): libcurl.rc
268	$(RC) $(DEBUG) -q -r -zm -bt=nt -I"../include" $(SYS_INCL) $[@ -fo=$^@
269
270.c{$(OBJ_DYN)}.obj:
271	$(CC) $(CFLAGS) -bd -br $[@ -fo=$^@
272
273.c{$(OBJ_STAT)}.obj:
274	$(CC) $(CFLAGS) -DCURL_STATICLIB $[@ -fo=$^@
275