forked from Dlang-UPB/D-scanner
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.bat
148 lines (137 loc) · 4.31 KB
/
build.bat
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
@echo off
setlocal enabledelayedexpansion
if "%DC%"=="" set DC="dmd"
if "%DC%"=="ldc2" set DC="ldmd2"
if "%MFLAGS%"=="" set MFLAGS="-m32"
:: git might not be installed, so we provide 0.0.0 as a fallback or use
:: the existing githash file if existent
if not exist "bin" mkdir bin
git describe --tags > bin\githash_.txt
for /f %%i in ("bin\githash_.txt") do set githashsize=%%~zi
if %githashsize% == 0 (
if not exist "bin\githash.txt" (
echo v0.0.0 > bin\githash.txt
)
) else (
move /y bin\githash_.txt bin\githash.txt
)
set DFLAGS=-O -release -version=StdLoggerDisableWarning -version=CallbackAPI -version=DMDLIB -version=MARS -version=NoBackend -version=NoMain -Jbin -Jdmd -Jdmd\compiler\src\dmd\res %MFLAGS%
set TESTFLAGS=-g -w -version=StdLoggerDisableWarning -version=CallbackAPI -version=DMDLIB -version=MARS -version=NoBackend -version=NoMain -Jbin -Jdmd -Jdmd\compiler\src\dmd\res
set CORE=
set LIBDPARSE=
set STD=
set ANALYSIS=
set INIFILED=
set DSYMBOL=
set CONTAINERS=
set LIBDDOC=
set DMD_FRONTEND_DENYLIST=^
dmd\compiler\src\dmd\mars.d^
dmd\compiler\src\dmd\dmsc.d^
dmd\compiler\src\dmd\e2ir.d^
dmd\compiler\src\dmd\eh.d^
dmd\compiler\src\dmd\glue.d^
dmd\compiler\src\dmd\iasmdmd.d^
dmd\compiler\src\dmd\irstate.d^
dmd\compiler\src\dmd\lib.d^
dmd\compiler\src\dmd\libelf.d^
dmd\compiler\src\dmd\libmach.d^
dmd\compiler\src\dmd\libmscoff.d^
dmd\compiler\src\dmd\libomf.d^
dmd\compiler\src\dmd\objc_glue.d^
dmd\compiler\src\dmd\s2ir.d^
dmd\compiler\src\dmd\scanelf.d^
dmd\compiler\src\dmd\scanmach.d^
dmd\compiler\src\dmd\scanmscoff.d^
dmd\compiler\src\dmd\scanomf.d^
dmd\compiler\src\dmd\tocsym.d^
dmd\compiler\src\dmd\toctype.d^
dmd\compiler\src\dmd\tocvdebug.d^
dmd\compiler\src\dmd\toobj.d^
dmd\compiler\src\dmd\todt.d^
dmd\compiler\src\dmd\toir.d
set DMD_FRONTEND_SRC=
for %%x in (dmd\compiler\src\dmd\common\*.d) do set DMD_FRONTEND_SRC=!DMD_FRONTEND_SRC! %%x
for %%x in (dmd\compiler\src\dmd\root\*.d) do set DMD_FRONTEND_SRC=!DMD_FRONTEND_SRC! %%x
for %%x in (dmd\compiler\src\dmd\visitor\*.d) do set DMD_FRONTEND_SRC=!DMD_FRONTEND_SRC! %%x
for %%x in (dmd\compiler\src\dmd\mangle\*.d) do set DMD_FRONTEND_SRC=!DMD_FRONTEND_SRC! %%x
for %%x in (dmd\compiler\src\dmd\*.d) do (
echo "%DMD_FRONTEND_DENYLIST%" | findstr /i /c:"%%x" >nul
if errorlevel 1 (
set "DMD_FRONTEND_SRC=!DMD_FRONTEND_SRC! %%x"
)
)
for %%x in (src\dscanner\*.d) do set CORE=!CORE! %%x
for %%x in (src\dscanner\analysis\*.d) do set ANALYSIS=!ANALYSIS! %%x
for %%x in (libdparse\src\dparse\*.d) do set LIBDPARSE=!LIBDPARSE! %%x
for %%x in (libdparse\src\std\experimental\*.d) do set LIBDPARSE=!LIBDPARSE! %%x
for %%x in (libddoc\src\ddoc\*.d) do set LIBDDOC=!LIBDDOC! %%x
for %%x in (libddoc\common\source\ddoc\*.d) do set LIBDDOC=!LIBDDOC! %%x
for %%x in (inifiled\source\*.d) do set INIFILED=!INIFILED! %%x
for %%x in (DCD\dsymbol\src\dsymbol\*.d) do set DSYMBOL=!DSYMBOL! %%x
for %%x in (DCD\dsymbol\src\dsymbol\builtin\*.d) do set DSYMBOL=!DSYMBOL! %%x
for %%x in (DCD\dsymbol\src\dsymbol\conversion\*.d) do set DSYMBOL=!DSYMBOL! %%x
for %%x in (containers\src\containers\*.d) do set CONTAINERS=!CONTAINERS! %%x
for %%x in (containers\src\containers\internal\*.d) do set CONTAINERS=!CONTAINERS! %%x
if "%1" == "test" goto test_cmd
@echo on
%DC% %MFLAGS%^
%CORE%^
%STD%^
%LIBDPARSE%^
%LIBDDOC%^
%ANALYSIS%^
%INIFILED%^
%DSYMBOL%^
%CONTAINERS%^
%DMD_FRONTEND_SRC%^
%DFLAGS%^
-Ilibdparse\src^
-IDCD\dsymbol\src^
-Icontainers\src^
-Ilibddoc\src^
-Ilibddoc\common\source^
-Idmd\compiler\src^
-ofbin\dscanner.exe
goto eof
:test_cmd
@echo on
set TESTNAME="bin\dscanner-unittest"
%DC% %MFLAGS% ^
%STD%^
%LIBDPARSE%^
%LIBDDOC%^
%INIFILED%^
%DSYMBOL%^
%CONTAINERS%^
%DMD_FRONTEND_SRC%^
-I"libdparse\src"^
-I"DCD\dsymbol\src"^
-I"containers\src"^
-I"libddoc\src"^
-I"dmd\compiler\src"^
-I"dmd\compiler\src\dmd\res"^
%TESTFLAGS%^
-lib^
-of%TESTNAME%.lib
if exist %TESTNAME%.lib %DC% %MFLAGS%^
%CORE%^
%ANALYSIS%^
%TESTNAME%.lib^
-I"src"^
-I"inifiled\source"^
-I"libdparse\src"^
-I"DCD\dsymbol\src"^
-I"containers\src"^
-I"libddoc\src"^
-I"libddoc\common\source"^
-I"dmd\compiler\src"^
-I"dmd\compiler\src\dmd\res"^
-unittest^
%TESTFLAGS%^
-of%TESTNAME%.exe
if exist %TESTNAME%.exe %TESTNAME%.exe
if exist %TESTNAME%.obj del %TESTNAME%.obj
if exist %TESTNAME%.lib del %TESTNAME%.lib
if exist %TESTNAME%.exe del %TESTNAME%.exe
:eof