forked from qaisjp/myMARS
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCreateMarsJar.bat
59 lines (54 loc) · 1.61 KB
/
CreateMarsJar.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
@echo off
setlocal
rem We use the value the JAVACMD environment variable, if defined
rem and then try JAVA_HOME
set "_JAVACMD=%JAVACMD%"
if "%_JAVACMD"=="" (
if not "%JAVA_HOME%"=="" (
if exist "%JAVA_HOME%\bin\java.exe" set "_JAVACMD=%JAVA_HOME%\bin\java.exe"
)
)
if "%_JAVACMD%"=="" set _JAVACMD=java
rem Parses x out of 1.x; for example 8 out of java version 1.8.0_xx
rem Otherwise, parses the major version; 9 out of java version 9-ea
set JAVA_VERSION=0
for /f "tokens=3" %%g in ('%_JAVACMD% -Xms32M -Xmx32M -version 2^>^&1 ^| findstr /i "version"') do (
set JAVA_VERSION=%%g
)
set JAVA_VERSION=%JAVA_VERSION:"=%
for /f "delims=.-_ tokens=1-2" %%v in ("%JAVA_VERSION%") do (
if /I "%%v" EQU "1" (
set JAVA_VERSION=%%w
) else (
set JAVA_VERSION=%%v
)
)
if %JAVA_VERSION% > 9 (
mkdir "out"
mkdir "out/production"
mkdir "out/production/mymars"
echo "Compiling Mars with default javac"
dir /s /B *.java > sources.txt
javac -d "out/production/mymars" @sources.txt
jar cfm Mars.jar \
META-INF/MANIFEST.MF \
README.md \
LICENSE.md \
PseudoOps.txt \
Config.properties \
Syscall.properties \
Settings.properties \
MipsXRayOpcode.xml \
registerDatapath.xml \
controlDatapath.xml \
ALUcontrolDatapath.xml \
docs \
help \
images \
-C out/production/mymars/ Mars.class \
-C out/production/mymars/ mars
) else (
echo "Could not find an appropriate Java installation"
)
@echo "CreateMarsJar finished"
endlocal