-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathbuildall.cmd
executable file
·288 lines (213 loc) · 8.72 KB
/
buildall.cmd
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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
@if "%_echo%"=="" echo off
REM ==++==
REM
REM
REM Copyright (c) 2006 Microsoft Corporation. All rights reserved.
REM
REM The use and distribution terms for this software are contained in the file
REM named license.txt, which can be found in the root of this distribution.
REM By using this software in any fashion, you are agreeing to be bound by the
REM terms of this license.
REM
REM You must not remove this notice, or any other, from this software.
REM
REM
REM ==--==
if "%_NTTREE%" == "" goto NtTreeNotSet
REM
REM Note:
REM The BUILDALL_BUILDING, BUILDALL_ERRORLOG and BUILDALL_WARNINGLOG variables are
REM used by other scripts to report errors so setlocal/endlocal may not be used.
REM
if not exist "%USERPROFILE%\rotor" goto NoRotorUserProfile
if "%1"=="clean" rmdir /s /q "%USERPROFILE%\rotor"
if "%1"=="-c" rmdir /s /q "%USERPROFILE%\rotor"
:NoRotorUserProfile
if not exist %_NTTREE% goto NoNtTree
if "%1"=="clean" (
rmdir /s /q "%_NTTREE%"
REM
)
if "%1"=="-c" (
rmdir /s /q "%_NTTREE%"
REM
)
:NoNtTree
if not exist %_NTTREE% mkdir %_NTTREE%
if not exist %_NTTREE%\sdk\pal\lib\%_BUILDTYPE%\%_BUILDARCH% mkdir %_NTTREE%\sdk\pal\lib\%_BUILDTYPE%\%_BUILDARCH%
if not exist %NDPDIR%\clr\lib\%_BUILDTYPE%\%_BUILDARCH% mkdir %NDPDIR%\clr\lib\%_BUILDTYPE%\%_BUILDARCH%
REM
echo.
echo --- Copy prebuilt files ---
echo.
if not exist %ROTOR_DIR%\prebuilt\idl\obj%BUILD_ALT_DIR% mkdir %ROTOR_DIR%\prebuilt\idl\obj%BUILD_ALT_DIR%
if not exist %ROTOR_DIR%\prebuilt\idl\obj%BUILD_ALT_DIR%\%_BUILDARCH% mkdir %ROTOR_DIR%\prebuilt\idl\obj%BUILD_ALT_DIR%\%_BUILDARCH%
copy %ROTOR_DIR%\prebuilt\idl\*.h %ROTOR_DIR%\prebuilt\idl\obj%BUILD_ALT_DIR%\%_BUILDARCH%\
copy %ROTOR_DIR%\prebuilt\idl\*_i.c %ROTOR_DIR%\prebuilt\idl\obj%BUILD_ALT_DIR%\%_BUILDARCH%\
if not exist %ROTOR_DIR%\prebuilt\yacc\obj%BUILD_ALT_DIR% mkdir %ROTOR_DIR%\prebuilt\yacc\obj%BUILD_ALT_DIR%
if not exist %ROTOR_DIR%\prebuilt\yacc\obj%BUILD_ALT_DIR%\%_BUILDARCH% mkdir %ROTOR_DIR%\prebuilt\yacc\obj%BUILD_ALT_DIR%\%_BUILDARCH%
copy %ROTOR_DIR%\prebuilt\yacc\*.c %ROTOR_DIR%\prebuilt\yacc\obj%BUILD_ALT_DIR%\%_BUILDARCH%\
REM
if not "%ROTOR_TOOLSET%" == "MSVC" goto UsePrebuiltBootstrap
echo.
echo --- Building the PAL ---
echo.
set BUILDALL_BUILDING=%ROTOR_DIR%\pal\win32
set BUILDALL_ERRORLOG=%BUILDALL_BUILDING%\build%BUILD_ALT_DIR%.log
if "%_BUILDTYPE%"=="prf" perl %ROTOR_DIR%\prepare.pl
pushd %ROTOR_DIR%\pal\win32
call make.cmd %*
popd
if ERRORLEVEL 1 goto DisplayError
echo.
echo --- Building the binplace tool ---
echo.
set BUILDALL_BUILDING=%ROTOR_DIR%\tools\binplace
set BUILDALL_ERRORLOG=%BUILDALL_BUILDING%\build%BUILD_ALT_DIR%.log
pushd %ROTOR_DIR%\tools\binplace
call make.cmd %*
popd
if ERRORLEVEL 1 goto DisplayError
echo.
echo --- Building the build tool ---
echo.
set BUILDALL_BUILDING=%ROTOR_DIR%\tools\build
set BUILDALL_ERRORLOG=%BUILDALL_BUILDING%\build%BUILD_ALT_DIR%.log
pushd %ROTOR_DIR%\tools\build
call make.cmd %*
popd
if ERRORLEVEL 1 goto DisplayError
echo.
echo --- Building the cppmunge tool ---
echo.
set BUILDALL_BUILDING=%ROTOR_DIR%\tools\cppmunge
set BUILDALL_ERRORLOG=%BUILDALL_BUILDING%\build%BUILD_ALT_DIR%.log
pushd %ROTOR_DIR%\tools\cppmunge
call make.cmd %*
popd
if ERRORLEVEL 1 goto DisplayError
goto :BootstrapDone
:UsePrebuiltBootstrap
echo.
echo --- Copying prebuilt bootstrap ---
echo.
@if "%_echo%"=="" echo on
copy %ROTOR_DIR%\prebuilt\tools\%_BUILDTYPE%\*.* %_NTTREE%
del %_NTTREE%\sdk\pal\lib\%_BUILDTYPE%\%_BUILDARCH%\rotor_pal.*
gcc -E -nostdinc -w -x assembler-with-cpp -P %C_DEFINES% %ROTOR_DIR%\pal\win32\rotor_pal.src >%_NTTREE%\sdk\pal\lib\%_BUILDTYPE%\%_BUILDARCH%\rotor_pal.def
dlltool -k --input-def %_NTTREE%\sdk\pal\lib\%_BUILDTYPE%\%_BUILDARCH%\rotor_pal.def -l %_NTTREE%\sdk\pal\lib\%_BUILDTYPE%\%_BUILDARCH%\rotor_pal.lib
del %_NTTREE%\sdk\pal\lib\%_BUILDTYPE%\%_BUILDARCH%\rotor_palrt.*
gcc -E -nostdinc -w -x assembler-with-cpp -P %C_DEFINES% %ROTOR_DIR%\palrt\src\rotor_palrt.src >%_NTTREE%\sdk\pal\lib\%_BUILDTYPE%\%_BUILDARCH%\rotor_palrt.def
dlltool -k --input-def %_NTTREE%\sdk\pal\lib\%_BUILDTYPE%\%_BUILDARCH%\rotor_palrt.def -l %_NTTREE%\sdk\pal\lib\%_BUILDTYPE%\%_BUILDARCH%\rotor_palrt.lib
del %_NTTREE%\sdk\pal\lib\%_BUILDTYPE%\%_BUILDARCH%\sscoree.*
gcc -E -nostdinc -w -x assembler-with-cpp -P %C_DEFINES% %ROTOR_DIR%\palrt\sscoree\sscoree.src >%_NTTREE%\sdk\pal\lib\%_BUILDTYPE%\%_BUILDARCH%\sscoree.def
dlltool -k --input-def %_NTTREE%\sdk\pal\lib\%_BUILDTYPE%\%_BUILDARCH%\sscoree.def -l %_NTTREE%\sdk\pal\lib\%_BUILDTYPE%\%_BUILDARCH%\sscoree.lib
del %_NTTREE%\sdk\pal\lib\%_BUILDTYPE%\%_BUILDARCH%\rotor_debug.*
dlltool -k --input-def %ROTOR_DIR%\palrt\debug\rotor_debug.def -l %_NTTREE%\sdk\pal\lib\%_BUILDTYPE%\%_BUILDARCH%\rotor_debug.lib
@if "%_echo%"=="" echo off
goto :BootstrapDone
:BootstrapDone
set BUILDALL_OPTIONS=%*
set BUILDALL_SETUP_SCRIPT=%ROTOR_DIR%\env\bin\setup.pl
set BUILDALL_SETUP_LOG=%_NTTREE%\setup.log
call :RunBuild %ROTOR_DIR%\tools\resourcecompiler "Resource Compiler"
if ERRORLEVEL 1 goto DisplayError
call :RunBuild %ROTOR_DIR%\palrt "PAL RT"
if ERRORLEVEL 1 goto DisplayError
if exist %ROTOR_DIR%\palrt\unilib\sources call :RunBuild %ROTOR_DIR%\palrt\unilib "UniLib"
if ERRORLEVEL 1 goto DisplayError
call :RunBuild %BASEDIR%\csharp "C# compiler"
if ERRORLEVEL 1 goto DisplayError
call :RunBuild %NDPDIR%\clr\src "CLR"
if ERRORLEVEL 1 goto DisplayError
if not "%ROTOR_TOOLSET%" == "MSVC" goto Done
set BUILD_OPTIONS=~misc
call :RunBuild %NDPDIR%\fx\src "FX - pass1 only" -L
if ERRORLEVEL 1 goto DisplayError
REM
set BUILD_OPTIONS=
call :RunBuild %NDPDIR%\clr\src\managedlibraries "Remoting - pass1 only" -L
if ERRORLEVEL 1 goto DisplayError
call :RunBuild %VSADIR% "JScript - pass1 only" -L
if ERRORLEVEL 1 goto DisplayError
call :RunBuild %NDPDIR%\fx\src\sys "FX - System.dll"
if ERRORLEVEL 1 goto DisplayError
call :RunSetup "System.dll" GAC System.dll
if ERRORLEVEL 1 goto DisplayError
set BUILD_OPTIONS=~sys ~misc
call :RunBuild %NDPDIR%\fx\src "FX"
if ERRORLEVEL 1 goto DisplayError
call :RunSetup "System.Configuration.dll" GAC System.Configuration.dll
if ERRORLEVEL 1 goto DisplayError
REM
set BUILD_OPTIONS=
REM
call :RunSetup "System.Configuration.dll" GAC System.Configuration.dll
if ERRORLEVEL 1 goto DisplayError
call :RunSetup "System.Xml.dll" GAC System.Xml.dll
if ERRORLEVEL 1 goto DisplayError
call :RunSetup "System.Data.SqlXml.dll" GAC System.Data.SqlXml.dll
if ERRORLEVEL 1 goto DisplayError
call :RunBuild %NDPDIR%\fx\src\misc "FX - Misc"
if ERRORLEVEL 1 goto DisplayError
call :RunBuild %NDPDIR%\clr\src\managedlibraries "Remoting"
if ERRORLEVEL 1 goto DisplayError
call :RunBuild %VSADIR% "JScript"
if ERRORLEVEL 1 goto DisplayError
call :RunBuild %NDPDIR%\clr\src\toolbox\sos\dactablegen "dactablegen"
if ERRORLEVEL 1 goto DisplayError
call :RunBuild %NDPDIR%\clr\src\dacupdatedll "dacupdatedll"
if ERRORLEVEL 1 goto DisplayError
call :RunBuild %NDPDIR%\clr\src\toolbox\sos\strike "strike dll"
if ERRORLEVEL 1 goto DisplayError
REM
call :RunSetup "everything"
if ERRORLEVEL 1 goto DisplayError
call :RunBuild %ROTOR_DIR%\samples "samples"
if ERRORLEVEL 1 goto DisplayError
call :RunBuild %ROTOR_DIR%\tools\ildbconv "pdb to ildb Tool"
if ERRORLEVEL 1 goto DisplayError
goto Done
:DisplayError
echo *** Error while building %BUILDALL_BUILDING%
echo Open %BUILDALL_ERRORLOG% to see the error log.
echo Open %BUILDALL_WARNINGLOG% to see any warnings.
exit /B 1
:NtTreeNotSet
echo ERROR: The build environment variable isn't set.
echo Please run env.bat [checked^|free^|debug]
exit /B 1
:Done
set BUILDALL_BUILDING=
set BUILDALL_ERRORLOG=
set BUILDALL_WARNINGLOG=
exit /B 0
:RunBuild
set BUILDALL_BUILDING=%1
set BUILDALL_TITLE=%2
set BUILDALL_TITLE=%BUILDALL_TITLE:"=%
echo.
echo --- Building %BUILDALL_TITLE% ---
echo.
set BUILDALL_ERRORLOG=%BUILDALL_BUILDING%\build%BUILD_ALT_DIR%.err
set BUILDALL_WARNINGLOG=%BUILDALL_BUILDING%\build%BUILD_ALT_DIR%.wrn
pushd %BUILDALL_BUILDING%
set BUILDALL_FAILED=0
if "%VTTY%" == "1" set "BUILDALL_OPTIONS=%BUILDALL_OPTIONS% -vtty"
build %3 %4 %5 %6 %BUILDALL_OPTIONS%
if ERRORLEVEL 1 set BUILDALL_FAILED=1
popd
exit /B %BUILDALL_FAILED%
:RunSetup
set BUILDALL_TITLE=%1
set BUILDALL_TITLE=%BUILDALL_TITLE:"=%
echo.
echo --- Setting up %BUILDALL_TITLE% ---
echo.
set BUILDALL_BUILDING=%BUILDALL_SETUP_SCRIPT%
set BUILDALL_ERRORLOG=%BUILDALL_SETUP_LOG%
set BUILDALL_WARNINGLOG=
set BUILDALL_FAILED=0
perl %BUILDALL_BUILDING% %2 %3 %4 %5 >>%BUILDALL_ERRORLOG%
if ERRORLEVEL 1 set BUILDALL_FAILED=1
exit /B %BUILDALL_FAILED%