Home | History | Annotate | Download | only in winbuild
      1 !IF "$(MODE)"=="static"
      2 TARGET = $(LIB_NAME_STATIC)
      3 AS_DLL = false
      4 CFGSET=true
      5 !ELSEIF "$(MODE)"=="dll"
      6 TARGET = $(LIB_NAME_DLL)
      7 AS_DLL = true
      8 CFGSET=true
      9 !ELSE
     10 !MESSAGE Invalid mode: $(MODE)
     11 
     12 #######################
     13 # Usage
     14 #
     15 
     16 !MESSAGE Usage: nmake /f Makefile.vc mode=<static or dll> <options>
     17 !MESSAGE where <options> is one or many of:
     18 !MESSAGE   VC=<6,7,8,9,10,11,12>        - VC versions
     19 !MESSAGE   WITH_DEVEL=<path>            - Paths for the development files (SSL, zlib, etc.)
     20 !MESSAGE                                  Defaults to sibbling directory deps: ../deps
     21 !MESSAGE                                  Libraries can be fetched at http://pecl2.php.net/downloads/php-windows-builds/
     22 !MESSAGE                                  Uncompress them into the deps folder.
     23 !MESSAGE   WITH_SSL=<dll or static>     - Enable OpenSSL support, DLL or static
     24 !MESSAGE   WITH_CARES=<dll or static>   - Enable c-ares support, DLL or static
     25 !MESSAGE   WITH_ZLIB=<dll or static>    - Enable zlib support, DLL or static
     26 !MESSAGE   WITH_SSH2=<dll or static>    - Enable libSSH2 support, DLL or static
     27 !MESSAGE   ENABLE_IDN=<yes or no>       - Enable use of Windows IDN APIs, defaults to yes
     28 !MESSAGE                                  Requires Windows Vista or later, or installation from:
     29 !MESSAGE                                  http://www.microsoft.com/downloads/details.aspx?FamilyID=AD6158D7-DDBA-416A-9109-07607425A815
     30 !MESSAGE   ENABLE_IPV6=<yes or no>      - Enable IPv6, defaults to yes
     31 !MESSAGE   ENABLE_SSPI=<yes or no>      - Enable SSPI support, defaults to yes
     32 !MESSAGE   ENABLE_WINSSL=<yes or no>    - Enable native Windows SSL support, defaults to yes
     33 !MESSAGE   GEN_PDB=<yes or no>          - Generate Program Database (debug symbols for release build)
     34 !MESSAGE   DEBUG=<yes or no>            - Debug builds
     35 !MESSAGE   MACHINE=<x86 or x64>         - Target architecture (default x64 on AMD64, x86 on others)
     36 !ERROR please choose a valid mode
     37 
     38 !ENDIF
     39 
     40 !INCLUDE "../lib/Makefile.inc"
     41 LIBCURL_OBJS=$(CSOURCES:.c=.obj)
     42 
     43 !INCLUDE "../src/Makefile.inc"
     44 
     45 # tool_hugehelp has a special rule
     46 CURL_OBJS=$(CURL_CFILES:tool_hugehelp.c=)
     47 
     48 CURL_OBJS=$(CURL_OBJS:.c=.obj)
     49 
     50 
     51 # backwards compatible check for USE_SSPI
     52 !IFDEF USE_SSPI
     53 ENABLE_SSPI = $(USE_SSPI)
     54 !ENDIF
     55 
     56 # default options
     57 !IFNDEF MACHINE
     58 !IF "$(PROCESSOR_ARCHITECTURE)"=="AMD64"
     59 MACHINE = x64
     60 !ELSE
     61 MACHINE = x86
     62 !ENDIF
     63 !ENDIF
     64 
     65 !IFNDEF ENABLE_IDN
     66 USE_IDN = true
     67 !ELSEIF "$(ENABLE_IDN)"=="yes"
     68 USE_IDN = true
     69 !ELSEIF "$(ENABLE_IDN)"=="no"
     70 USE_IDN = false
     71 !ENDIF
     72 
     73 !IFNDEF ENABLE_IPV6
     74 USE_IPV6 = true
     75 !ELSEIF "$(ENABLE_IPV6)"=="yes"
     76 USE_IPV6 = true
     77 !ELSEIF "$(ENABLE_IPV6)"=="no"
     78 USE_IPV6 = false
     79 !ENDIF
     80 
     81 !IFNDEF ENABLE_SSPI
     82 USE_SSPI = true
     83 !ELSEIF "$(ENABLE_SSPI)"=="yes"
     84 USE_SSPI = true
     85 !ELSEIF "$(ENABLE_SSPI)"=="no"
     86 USE_SSPI = false
     87 !ENDIF
     88 
     89 !IFNDEF ENABLE_WINSSL
     90 !IFDEF WITH_SSL
     91 USE_WINSSL = false
     92 !ELSE
     93 USE_WINSSL = $(USE_SSPI)
     94 !ENDIF
     95 !ELSEIF "$(ENABLE_WINSSL)"=="yes"
     96 USE_WINSSL = true
     97 !ELSEIF "$(ENABLE_WINSSL)"=="no"
     98 USE_WINSSL = false
     99 !ENDIF
    100 
    101 CONFIG_NAME_LIB = libcurl
    102 
    103 !IF "$(WITH_SSL)"=="dll"
    104 USE_SSL = true
    105 SSL     = dll
    106 !ELSEIF "$(WITH_SSL)"=="static"
    107 USE_SSL = true
    108 SSL     = static
    109 !ENDIF
    110 
    111 !IF "$(WITH_CARES)"=="dll"
    112 USE_CARES = true
    113 CARES     = dll
    114 !ELSEIF "$(WITH_CARES)"=="static"
    115 USE_CARES = true
    116 CARES     = static
    117 !ENDIF
    118 
    119 !IF "$(WITH_ZLIB)"=="dll"
    120 USE_ZLIB = true
    121 ZLIB     = dll
    122 !ELSEIF "$(WITH_ZLIB)"=="static"
    123 USE_ZLIB = true
    124 ZLIB     = static
    125 !ENDIF
    126 
    127 !IF "$(WITH_SSH2)"=="dll"
    128 USE_SSH2 = true
    129 SSH2     = dll
    130 !ELSEIF "$(WITH_SSH2)"=="static"
    131 USE_SSH2 = true
    132 SSH2     = static
    133 !ENDIF
    134 
    135 CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-vc$(VC)-$(MACHINE)
    136 
    137 !IF "$(DEBUG)"=="yes"
    138 CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-debug
    139 !ELSE
    140 CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-release
    141 !ENDIF
    142 
    143 !IF "$(AS_DLL)"=="true"
    144 CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-dll
    145 !ELSE
    146 CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-static
    147 !ENDIF
    148 
    149 !IF "$(USE_SSL)"=="true"
    150 CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-ssl-$(SSL)
    151 !ENDIF
    152 
    153 !IF "$(USE_CARES)"=="true"
    154 CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-cares-$(CARES)
    155 !ENDIF
    156 
    157 !IF "$(USE_ZLIB)"=="true"
    158 CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-zlib-$(ZLIB)
    159 !ENDIF
    160 
    161 !IF "$(USE_SSH2)"=="true"
    162 CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-ssh2-$(SSH2)
    163 !ENDIF
    164 
    165 !IF "$(USE_IPV6)"=="true"
    166 CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-ipv6
    167 !ENDIF
    168 
    169 !IF "$(USE_SSPI)"=="true"
    170 CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-sspi
    171 !ENDIF
    172 
    173 !IF "$(USE_WINSSL)"=="true"
    174 CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-winssl
    175 !ENDIF
    176 
    177 !MESSAGE configuration name: $(CONFIG_NAME_LIB)
    178 
    179 BUILD_DIR=../builds/$(CONFIG_NAME_LIB)
    180 LIBCURL_DIROBJ = ..\builds\$(CONFIG_NAME_LIB)-obj-lib
    181 CURL_DIROBJ = ..\builds\$(CONFIG_NAME_LIB)-obj-curl
    182 DIRDIST = ..\builds\$(CONFIG_NAME_LIB)\
    183 
    184 $(MODE):
    185 	@SET DIROBJ=$(LIBCURL_DIROBJ)
    186 	@SET MACRO_NAME=LIBCURL_OBJS
    187 	@SET OUTFILE=LIBCURL_OBJS.inc
    188 	@gen_resp_file.bat $(LIBCURL_OBJS)
    189 
    190 	@SET DIROBJ=$(CURL_DIROBJ)
    191 	@SET MACRO_NAME=CURL_OBJS
    192 	@SET OUTFILE=CURL_OBJS.inc
    193 	@gen_resp_file.bat $(CURL_OBJS)
    194 
    195 	@SET CONFIG_NAME_LIB=$(CONFIG_NAME_LIB)
    196 	@SET MACHINE=$(MACHINE)
    197 	@SET USE_IDN=$(USE_IDN)
    198 	@SET USE_IPV6=$(USE_IPV6)
    199 	@SET USE_SSPI=$(USE_SSPI)
    200 	@SET USE_WINSSL=$(USE_WINSSL)
    201 	@$(MAKE) /NOLOGO /F MakefileBuild.vc
    202 
    203 copy_from_lib:
    204 	echo copying .c...
    205 	FOR %%i IN ($(CURLX_CFILES:/=\)) DO copy %%i ..\src\
    206