1#
2#  Watcom / OpenWatcom / Win32 makefile for cURL.
3#  G. Vanem <gvanem@broadpark.no>
4#
5
6!ifndef %watcom
7!error WATCOM environment variable not set!
8!endif
9
10!ifdef %libname
11LIBNAME = $(%libname)
12!else
13LIBNAME = libcurl
14!endif
15TARGETS = $(LIBNAME).dll $(LIBNAME)_imp.lib $(LIBNAME).lib
16
17CC = wcc386
18LD = wlink
19AR = wlib
20RC = wrc
21
22!ifdef __LOADDLL__
23!  loaddll wcc386  wccd386
24!  loaddll wpp386  wppd386
25!  loaddll wlib    wlibd
26!  if $(__VERSION__) > 1270
27!    loaddll wlink   wlinkd
28!  else
29!    loaddll wlink   wlink
30!  endif
31!endif
32
33!ifdef __LINUX__
34DS = /
35CP = cp
36MD = mkdir -p
37RD = rmdir -p
38RM = rm -f
39!else
40DS = $(X)\$(X)
41CP = copy 2>NUL
42MD = mkdir
43RD = rmdir /q /s 2>NUL
44!if $(__VERSION__) < 1250
45RM = del /q /f 2>NUL
46!else
47RM = rm -f
48!endif
49!endif
50
51SYS_INCL = -I$(%watcom)$(DS)h$(DS)nt -I$(%watcom)$(DS)h
52SYS_LIBS = $(%watcom)$(DS)lib386$(DS)nt;$(%watcom)$(DS)lib386
53
54CFLAGS = -3r -mf -hc -zff -zgf -zq -zm -s -fr=con -w2 -fpi -oilrtfm &
55         -wcd=201 -bt=nt -bc -d+ -dWIN32 -dHAVE_STRTOLL             &
56         -I..$(DS)include -I..$(DS)lib $(SYS_INCL)
57
58!ifdef %debug
59DEBUG  = -dDEBUG=1 -dDEBUGBUILD
60CFLAGS += -d3 $(DEBUG)
61!else
62CFLAGS += -d0
63!endif
64
65!ifdef %use_ipv6
66CFLAGS += -d_WIN32_WINNT=0x0501 -dENABLE_IPV6
67!endif
68
69#
70# Change to suite.
71#
72!ifdef %zlib_root
73ZLIB_ROOT = $(%zlib_root)
74!else
75ZLIB_ROOT = ..$(DS)..$(DS)zlib-1.2.7
76!endif
77
78!ifdef %libssh2_root
79LIBSSH2_ROOT = $(%libssh2_root)
80!else
81LIBSSH2_ROOT = ..$(DS)..$(DS)libssh2-1.4.3
82!endif
83
84!ifdef %librtmp_root
85LIBRTMP_ROOT = $(%librtmp_root)
86!else
87LIBRTMP_ROOT = ..$(DS)..$(DS)rtmpdump-2.3
88!endif
89
90!ifdef %openssl_root
91OPENSSL_ROOT = $(%openssl_root)
92!else
93OPENSSL_ROOT = ..$(DS)..$(DS)openssl-0.9.8y
94!endif
95
96!ifdef %ares_root
97ARES_ROOT = $(%ares_root)
98!else
99ARES_ROOT = ..$(DS)ares
100!endif
101
102!ifdef %use_ssl
103CFLAGS += -wcd=138 -dUSE_OPENSSL -dUSE_SSLEAY -I$(OPENSSL_ROOT)$(DS)inc32
104!endif
105
106OBJ_DIR  = WC_Win32.obj
107LINK_ARG = $(OBJ_DIR)$(DS)wlink.arg
108
109# In order to process Makefile.inc wmake must be called with -u switch!
110!ifndef %MAKEFLAGS
111!error You MUST call wmake with the -u switch!
112!else
113!include Makefile.inc
114!endif
115# For now we still define the CURLX_ONES sources here unless we know how
116# to split off the prefixed path.
117CURLX_SOURCES = rawstr.c nonblock.c
118
119OBJS = $(CURL_CFILES:.c=.obj)
120!ifdef %curl_static
121CFLAGS += -DCURL_STATICLIB
122!else
123CFLAGS += -br
124OBJS += $(CURLX_SOURCES:.c=.obj)
125!endif
126!ifdef __LINUX__
127OBJS = $OBJ_DIR/$(OBJS: = $OBJ_DIR/)
128
129!else
130OBJS = $OBJ_DIR\$(OBJS: = $OBJ_DIR\)
131!endif
132
133RESOURCE = $(OBJ_DIR)$(DS)curl.res
134
135all: tool_hugehelp.c $(OBJ_DIR) curl.exe .SYMBOLIC
136	@echo Welcome to cURL
137
138clean: .SYMBOLIC
139	-$(RM) $(OBJS)
140	-$(RM) $(RESOURCE) $(LINK_ARG)
141
142vclean distclean: clean .SYMBOLIC
143	-$(RD) $(OBJ_DIR)
144	-$(RM) curl.exe curl.map curl.sym tool_hugehelp.c
145
146tool_hugehelp.c: tool_hugehelp.c.cvs
147	$(CP) $[@ $^@
148
149tool_hugehelp.c.cvs: .EXISTSONLY
150	$(CP) tool_hugehelp.c $^@
151
152$(OBJ_DIR):
153	-$(MD) $^@
154
155curl.exe: $(OBJS) $(RESOURCE) $(LINK_ARG)
156	$(LD) name $^@ @$]@
157
158$(RESOURCE): curl.rc
159	$(RC) $(DEBUG) -q -r -zm -bt=nt -I..$(DS)include $(SYS_INCL) $[@ -fo=$^@
160
161# suffix search path - vpath-like hack
162.c: ..$(DS)lib
163
164.ERASE
165.c{$(OBJ_DIR)}.obj:
166	$(CC) $(CFLAGS) $[@ -fo=$^@
167
168$(LINK_ARG): $(__MAKEFILES__)
169	%create $^@
170	@%append $^@ system nt
171	@%append $^@ file { $(OBJS) }
172!ifdef %debug
173	@%append $^@ debug all
174	@%append $^@ option symfile
175!endif
176	@%append $^@ option quiet, map, caseexact, eliminate,
177	@%append $^@ res=$(RESOURCE) libpath $(SYS_LIBS)
178!ifdef %curl_static
179	@%append $^@ library wldap32.lib
180	@%append $^@ library ..$(DS)lib$(DS)$(LIBNAME).lib
181!ifdef %use_zlib
182	@%append $^@ library $(ZLIB_ROOT)$(DS)zlib.lib
183!endif
184!ifdef %use_rtmp
185	@%append $^@ library $(LIBRTMP_ROOT)$(DS)librtmp$(DS)librtmp.lib, winmm.lib
186!endif
187!ifdef %use_ssh2
188	@%append $^@ library $(LIBSSH2_ROOT)$(DS)win32$(DS)libssh2.lib
189!endif
190!ifdef %use_ssl
191	@%append $^@ library $(OPENSSL_ROOT)$(DS)out32$(DS)libeay32.lib, $(OPENSSL_ROOT)$(DS)out32$(DS)ssleay32.lib
192!endif
193!ifdef %use_ares
194	@%append $^@ library $(ARES_ROOT)$(DS)cares.lib
195!endif
196!ifdef %use_winidn
197!  if $(__VERSION__) > 1290
198	@%append $^@ library normaliz.lib
199!  else
200	@%append $^@ import '_IdnToAscii@20' 'NORMALIZ.DLL'.'IdnToAscii'
201	@%append $^@ import '_IdnToUnicode@20' 'NORMALIZ.DLL'.'IdnToUnicode'
202!  endif
203!endif
204!else
205	@%append $^@ library ..$(DS)lib$(DS)$(LIBNAME)_imp.lib
206!endif
207!ifeq USE_WATT32 1
208	@%append $^@ library $(%watt_root)$(DS)lib$(DS)wattcpw_imp.lib
209!else
210	@%append $^@ library ws2_32.lib
211!endif
212
213