blob: cbc54cfc7640fce075fcc2a9f3ec27a298d7593c [file] [log] [blame]
Alex Deymo8f1a2142016-06-28 14:49:26 -07001#***************************************************************************
2# _ _ ____ _
3# Project ___| | | | _ \| |
4# / __| | | | |_) | |
5# | (__| |_| | _ <| |___
6# \___|\___/|_| \_\_____|
7#
8# Copyright (C) 2005 - 2009, 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
Lucas Eckels9bd90e62012-08-06 15:07:02 -070024#
25# Watcom / OpenWatcom / Win32 makefile for libcurl.
Lucas Eckels9bd90e62012-08-06 15:07:02 -070026#
27
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -070028.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
Lucas Eckels9bd90e62012-08-06 15:07:02 -070038!ifndef %watcom
39!error WATCOM environment variable not set!
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -070040!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!
Lucas Eckels9bd90e62012-08-06 15:07:02 -070045!endif
46
47!ifdef %libname
48LIBNAME = $(%libname)
49!else
50LIBNAME = libcurl
51!endif
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -070052TARGETS = $(LIBNAME).dll $(LIBNAME).lib
Lucas Eckels9bd90e62012-08-06 15:07:02 -070053
54CC = wcc386
55LD = wlink
56AR = wlib
57RC = wrc
58
59!ifdef __LOADDLL__
60! loaddll wcc386 wccd386
61! loaddll wpp386 wppd386
62! loaddll wlib wlibd
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -070063! loaddll wlink wlinkd
Lucas Eckels9bd90e62012-08-06 15:07:02 -070064!endif
65
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -070066!ifdef __LINUX__
67CP = cp
68MD = mkdir -p
69!else
70CP = copy 2>NUL
Lucas Eckels9bd90e62012-08-06 15:07:02 -070071MD = mkdir
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -070072!endif
73!if $(__VERSION__) > 1290
74RD = rm -rf
75!else ifdef __UNIX__
76RD = rm -rf
77!else
Lucas Eckels9bd90e62012-08-06 15:07:02 -070078RD = rmdir /q /s 2>NUL
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -070079!endif
80
81SYS_INCL = -I"$(%watcom)/h/nt" -I"$(%watcom)/h"
Lucas Eckels9bd90e62012-08-06 15:07:02 -070082
83CFLAGS = -3r -mf -hc -zff -zgf -zq -zm -zc -s -fr=con -w2 -fpi -oilrtfm &
84 -wcd=201 -bt=nt -d+ -dWIN32 -dCURL_WANTS_CA_BUNDLE_ENV &
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -070085 -dBUILDING_LIBCURL -I. -I"../include" $(SYS_INCL)
Lucas Eckels9bd90e62012-08-06 15:07:02 -070086
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
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700102!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
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700114#
115# Change to suite.
116#
117!ifdef %zlib_root
118ZLIB_ROOT = $(%zlib_root)
119!else
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700120ZLIB_ROOT = ../../zlib-1.2.8
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700121!endif
122
123!ifdef %libssh2_root
124LIBSSH2_ROOT = $(%libssh2_root)
125!else
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700126LIBSSH2_ROOT = ../../libssh2-1.5.0
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700127!endif
128
129!ifdef %librtmp_root
130LIBRTMP_ROOT = $(%librtmp_root)
131!else
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700132LIBRTMP_ROOT = ../../rtmpdump-2.3
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700133!endif
134
135!ifdef %openssl_root
136OPENSSL_ROOT = $(%openssl_root)
137!else
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700138OPENSSL_ROOT = ../../openssl-1.0.2a
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700139!endif
140
141!ifdef %ares_root
142ARES_ROOT = $(%ares_root)
143!else
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700144ARES_ROOT = ../ares
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700145!endif
146
147!ifdef %use_zlib
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700148CFLAGS += -dHAVE_ZLIB_H -dHAVE_LIBZ -I"$(ZLIB_ROOT)"
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700149!endif
150
151!ifdef %use_rtmp
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700152CFLAGS += -dUSE_LIBRTMP -I"$(LIBRTMP_ROOT)"
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700153!endif
154
155!ifdef %use_ssh2
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700156CFLAGS += -DUSE_LIBSSH2 -DHAVE_LIBSSH2_H -I"$(LIBSSH2_ROOT)/include" -I"$(LIBSSH2_ROOT)/win32"
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700157!endif
158
159!ifdef %use_ssl
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700160CFLAGS += -wcd=138 -dUSE_OPENSSL -dUSE_SSLEAY -I"$(OPENSSL_ROOT)/inc32"
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700161!endif
162
163!ifdef %use_ares
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700164CFLAGS += -dUSE_ARES -I"$(ARES_ROOT)"
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700165!endif
166
167!ifdef %use_watt32
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700168CFLAGS += -dUSE_WATT32 -I"$(%watt_root)/inc"
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700169!endif
170
171OBJ_BASE = WC_Win32.obj
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700172!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
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700178!else
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700179OBJ_STAT = $(OBJ_BASE)\stat
180OBJ_DYN = $(OBJ_BASE)\dyn
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700181!endif
182
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700183LINK_ARG = $(OBJ_DYN)/wlink.arg
184LIB_ARG = $(OBJ_STAT)/wlib.arg
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700185
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700186!include Makefile.inc
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700187
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700188OBJS1 = ./$(CSOURCES:.c=.obj)
189OBJS2 = $(OBJS1:vtls/=)
Alex Deymo8f1a2142016-06-28 14:49:26 -0700190OBJS3 = $(OBJS2:vauth/=)
191OBJS4 = $(OBJS3: = ./)
192OBJS_STAT = $(OBJS4:./=$(OBJ_STAT)/)
193OBJS_DYN = $(OBJS4:./=$(OBJ_DYN)/)
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700194
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700195CURLBUILDH = ../include/curl/curlbuild.h
196RESOURCE = $(OBJ_DYN)/libcurl.res
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700197
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700198DIRS = $(OBJ_BASE) $(OBJ_BASE)/stat $(OBJ_BASE)/dyn
199
Alex Deymo8f1a2142016-06-28 14:49:26 -0700200.c : vauth vtls
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700201
202all: $(CURLBUILDH) $(DIRS) $(TARGETS) .SYMBOLIC
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700203 @echo Welcome to libcurl
204
205clean: .SYMBOLIC
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700206 -rm -f $(OBJS_STAT)
207 -rm -f $(OBJS_DYN)
208 -rm -f $(RESOURCE) $(LINK_ARG) $(LIB_ARG)
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700209
210vclean distclean: clean .SYMBOLIC
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700211 -rm -f $(TARGETS) $(LIBNAME).map $(LIBNAME).sym
212 -$(RD) $(OBJ_STAT)
213 -$(RD) $(OBJ_DYN)
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700214 -$(RD) $(OBJ_BASE)
215
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700216$(DIRS):
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700217 -$(MD) $^@
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700218
219$(CURLBUILDH): .EXISTSONLY
220 $(CP) $^@.dist $^@
221
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700222$(LIBNAME).dll: $(OBJS_DYN) $(RESOURCE) $(__MAKEFILES__)
223 %create $(LINK_ARG)
224 @%append $(LINK_ARG) system nt dll
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700225!ifdef %debug
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700226 @%append $(LINK_ARG) debug all
227 @%append $(LINK_ARG) option symfile
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700228!endif
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700229 @%append $(LINK_ARG) option quiet, caseexact, eliminate
230 @%append $(LINK_ARG) option map=$(OBJ_DYN)/$(LIBNAME).map
231 @%append $(LINK_ARG) option implib=$(LIBNAME)_imp.lib
232 @%append $(LINK_ARG) option res=$(RESOURCE)
233 @for %f in ($(OBJS_DYN)) do @%append $(LINK_ARG) file %f
234 @%append $(LINK_ARG) library wldap32.lib
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700235!ifdef %use_watt32
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700236 @%append $(LINK_ARG) library '$(%watt_root)/lib/wattcpw_imp.lib'
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700237!else
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700238 @%append $(LINK_ARG) library ws2_32.lib
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700239!endif
240!ifdef %use_zlib
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700241 @%append $(LINK_ARG) library '$(ZLIB_ROOT)/zlib.lib'
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700242!endif
243!ifdef %use_rtmp
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700244 @%append $(LINK_ARG) library '$(LIBRTMP_ROOT)/librtmp/librtmp.lib'
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700245!endif
246!ifdef %use_ssh2
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700247 @%append $(LINK_ARG) library '$(LIBSSH2_ROOT)/win32/libssh2.lib'
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700248!endif
249!ifdef %use_ssl
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700250 @%append $(LINK_ARG) library '$(OPENSSL_ROOT)/out32/libeay32.lib'
251 @%append $(LINK_ARG) library '$(OPENSSL_ROOT)/out32/ssleay32.lib'
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700252!endif
253!ifdef %use_ares
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700254 @%append $(LINK_ARG) library '$(ARES_ROOT)/cares.lib'
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700255!endif
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700256!ifdef %use_winidn
257! if $(__VERSION__) > 1290
258 @%append $(LINK_ARG) library normaliz.lib
259! else
260 @%append $(LINK_ARG) import '_IdnToAscii@20' 'NORMALIZ.DLL'.'IdnToAscii'
261 @%append $(LINK_ARG) import '_IdnToUnicode@20' 'NORMALIZ.DLL'.'IdnToUnicode'
262! endif
263!endif
264 $(LD) name $^@ @$(LINK_ARG)
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700265
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700266$(LIBNAME).lib: $(OBJS_STAT)
267 %create $(LIB_ARG)
268 @for %f in ($<) do @%append $(LIB_ARG) +- %f
269 $(AR) -q -b -c -pa $^@ @$(LIB_ARG)
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700270
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700271$(RESOURCE): libcurl.rc
272 $(RC) $(DEBUG) -q -r -zm -bt=nt -I"../include" $(SYS_INCL) $[@ -fo=$^@
273
274.c{$(OBJ_DYN)}.obj:
275 $(CC) $(CFLAGS) -bd -br $[@ -fo=$^@
276
277.c{$(OBJ_STAT)}.obj:
278 $(CC) $(CFLAGS) -DCURL_STATICLIB $[@ -fo=$^@
279