summaryrefslogtreecommitdiff
path: root/build/generator/templates/build_zlib.ezt
blob: 9724f7d18d9e93d70e5efb71d3e98293779a8b63 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
[define COPYRIGHT]
#
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements.  See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership.  The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License.  You may obtain a copy of the License at
#
#   http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied.  See the License for the
# specific language governing permissions and limitations
# under the License.
#
#
[end]@echo off
@rem **************************************************************************
@rem * --== WARNING ==-- This is a generated file. Do not edit!
@rem *
@rem * From this directory, run this batch file like so:
@rem *
@rem *    .\build_zlib debug|release Win32|X64 [rebuild|clean]
@rem *
@rem **************************************************************************

@rem **************************************************************************
cd /D [zlib_path]
set exitcode=0
set zlib_version=[zlib_version]

if /i "%1" == "release" goto release
if /i "%1" == "debug" goto debug
goto pIerr

:checkplatform
if /i "%2" == "Win32" goto PWin32
if /i "%2" == "x64" goto PX64
goto pIIerr

:checkrebuild

[if-any use_ml]
@rem **************************************************************************
@rem Compile ASM sources with ML
set ASFLAGS=-nologo -Zi -coff
set LOC=-DASMV -DASMINF
[is zlib_version "1.2.4"]
set OBJA=contrib\masmx86\gvmat32c.obj contrib\masmx86\gvmat32.obj contrib\masmx86\inffas32.obj
set ASM_OPTS=ASFLAGS="%ASFLAGS%" LOC="%LOC%" OBJA="%OBJA%"
[else]
if /i "%2" == "Win32" (
  set ASM_OPTS=LOC="-DASMV -DASMINF" OBJA="inffas32.obj match686.obj" "AS=ml -safeseh"
) else if /i "%2" == "x64" (
  set ASM_OPTS=LOC="-DASMV -DASMINF" OBJA="inffasx64.obj gvmat64.obj inffas8664.obj" AS=ml64 
)
[end]
[end]


if /i "%3" == "rebuild" goto rebuild
if /i "%3" == "clean" goto clean
if not "%3" == "" goto pIIIerr
set target= %STATICLIB%
goto build

:rebuild
set target=clean %STATICLIB%
goto build

:clean
set target=clean
goto build

@rem **************************************************************************
:release
set STATICLIB=zlibstat.lib
set CC_OPTS=/MD /O2 /Zi
goto checkplatform

@rem **************************************************************************
:debug
set STATICLIB=zlibstatD.lib
set CC_OPTS=/MDd /Gm /ZI /Od /GZ /D_DEBUG
goto checkplatform

@rem **************************************************************************
:PWin32
goto checkrebuild

@rem **************************************************************************
:PX64
goto checkrebuild

@rem **************************************************************************
:build
set COMMON_CC_OPTS=/nologo /W3 /DWIN32 /D_WINDOWS
[is zlib_version "1.2.4"]
set CFLAGS=%COMMON_CC_OPTS% %CC_OPTS% %LOC%
set BUILD_OPTS=%ASM_OPTS% CFLAGS="%COMMON_CC_OPTS% %CC_OPTS% %LOC%"
[else]
set BUILD_OPTS=%ASM_OPTS%
[end]
@echo nmake /f win32\Makefile.msc %BUILD_OPTS% STATICLIB=%STATICLIB% %target%
nmake /nologo /f win32\Makefile.msc %BUILD_OPTS% STATICLIB=%STATICLIB% %target%
if errorlevel 1 goto err
goto end

@rem **************************************************************************
:pIerr
echo error: First parameter should be "release" or "debug"
goto err

@rem **************************************************************************
:pIIerr
echo error: Second parameter should be "Win32" or "X64"
goto err


@rem **************************************************************************
:pIIIerr
echo error: Third parameter should be "rebuild" or empty
goto err

@rem **************************************************************************
:err
set exitcode=1
:end
exit %exitcode%