-
Notifications
You must be signed in to change notification settings - Fork 4
/
compile-addon.bat
155 lines (136 loc) · 4.41 KB
/
compile-addon.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
149
150
151
152
153
154
155
@echo off
set datebeg=%date%
set timest=%time%
scripts\clean-lng.pl
if ERRORLEVEL 1 goto :EOF
cd lang
start /min ..\scripts\MonaLisa.pl
cd ..
if /i "%1" == "selfconfig" goto :SelfConfig
if /i "%1" == "gethgrev" goto :GetHgRev
if /i "%1" == "writecustomtags" goto :WriteCustomTags
::if /i "%1" == "echoparams" goto :EchoParams
if /i "%1" == "cleanup" goto :Cleanup
::gcc -v --help
::gcc -C -E -P -o %NMLNAME%.nml - <src/%NMLNAME%.pnml
::gcc -C -E -P - <src/%NMLNAME%.pnml>%NMLNAME%.nml
::: ¯ à ¬¥âàë ¤«ï ¡®à
call :SelfConfig
:: ¯ à ¬¥âàë ¯®«ì§®¢ ⥫ï
call ..\config user
:: § ¤ ñ¬ ¯¥à¥¬¥ë¥ ®ªà㦥¨ï
set PATH=%PATHMINGW%;%PATHNML%;%PATHTHG%;%PATH%
:: ®¯à¥¤¥«ï¥¬ ⥪ãéãî ॢ¨§¨î
call :GetHgRev
:: ¥á«¨ MIN_COMPATIBLE_REVISION == 0, ¨á¯®«ì§ã¥¬ REPO_REVISION
if "%MIN_COMPATIBLE_REVISION%" == "0" ^
set MIN_COMPATIBLE_REVISION=%REPO_REVISION%
:::call :EchoParams
:::exit
:: ᮧ¤ ñ¬ ä ©« custom_tags
call :WriteCustomTags>%CUSTOM_TAGS%
:: ᮡ¨à ¥¬
:: -E Stop after the preprocessing stage;
:: do not run the compiler proper.
:: -C Tell the preprocessor not to discard comments.
:: Used with the `-E' option.
:: -P ¡¥§ á«ã¦¥¡®£® ¢ë¢®¤
:: -x c áç¨â ¥¬ ¨áå®¤ë¥ ä ©«ë ¯¨á 묨 ‘¨
:: -o filename १ã«ìâ â § ¯¨áë¢ ¥¬ ¢ ä ©«
:: -D amacro=defn Define macro amacro as defn.
gcc -D REPO_REVISION=%REPO_REVISION% ^
-D MIN_COMPATIBLE_REVISION=%MIN_COMPATIBLE_REVISION% ^
-E -C -P -x c -o %NMLNAME%.nml %NMLNAME%.pnml
if /i not %errorlevel% == 0 goto :Error
:: ª®¬¯¨«¨à㥬
scripts\change.pl xussr-addon.nml "\) \{" "\)\n\{"
scripts\change.pl xussr-addon.nml "\} switch" "\}\nswitch"
scripts\change.pl xussr-addon.nml "\; " "\;\n"
del xussr-addon.bak
nmlc --grf=%NMLNAME%.grf %NMLCOPTION% %NMLNAME%.nml
if /i not %errorlevel% == 0 goto :Error
:: ª®¯¨à㥬, ¥á«¨ § ¤ ¯ãâì
if /i not "%GRFFOLDER%" == "" (
xcopy /y %NMLNAME%.grf "%GRFFOLDER%\"
if /i not %errorlevel% == 0 goto :Error
scripts\copy-branch.pl %NMLNAME%.grf
if /i not %errorlevel% == 0 goto :Error
)
echo [Ok]
set compres=[Ok]
goto :END
:Error
echo [ERR]
set compres=[Err]
goto :END
:: GetHgRev
:GetHgRev
:: ®¯à¥¤¥«ï¥¬ ⥪ãéãî ॢ¨§¨î
for /F %%i in (%YDPATH%\My\-todelete\xUSSRset\%NMLNAME%.ver) do set REPO_REVISION=%%i
set /a REPO_REVISION=%REPO_REVISION%+1
echo %REPO_REVISION%>%YDPATH%\My\-todelete\xUSSRset\%NMLNAME%.ver
goto :EOF
:: WriteCustomTags
:WriteCustomTags
echo VERSION :%REPO_REVISION%
echo MIN_COMPATIBLE_REVISION:%MIN_COMPATIBLE_REVISION%
echo TITLE :xUSSR Railway Set addon 0.3-dev.r%REPO_REVISION%
echo FILENAME :%NMLNAME%.grf
goto :EOF
:: SelfConfig
:SelfConfig
:: ¨¬ï ä ©« á ¡®à®¬
set NMLNAME=xussr-addon
:: ¨¬ï á«ã¦¥¡®£® ä ©« ¤«ï ᡮન
set CUSTOM_TAGS=custom_tags.txt
:: ¬¨¨¬ «ì ï ᮢ¬¥á⨬ ï ॢ¨§¨ï
set MIN_COMPATIBLE_REVISION=1
goto :EOF
:EchoParams
echo --------------
echo NMLNAME=%NMLNAME%
echo CUSTOM_TAGS=%CUSTOM_TAGS%
echo MIN_COMPATIBLE_REVISION=%MIN_COMPATIBLE_REVISION%
echo REPO_REVISION=%REPO_REVISION%
echo NMLCOPTION=%NMLCOPTION%
echo GRFFOLDER=%GRFFOLDER%
echo PATHMINGW=%PATHMINGW%
echo PATHNML=%PATHNML%
echo PATHTHG=%PATHTHG%
echo PATH7Z=%PATH7Z%
echo --------------
goto :EOF
:: ®ç¨á⪠¯ ¯ª¨ ®â à ¡®ç¨å ä ©«®¢ ¯® ª®¬ ¤¥ "compile cleanup"
:Cleanup
call :SelfConfig
del /q /f %NMLNAME%.grf.cache %NMLNAME%.grf.cacheindex %NMLNAME%.grf ^
%NMLNAME%.nfo %NMLNAME%.nml %NMLNAME%_optimized.nml parsetab.py ^
custom_tags.txt %NMLNAME%_dep.txt
goto :EOF
:END
set timefin=%time%
set timest=%timest:~0,8%
set timefin=%timefin:~0,8%
set timest=%timest: =0%
set timefin=%timefin: =0%
set /a gettick1=(1%timest:~6,2%-100)+(1%timest:~3,2%-100)*60+(1%timest:~0,2%-100)*3600
set /a gettick2=(1%timefin:~6,2%-100)+(1%timefin:~3,2%-100)*60+(1%timefin:~0,2%-100)*3600
set /a timetot=gettick2-gettick1
set /a timetot1=timetot-(timetot/60)*60
set timetot1=0%timetot1%
set timetot1=%timetot1:~-2%
set /a timetot=timetot/60
set /a timetot2=timetot-(timetot/60)*60
set timetot2=0%timetot2%
set timetot2=%timetot2:~-2%
set /a timetot=timetot/60
set /a timetot3=timetot-(timetot/24)*24
set timetot3=0%timetot3%
set timetot3=%timetot3:~-2%
rem ¡®«¥¥ 24 ç ᮢ ¥ áç¨â ¥â
echo Total time: %timetot3%:%timetot2%:%timetot1%
echo %datebeg% %timefin% - %timetot3%:%timetot2%:%timetot1% %compres%>>compile-addon.stat
cd src
start /min ..\scripts\MonaLisa.pl
cd ..
:EOF