blob: 77e5a6e0a172cab5192d6cc61136c5278b9bd02c [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>.
Elliott Hughes82be86d2017-09-20 17:00:17 -07009# Copyright (C) 2005 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
Alex Deymo8f1a2142016-06-28 14:49:26 -070010#
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 &
Elliott Hughes82be86d2017-09-20 17:00:17 -070084 -wcd=201 -bt=nt -d+ -dWIN32 &
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 -0700195RESOURCE = $(OBJ_DYN)/libcurl.res
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700196
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700197DIRS = $(OBJ_BASE) $(OBJ_BASE)/stat $(OBJ_BASE)/dyn
198
Alex Deymo8f1a2142016-06-28 14:49:26 -0700199.c : vauth vtls
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700200
Elliott Hughes82be86d2017-09-20 17:00:17 -0700201all: $(DIRS) $(TARGETS) .SYMBOLIC
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700202 @echo Welcome to libcurl
203
204clean: .SYMBOLIC
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700205 -rm -f $(OBJS_STAT)
206 -rm -f $(OBJS_DYN)
207 -rm -f $(RESOURCE) $(LINK_ARG) $(LIB_ARG)
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700208
209vclean distclean: clean .SYMBOLIC
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700210 -rm -f $(TARGETS) $(LIBNAME).map $(LIBNAME).sym
211 -$(RD) $(OBJ_STAT)
212 -$(RD) $(OBJ_DYN)
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700213 -$(RD) $(OBJ_BASE)
214
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700215$(DIRS):
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700216 -$(MD) $^@
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700217
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700218$(LIBNAME).dll: $(OBJS_DYN) $(RESOURCE) $(__MAKEFILES__)
219 %create $(LINK_ARG)
220 @%append $(LINK_ARG) system nt dll
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700221!ifdef %debug
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700222 @%append $(LINK_ARG) debug all
223 @%append $(LINK_ARG) option symfile
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700224!endif
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700225 @%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
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700231!ifdef %use_watt32
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700232 @%append $(LINK_ARG) library '$(%watt_root)/lib/wattcpw_imp.lib'
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700233!else
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700234 @%append $(LINK_ARG) library ws2_32.lib
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700235!endif
236!ifdef %use_zlib
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700237 @%append $(LINK_ARG) library '$(ZLIB_ROOT)/zlib.lib'
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700238!endif
239!ifdef %use_rtmp
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700240 @%append $(LINK_ARG) library '$(LIBRTMP_ROOT)/librtmp/librtmp.lib'
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700241!endif
242!ifdef %use_ssh2
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700243 @%append $(LINK_ARG) library '$(LIBSSH2_ROOT)/win32/libssh2.lib'
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700244!endif
245!ifdef %use_ssl
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700246 @%append $(LINK_ARG) library '$(OPENSSL_ROOT)/out32/libeay32.lib'
247 @%append $(LINK_ARG) library '$(OPENSSL_ROOT)/out32/ssleay32.lib'
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700248!endif
249!ifdef %use_ares
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700250 @%append $(LINK_ARG) library '$(ARES_ROOT)/cares.lib'
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700251!endif
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700252!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)
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700261
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700262$(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)
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700266
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700267$(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