Home | History | Annotate | Download | only in lib
      1 #***************************************************************************
      2 #                                  _   _ ____  _
      3 #  Project                     ___| | | |  _ \| |
      4 #                             / __| | | | |_) | |
      5 #                            | (__| |_| |  _ <| |___
      6 #                             \___|\___/|_| \_\_____|
      7 #
      8 # Copyright (C) 2005 - 2009, Gisle Vanem <gvanem (a] yahoo.no>.
      9 # Copyright (C) 2005 - 2015, Daniel Stenberg, <daniel (a] 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
     48 LIBNAME = $(%libname)
     49 !else
     50 LIBNAME = libcurl
     51 !endif
     52 TARGETS = $(LIBNAME).dll $(LIBNAME).lib
     53 
     54 CC = wcc386
     55 LD = wlink
     56 AR = wlib
     57 RC = 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__
     67 CP = cp
     68 MD = mkdir -p
     69 !else
     70 CP = copy 2>NUL
     71 MD = mkdir
     72 !endif
     73 !if $(__VERSION__) > 1290
     74 RD = rm -rf
     75 !else ifdef __UNIX__
     76 RD = rm -rf
     77 !else
     78 RD = rmdir /q /s 2>NUL
     79 !endif
     80 
     81 SYS_INCL = -I"$(%watcom)/h/nt" -I"$(%watcom)/h"
     82 
     83 CFLAGS = -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         &
     85          -dBUILDING_LIBCURL -I. -I"../include" $(SYS_INCL)
     86 
     87 !ifdef %debug
     88 DEBUG  = -dDEBUG=1 -dDEBUGBUILD
     89 CFLAGS += -d3 $(DEBUG)
     90 !else
     91 CFLAGS += -d0
     92 !endif
     93 
     94 !ifdef %use_ipv6
     95 CFLAGS += -d_WIN32_WINNT=0x0501 -dENABLE_IPV6
     96 !endif
     97 
     98 !ifdef %use_sspi
     99 CFLAGS += -dUSE_WINDOWS_SSPI
    100 !endif
    101 
    102 !ifdef %use_winssl
    103 CFLAGS += -dUSE_WINDOWS_SSPI
    104 CFLAGS += -DUSE_SCHANNEL
    105 !endif
    106 
    107 !ifdef %use_winidn
    108 CFLAGS += -dWINVER=0x0600 -dUSE_WIN32_IDN
    109 !  if $(__VERSION__) <= 1290
    110 CFLAGS += -dWANT_IDN_PROTOTYPES
    111 !  endif
    112 !endif
    113 
    114 #
    115 # Change to suite.
    116 #
    117 !ifdef %zlib_root
    118 ZLIB_ROOT = $(%zlib_root)
    119 !else
    120 ZLIB_ROOT = ../../zlib-1.2.8
    121 !endif
    122 
    123 !ifdef %libssh2_root
    124 LIBSSH2_ROOT = $(%libssh2_root)
    125 !else
    126 LIBSSH2_ROOT = ../../libssh2-1.5.0
    127 !endif
    128 
    129 !ifdef %librtmp_root
    130 LIBRTMP_ROOT = $(%librtmp_root)
    131 !else
    132 LIBRTMP_ROOT = ../../rtmpdump-2.3
    133 !endif
    134 
    135 !ifdef %openssl_root
    136 OPENSSL_ROOT = $(%openssl_root)
    137 !else
    138 OPENSSL_ROOT = ../../openssl-1.0.2a
    139 !endif
    140 
    141 !ifdef %ares_root
    142 ARES_ROOT = $(%ares_root)
    143 !else
    144 ARES_ROOT = ../ares
    145 !endif
    146 
    147 !ifdef %use_zlib
    148 CFLAGS += -dHAVE_ZLIB_H -dHAVE_LIBZ -I"$(ZLIB_ROOT)"
    149 !endif
    150 
    151 !ifdef %use_rtmp
    152 CFLAGS += -dUSE_LIBRTMP -I"$(LIBRTMP_ROOT)"
    153 !endif
    154 
    155 !ifdef %use_ssh2
    156 CFLAGS += -DUSE_LIBSSH2 -DHAVE_LIBSSH2_H -I"$(LIBSSH2_ROOT)/include" -I"$(LIBSSH2_ROOT)/win32"
    157 !endif
    158 
    159 !ifdef %use_ssl
    160 CFLAGS += -wcd=138 -dUSE_OPENSSL -dUSE_SSLEAY -I"$(OPENSSL_ROOT)/inc32"
    161 !endif
    162 
    163 !ifdef %use_ares
    164 CFLAGS += -dUSE_ARES -I"$(ARES_ROOT)"
    165 !endif
    166 
    167 !ifdef %use_watt32
    168 CFLAGS += -dUSE_WATT32 -I"$(%watt_root)/inc"
    169 !endif
    170 
    171 OBJ_BASE = WC_Win32.obj
    172 !if $(__VERSION__) > 1290
    173 OBJ_STAT = $(OBJ_BASE)/stat
    174 OBJ_DYN  = $(OBJ_BASE)/dyn
    175 !else ifdef __UNIX__
    176 OBJ_STAT = $(OBJ_BASE)/stat
    177 OBJ_DYN  = $(OBJ_BASE)/dyn
    178 !else
    179 OBJ_STAT = $(OBJ_BASE)\stat
    180 OBJ_DYN  = $(OBJ_BASE)\dyn
    181 !endif
    182 
    183 LINK_ARG = $(OBJ_DYN)/wlink.arg
    184 LIB_ARG  = $(OBJ_STAT)/wlib.arg
    185 
    186 !include Makefile.inc
    187 
    188 OBJS1 = ./$(CSOURCES:.c=.obj)
    189 OBJS2 = $(OBJS1:vtls/=)
    190 OBJS3 = $(OBJS2:vauth/=)
    191 OBJS4 = $(OBJS3: = ./)
    192 OBJS_STAT = $(OBJS4:./=$(OBJ_STAT)/)
    193 OBJS_DYN  = $(OBJS4:./=$(OBJ_DYN)/)
    194 
    195 CURLBUILDH = ../include/curl/curlbuild.h
    196 RESOURCE   = $(OBJ_DYN)/libcurl.res
    197 
    198 DIRS = $(OBJ_BASE) $(OBJ_BASE)/stat $(OBJ_BASE)/dyn
    199 
    200 .c : vauth vtls
    201 
    202 all: $(CURLBUILDH) $(DIRS) $(TARGETS) .SYMBOLIC
    203 	@echo Welcome to libcurl
    204 
    205 clean: .SYMBOLIC
    206 	-rm -f $(OBJS_STAT)
    207 	-rm -f $(OBJS_DYN)
    208 	-rm -f $(RESOURCE) $(LINK_ARG) $(LIB_ARG)
    209 
    210 vclean distclean: clean .SYMBOLIC
    211 	-rm -f $(TARGETS) $(LIBNAME).map $(LIBNAME).sym
    212 	-$(RD) $(OBJ_STAT)
    213 	-$(RD) $(OBJ_DYN)
    214 	-$(RD) $(OBJ_BASE)
    215 
    216 $(DIRS):
    217 	-$(MD) $^@
    218 
    219 $(CURLBUILDH): .EXISTSONLY
    220 	$(CP) $^@.dist $^@
    221 
    222 $(LIBNAME).dll: $(OBJS_DYN) $(RESOURCE) $(__MAKEFILES__)
    223 	%create $(LINK_ARG)
    224 	@%append $(LINK_ARG) system nt dll
    225 !ifdef %debug
    226 	@%append $(LINK_ARG) debug all
    227 	@%append $(LINK_ARG) option symfile
    228 !endif
    229 	@%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
    235 !ifdef %use_watt32
    236 	@%append $(LINK_ARG) library '$(%watt_root)/lib/wattcpw_imp.lib'
    237 !else
    238 	@%append $(LINK_ARG) library ws2_32.lib
    239 !endif
    240 !ifdef %use_zlib
    241 	@%append $(LINK_ARG) library '$(ZLIB_ROOT)/zlib.lib'
    242 !endif
    243 !ifdef %use_rtmp
    244 	@%append $(LINK_ARG) library '$(LIBRTMP_ROOT)/librtmp/librtmp.lib'
    245 !endif
    246 !ifdef %use_ssh2
    247 	@%append $(LINK_ARG) library '$(LIBSSH2_ROOT)/win32/libssh2.lib'
    248 !endif
    249 !ifdef %use_ssl
    250 	@%append $(LINK_ARG) library '$(OPENSSL_ROOT)/out32/libeay32.lib'
    251 	@%append $(LINK_ARG) library '$(OPENSSL_ROOT)/out32/ssleay32.lib'
    252 !endif
    253 !ifdef %use_ares
    254 	@%append $(LINK_ARG) library '$(ARES_ROOT)/cares.lib'
    255 !endif
    256 !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)
    265 
    266 $(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)
    270 
    271 $(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 	
    280