ResGenerator_HW.bat 23.2 KB
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 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632
@echo off
set prj=
set customer=KEYTAK61D_GB_11C
set optr_path=PPP
set optr_spec=NONE
set main_lcd_size=240X320
set touch_panel_support=NONE
set MTK_PROJECT_PATH=%2
set remake_resgen=FALSE
set COMPILER_VER=gcc33
set MMI_IME_VERSION=1
set FREETYPE_ENABLE=FALSE

set LOG_PATH=.\..\..\..\build\%MTK_PROJECT_PATH%\log
set LOG_FILE=%LOG_PATH%\resgen.log

if %customer%==MTK set customer=PLUTO
if "%RESGEN_DEBUG%"=="YES" (
    set RESGEN_OPTION='USES_DEBUG=YES'
)


if %COMPILER_VER%==gcc45 goto PATH_SETTING_GCC45:

    rem Normal case

    path ..\..\tools;..\..\..\tools;..\..\..\Tools\MSYS\bin;..\..\..\..\Tools\MSYS\bin;..\..\Tools\MinGW\bin;..\..\..\Tools\MinGW\bin;..\..\..\tools\MinGW\lib\gcc-lib\mingw32\3.3.1;..\debug;.\debug;..\..\..\Tools;%path%;
    set RESGEN_MAKE=..\..\..\Tools\MSYS\bin\make

goto END_OF_PATH_SETTING:

:PATH_SETTING_GCC45

    rem gcc45 case

    path ..\..\tools;..\..\..\tools;..\..\Tools\MinGW\bin;..\..\..\Tools\MinGW\bin;..\..\..\tools\MinGW\lib\gcc-lib\mingw32\3.3.1;..\debug;.\debug;..\..\..\Tools;%path%;
    set RESGEN_MAKE=..\..\..\Tools\make 

:END_OF_PATH_SETTING

if  not .%1==.  goto a:
goto menu:

:a
rem parsing the parameters form command line
call:sub_parse_parameters %3 %4 %5 %6 %7 %8 %9

cd plutommi\Customer\ResGenerator

REM Set GCC temp directory
if not exist .\gcctmp mkdir .\gcctmp
if not "%TMPDIR%"=="" (set TMPDIR_ORIGINAL=%TMPDIR%)
if not "%TMP%"=="" (set TMP_ORIGINAL=%TMP%)
if not "%TEMP%"=="" (set TEMP_ORIGINAL=%TEMP%)

set TMPDIR=.\gcctmp
set TMP=.\gcctmp
set TEMP=.\gcctmp

echo ******************************************************************************** >> %LOG_FILE%
echo [%date%] >> %LOG_FILE%
echo [%Time%] Resgen [HW] start >> %LOG_FILE%
echo. >> %LOG_FILE%

echo VK Version=[%MMI_IME_VERSION%]

set /a COMPILE_NUM=%NUMBER_OF_PROCESSORS%*2
echo NUMBER_OF_PROCESSORS=[%NUMBER_OF_PROCESSORS%] COMPILE_NUM=[%COMPILE_NUM%]

set /a MAX_COMPILE_NUM=32
if %COMPILE_NUM% GTR %MAX_COMPILE_NUM% goto set_singel_process
goto end_singel_process

:set_singel_process
set /a COMPILE_NUM=%NUMBER_OF_PROCESSORS%
echo NUMBER_OF_PROCESSORS=[%NUMBER_OF_PROCESSORS%] COMPILE_NUM=[%COMPILE_NUM%]
:end_singel_process

set TIMELOGFILE=%CD%\resgen_time.log
echo [%Time%] start > %TIMELOGFILE%

if .%1==.PLUTO_MMI set prj=PLUTO
rem ****************************************************************
rem *************** Copy default cust resource  ********************
rem ****************************************************************
echo -------------- Copy default cust resource files ------------
call:sub_copy_default
echo -----------------DONE-----------------

echo [Dependency] plutommi\Customer\ResGenerator\Makefile >%LOG_PATH%\resgen_misc_tool.log

rem ****************************************************************
rem *************** Run ResGenerator_OP_pre.bat ********************
rem ****************************************************************
if %optr_spec%==NONE goto skip_optr_pre
echo -----------------Run ResGenerator_OP_pre.bat-----------------
call ..\..\..\%optr_path%\ResGenerator_OP_pre.bat %optr_path%
echo -----------------DONE-----------------
:skip_optr_pre


rem ************************************************************
rem *************** Start to Generate Font File ! **************
rem ************************************************************

if %remake_resgen%==TRUE if exist ..\FontResgen\font_gen.exe if exist ..\CustResource\FontRes.c if exist ..\..\..\vendor\font\inc\L_*.h (
    echo -----------------Font Resgen Skipped-----------------
    goto success_font_gen
)

echo -----------------Font Resgen Start-----------------
if exist ..\FontResgen\font_gen.exe del /q ..\FontResgen\font_gen.exe
if exist .\font_gen.exe del /q .\font_gen.exe

call:sub_run_module "make font_gen.exe" "%RESGEN_MAKE% -j%COMPILE_NUM% -fMAKEFILE font_gen.exe -k" 2 resgen_font_make.log
if %SUB_MODULE_RET%==FAIL (
    echo Error in stage: [make font_gen.exe], check log: [resgen_font_make.log] !!
    exit 3
)

copy /y .\font_gen.exe ..\FontResgen\ >NUL
cd ..\FontResgen
if not exist FontFile\NUL md FontFile
if not exist debug\NUL md debug
if not exist font_gen.exe goto skip_font_gen
if not exist ..\..\..\vendor\font\inc md ..\..\..\vendor\font\inc
if exist ..\..\..\vendor\font\inc\*.* del /q ..\..\..\vendor\font\inc\*.*

REM Input vendor\font\FontData\*\*.bdf
REM Output plutommi\Customer\FontResgen\FontFile\FontRes.c to plutommi\Customer\CustResource\FontRes.c
REM Output plutommi\Customer\FontResgen\FontFile\*.h to vendor\font\inc\*.h
font_gen.exe > %LOG_PATH%\resgen_font_run.log

echo [%Time%] Executed font_gen.exe >> %TIMELOGFILE%
copy /y .\FontFile\L_*.h ..\..\..\vendor\font\inc\ >NUL
copy /y .\FontFile\FontRes.c ..\CustResource\ >NUL
copy /y .\FontFile\FontData.c ..\CustResource\ >NUL
del /q .\FontFile\*.*
rd /s /q .\FontFile
cd ..\ResGenerator
echo -----------------Font Resgen Done-----------------

:success_font_gen


rem ************************************************************
rem ************** Start to Generate Resource ******************
rem ************** -Using Pixtel ResGenerator ******************
rem ************************************************************
rem goto skip_del_obj
if exist ..\..\customer\custresource\ref_list.txt del ..\..\customer\custresource\ref_list.txt > nul

rem if exist .\temp\ rd /S/Q .\temp\ >nul
rem if exist .\debug\ rd /S/Q .\debug\ >nul
rem if exist ..\CustomerInc\mmi_rp*.* del ..\CustomerInc\mmi_rp*.* > nul

if exist .\mtk_resgenerator.exe del .\mtk_resgenerator.exe > nul
if exist .\mtk_resgenerator.map del .\mtk_resgenerator.map > nul
if exist .\ref_list_merge.exe del .\ref_list_merge.exe > nul
if exist .\plmncreate.exe del .\plmncreate.exe > nul
if exist .\vf*.tmp del .\vf*.tmp > nul
if exist .\modis_vf*.obj del .\modis_vf*.obj > nul
if exist .\vf*.obj del .\vf*.obj > nul
if exist *.o del *.o > nul

:skip_del_obj

if not exist .\temp\ md .\temp\
if not exist .\debug\ md .\debug\
if not exist .\debug\obj md .\debug\obj
REM if not exist %LOG_PATH%\log\ md %LOG_PATH%\log\



rem ************************************************************
rem copy ref_list_xxx.txt
rem ************************************************************
REM copy ref_list_*.txt from path defined in special header to ResGenerator\temp\ref_list
if exist copy_ref_list.pl perl copy_ref_list.pl 2>>%LOG_PATH%\resgen_misc_tool.log
echo [%Time%] Executed copy_ref_list.pl >> %TIMELOGFILE%

rem ************************************************************
rem *************** make and run ref_list_merge.exe ************
rem ************************************************************

echo -----------------make and run ref_list_merge.exe-----------------
REM copy ref_list*.txt to ResGenerator\temp\ref_list
REM generate CustResource\PLUTO_MMI\ref_list.txt
call:sub_run_module "make ref_list_merge.exe" "%RESGEN_MAKE% -j%COMPILE_NUM% -fMAKEFILE ref_list_merge.exe -k" 2 resgen_ref_list_make.log
if %SUB_MODULE_RET%==FAIL (
    set RESGEN_ERR=TRUE
) ELSE (

    call:sub_run_module "run ref_list_merge.exe" "ref_list_merge.exe" 1 resgen_ref_list_run.log

    if %SUB_MODULE_RET%==FAIL (
        set RESGEN_ERR=TRUE
    )
)

rem COPY ..\custresource\%prj%_MMI\ref_list.txt ..\custresource\ref_list.txt
COPY /y ..\custresource\PLUTO_MMI\ref_list.txt ..\custresource\ref_list.txt >NUL
if not exist ..\custresource\ref_list.txt (
    echo ref_list.txt not generated! >> %LOG_FILE%
    echo. >> %LOG_FILE%
    set RESGEN_ERR=TRUE
)

if %remake_resgen%==TRUE if .%RESGEN_ERR%==.TRUE (
    echo Error in stage: [ref_list_merge.exe], check log: [resgen.log] !!
    exit 3
)
echo -----------------DONE-----------------




rem ************************************************************
rem *************** make and run plmncreate.exe     ************
rem ************************************************************

echo -----------------make and run plmncreate.exe-----------------
REM COPY ..\custresource\PLUTO_MMI\plmnlist.txt ..\custresource\plmnlist.txt
COPY /y ..\custresource\PLUTO_MMI\PlmnEnum.tmp ..\..\MMI\MiscFramework\MiscFrameworkInc\PlmnEnum.h >NUL
COPY /y ..\custresource\PLUTO_MMI\PlmnName.tmp ..\..\Service\NetSetSrv\PlmnName.c >NUL
echo [Dependency] plutommi\Customer\CustResource\PLUTO_MMI\PlmnEnum.tmp plutommi\Customer\CustResource\PLUTO_MMI\PlmnName.tmp >>%LOG_PATH%\resgen_misc_tool.log

call:sub_run_module "make plmncreate.exe" "%RESGEN_MAKE% -j%COMPILE_NUM% -fMAKEFILE plmncreate.exe" 2 resgen_plmn_make.log
if %SUB_MODULE_RET%==FAIL (
    set RESGEN_ERR=TRUE
) ELSE (

    call:sub_run_module "run plmncreate.exe" "plmncreate.exe" 1 resgen_plmn_run.log

    if %SUB_MODULE_RET%==FAIL (
        set RESGEN_ERR=TRUE
    )
)

if %remake_resgen%==TRUE if .%RESGEN_ERR%==.TRUE (
    echo Error in stage: [plmncreate.exe], check log: [resgen.log] !!
    exit 3
)
echo -----------------DONE-----------------




if %MMI_IME_VERSION%==2 (
rem ************************************************************
rem *************** make and run VKV2ResourceGen.exe ***********
rem ************************************************************
copy /y ..\custresource\PLUTO_MMI\VKV2.vkw ..\resgenerator > nul
copy /y ..\custresource\PLUTO_MMI\VKV2ResourceGen.exe ..\resgenerator > nul
echo [Dependency] plutommi\Customer\CustResource\PLUTO_MMI\VKV2.vkw plutommi\Customer\CustResource\PLUTO_MMI\VKV2ResourceGen.exe >>%LOG_PATH%\resgen_misc_tool.log
if %customer%==PLUTO goto skip_copy_vkv2_customer
copy /y ..\custresource\%customer%_MMI\VKV2.vkw ..\resgenerator > nul
copy /y ..\custresource\%customer%_MMI\VKV2ResourceGen.exe ..\resgenerator > nul
if exist ..\custresource\%customer%_MMI\VKV2.vkw echo [Dependency] plutommi\Customer\CustResource\%customer%_MMI\VKV2.vkw >>%LOG_PATH%\resgen_misc_tool.log
if exist ..\custresource\%customer%_MMI\VKV2ResourceGen.exe echo [Dependency] plutommi\Customer\CustResource\%customer%_MMI\VKV2ResourceGen.exe >>%LOG_PATH%\resgen_misc_tool.log

:skip_copy_vkv2_customer
echo -----------------VKV2 Copy done-----------------

if not exist VKV2ResourceGen.exe goto RESGEN_VKV2_ERR_1
if not exist VKV2.vkw goto RESGEN_VKV2_ERR_2

call:sub_run_module "run VKV2ResourceGen.exe" "VKV2ResourceGen.exe" 1 resgen_VKV2_run.log
if %SUB_MODULE_RET%==FAIL (
    set RESGEN_ERR=TRUE
)

if not exist gui_virtual_keyboard_res.h echo RESGEN_VKV2_ERR_3: gui_virtual_keyboard_res.h
if not exist res_virtual_keyboard.c echo RESGEN_VKV2_ERR_4: res_virtual_keyboard.c
if not exist VKB.dat echo RESGEN_VKV2_ERR_5: VKB.dat

copy /y ..\resgenerator\gui_virtual_keyboard_res.h ..\..\Framework\GUI\GUI_INC\gui_virtual_keyboard_res.h >NUL
copy /y ..\resgenerator\VKB.dat ..\..\Framework\GUI\GUI_INC\VKB.dat >NUL
COPY /y ..\resgenerator\res_virtual_keyboard.c ..\Res_MMI\res_virtual_keyboard.c >NUL

if exist ..\resgenerator\VKV2ResourceGen.exe del ..\resgenerator\VKV2ResourceGen.exe
if exist ..\resgenerator\VKV2.vkw del ..\resgenerator\VKV2.vkw

echo -----------------DONE-----------------
)




rem ************************************************************
rem *************** make and run mtk_resgenerator.exe   ********
rem ************************************************************
:make_old_resgen
rem goto jump_old_resgen

call:sub_run_module "make mtk_resgenerator.exe" "%RESGEN_MAKE% %RESGEN_OPTION% -j%COMPILE_NUM% -fMAKEFILE mtk_resgenerator.exe -k" 2 resgen_mtk_resgenerator_make.log
if %SUB_MODULE_RET%==FAIL (
    echo Error in stage: [make mtk_resgenerator.exe], check log: [resgen_mtk_resgenerator_make.log] !!
    exit 3
)

if %remake_resgen%==TRUE (
    call:sub_run_module "run mtk_resgenerator.exe" "mtk_resgenerator.exe -g -x" 1 resgen_mtk_resgenerator_run.log
) ELSE (
    call:sub_run_module "run mtk_resgenerator.exe" "mtk_resgenerator.exe -g -x -c" 1 resgen_mtk_resgenerator_run.log
)
if %SUB_MODULE_RET%==FAIL (
    set RESGEN_ERR=TRUE
)


:jump_old_resgen





rem ************************************************************
rem *************** run freetype.exe     ************
rem ************************************************************
echo [Dependency] plutommi\Customer\ResGenerator\freetype.exe >>%LOG_PATH%\resgen_misc_tool.log
if %FREETYPE_ENABLE%==TRUE (
  if not exist freetype.exe (
    echo Error: freetype.exe not found
    set RESGEN_ERR=TRUE
) ELSE (
    call:sub_run_module "run freetype.exe" "freetype.exe" 1 resgen_freetype_run.log
    if %SUB_MODULE_RET%==FAIL (
        set RESGEN_ERR=TRUE
    )
)
) ELSE (
    echo -----------------freetype.exe is skipped-----------------
)





rem ************************************************************
rem *** Menu Tree Tool gen resource to copy back if needed *****
rem ************************************************************
if exist ..\custresource\CustMenuToolRes.c copy ..\custresource\CustMenuToolRes.c ..\custresource\CustMenuRes.c /y >NUL

rem ************************************************************
rem ************** Start to Generate Resource ******************
rem ************************************************************

echo -----------------clear intermediate files-----------------
rem if exist ..\Res_MMI\ rd /S/Q ..\Res_MMI\
rem if exist .\temp\ rd /S/Q .\temp\

if exist ..\custresource\CustENFBImgData copy ..\custresource\CustENFBImgData ..\..\..\MoDIS_VC9\MoDIS\CustENFBImgData /y >NUL
if exist ..\custresource\CustENFBImgData copy ..\custresource\CustENFBStrData ..\..\..\MoDIS_VC9\MoDIS\CustENFBStrData /y >NUL

rem ************************************************************
rem Generate the MTE image resource header file.
rem ************************************************************
perl mte_parse_img_usage.pl 2>>%LOG_PATH%\resgen_misc_tool.log
if exist mte_parse_img_usage.pl echo [Dependency] plutommi\Customer\ResGenerator\mte_parse_img_usage.pl >>%LOG_PATH%\resgen_misc_tool.log
echo [%Time%] Executed mte_parse_img_usage.pl >> %TIMELOGFILE%

rem ************************************************************
rem Generate the MSLT resource header file.
rem ************************************************************
if exist mslt_parse_info.pl perl mslt_parse_info.pl 2>>%LOG_PATH%\resgen_misc_tool.log
if exist mslt_parse_info.pl echo [Dependency] plutommi\Customer\ResGenerator\mslt_parse_info.pl >>%LOG_PATH%\resgen_misc_tool.log
echo [%Time%] Executed mslt_parse_info.pl >> %TIMELOGFILE%

rem ************************************************************
rem Generate the image_resource_usage.htm
rem ************************************************************
if exist resgen_log_info_gen.py ..\..\..\tools\python25\python resgen_log_info_gen.py >>%LOG_PATH%\resgen_misc_tool.log
if exist output_image_html.pl perl output_image_html.pl 2>>%LOG_PATH%\resgen_misc_tool.log
if exist output_image_html.pl echo [Dependency] plutommi\Customer\ResGenerator\output_image_html.pl >>%LOG_PATH%\resgen_misc_tool.log
echo [%Time%] Executed output_image_html.pl >> %TIMELOGFILE%

rem ************************************************************
rem Generate Venus theme resource
rem ************************************************************
echo [Dependency] plutommi\Customer\ResGenerator\venus_theme_generator.bat >>%LOG_PATH%\resgen_misc_tool.log
call:sub_run_module "run venus_theme_generator.bat" "call venus_theme_generator.bat" 1 resgen_venus_theme_gen.log
if %SUB_MODULE_RET%==FAIL (
    echo Error in stage: [run venus_theme_generator.bat], check log: [resgen_venus_theme_gen.log] !!
    set RESGEN_ERR=TRUE
)

rem ************************************************************
rem Copy MODIS 3rd ROM files
rem ************************************************************
if not exist ..\..\..\MoDIS_VC9\MoDIS mkdir ..\..\..\MoDIS_VC9\MoDIS
if exist ..\custresource\CustMMI3rdROM copy ..\custresource\CustMMI3rdROM ..\..\..\MoDIS_VC9\MoDIS\CustMMI3rdROM /y >NUL
if exist .\ThemeXML\Temp\CustEnfbVenusThemeData copy .\ThemeXML\Temp\CustEnfbVenusThemeData ..\..\..\MoDIS_VC9\MoDIS\CustEnfbVenusThemeData /y >NUL
if exist .\ThemeXML\Temp\CustEnfbVenusAppIconData copy .\ThemeXML\Temp\CustEnfbVenusAppIconData ..\..\..\MoDIS_VC9\MoDIS\CustEnfbVenusAppIconData /y >NUL
if exist .\hw_data.gbd copy .\hw_data.gbd ..\..\..\MoDIS_VC9\MoDIS\hw_data.gbd /y >NUL
if exist ..\custresource\CustENFBFontData copy ..\custresource\CustENFBFontData ..\..\..\MoDIS_VC9\MoDIS\CustENFBFontData /y >NUL


rem ************************************************************
rem Generate file list
rem ************************************************************
if exist generate_file_list.pl perl generate_file_list.pl 2>>%LOG_PATH%\resgen_misc_tool.log
if exist generate_file_list.pl echo [Dependency] plutommi\Customer\ResGenerator\generate_file_list.pl >>%LOG_PATH%\resgen_misc_tool.log
echo [%Time%] Executed generate_file_list.pl >> %TIMELOGFILE%

perl ..\..\..\tools\pack_dep_gcc.pl debug\dep\resgen.dep debug\dep\resgen plutommi\Customer\ResGenerator
perl ..\..\..\tools\pack_dep_gcc.pl debug\dep\common.dep debug\dep\common plutommi\Customer\ResGenerator

rem ************************************************************
rem Generate used include path list
rem ************************************************************
..\..\..\tools\python25\python .\merge_dep.py
echo [Dependency] plutommi\Customer\ResGenerator\merge_dep.py >>%LOG_PATH%\resgen_misc_tool.log

echo ******************************************************************************** >> %LOG_FILE%
echo [%Time%] Resgen [HW] end >> %LOG_FILE%
echo. >> %LOG_FILE%
if .%RESGEN_ERR%==.TRUE (
    echo -----------------ResGenerator_HW Fail!!----------------- >> %LOG_FILE%
) ELSE (
    echo -----------------ResGenerator_HW Succeed!!----------------- >> %LOG_FILE%
)
echo. >> %LOG_FILE%
echo. >> %LOG_FILE%
echo. >> %LOG_FILE%
echo. >> %LOG_FILE%
echo. >> %LOG_FILE%

cd ..\..\..\

if .%RESGEN_ERR%==.TRUE (
    echo -----------------ResGenerator_HW Fail!!-----------------
    echo Please check log: [resgen.log]
    exit 3
)

if not "%TMPDIR_ORIGINAL%"=="" (set TMPDIR=%TMPDIR_ORIGINAL%)
if not "%TMP_ORIGINAL%"=="" (set TMP=%TMP_ORIGINAL%)
if not "%TEMP_ORIGINAL%"=="" (set TEMP=%TEMP_ORIGINAL%)

echo -----------------ResGenerator_HW Complete!!-----------------

goto done

rem ************************************************************
rem ************** Error Handling and Messages *****************
rem ************************************************************
:RESGEN_REF_LIST_MERGE_ERR
echo Error in ResGenerating Process make merge ref_list.txt error!!
echo Please Check log file res_gen_make_ref_list.log !! 
exit 3

:RESGEN_RUN_REF_LIST_MERGE_ERR
echo Error in ResGenerating run merge ref_list.txt error!!
echo Please Check log file res_gen_run_ref_list.log !! 
exit 3

:RESGEN_REF_LIST_ERR
echo Error in ResGenerating Process ref_list.txt not exist!!
echo Please Check it !! 
exit 3

:RESGEN_VECTOR_FONT_MAX_MEM_ERR
echo Please Check freetype tool exe!!
exit 3

:RESGEN_RUN_VECTOR_FONT_MAX_MEM_ERR
echo Error in run freetype exe!!
echo Please Check log file res_gen_freetype.log !!
exit 3

:RESGEN_PLMN_ERR
echo Error in ResGenerating Process make plmn error!!
echo Please Check log file res_gen_make_plmn.log !!
exit 3

:RESGEN_RUN_PLMN_ERR
echo Error in run plmncreate error!!
echo Please Check log file res_gen_run_plmn.log !!
exit 3

:RESGEN_MAKE_RESGEN_EXE_ERR
echo Error in ResGenerating Process make mtk_resgenerator.exe!!
echo Please Check log file res_gen.log !!
exit 3

:RESGEN_RUN_RESGEN_EXE_ERR
echo Error in ResGenerating Process run mtk_resgenerator.exe!!
echo Please Check log file res_gen_mtk_resgenerator.log !!
exit 3

:RESGEN_VKV2_ERR_1
echo Error in ResGenerating Process VK_V2 error1!!
echo Please Check again!!
exit 3

:RESGEN_VKV2_ERR_2
echo Error in ResGenerating Process VK_V2 error2!!
echo Please Check again!!
exit 3

:RESGEN_VKV2_ERR_3
echo Error in ResGenerating Process VK_V2 error3!!
echo Please Check again!!
exit 3

:RESGEN_VKV2_ERR_4
echo Error in ResGenerating Process VK_V2 error4!!
echo Please Check again!!
exit 3

:RESGEN_VKV2_ERR_5
echo Error in ResGenerating Process VK_V2 error5!!
echo Please Check again!!
exit 3

:RESGEN_VKV2_ERR_6
echo Error in ResGenerating Process VK_V2 error6!!
echo Please Check VKV2ResourceGen.log!!
exit 3


rem ************************************************************
rem **************** Parse BAT parameters **********************
rem ************************************************************
:sub_parse_parameters
rem echo Parse BAT parameters: %1 , %2, %3, %4, %5, %6, %7, %8, %9
echo ---------- ResGenerator_HW.bat Parameter Resolving ------------------
:BAT_PARAM_PARSING_START
if .%1 == . goto:BAT_PARAM_PARSING_END
echo PARAM: %1
rem parsing the parameter here
if .%1==.R set remake_resgen=TRUE
if .%1==.IMEv3 set MMI_IME_VERSION=3
if .%1==.IMEv2 set MMI_IME_VERSION=2
shift
goto:BAT_PARAM_PARSING_START
:BAT_PARAM_PARSING_END
echo ---------------------------------------------------------------------
goto:eof


rem ***************************************************************************
rem *** run Sub module
rem *** %1 = submodule description
rem *** %2 = command line
rem *** %3 = error direction (1 or 2)
rem *** %4 = log filename
rem *** %5 = log pattern
:sub_run_module
echo -----------------%~1----------------
echo =========================================================================== >> %LOG_FILE%
rem Reset the value of SUB_MODULE_RET to FAIL
set SUB_MODULE_RET=FAIL

echo [%Time%] %~1 >> %LOG_FILE%

%~2 %3> %LOG_PATH%\%~4

echo [%Time%] Executed %~1 >> %TIMELOGFILE%

rem Check if the program return success or not
IF %ERRORLEVEL% EQU 0 SET SUB_MODULE_RET=OK
IF %ERRORLEVEL% EQU 1 SET SUB_MODULE_RET=OK

IF NOT "%SUB_MODULE_RET%"=="OK" (
    echo Failed!! [%ERRORLEVEL%] >> %LOG_FILE%
    call:sub_parse_error %~4 %~5
)ELSE (
    echo Succeed. [%ERRORLEVEL%][%Time%] >> %LOG_FILE%
)

echo. >> %LOG_FILE%
goto:eof

rem ************************************************************
rem **************** Parse Error function **********************
rem ************************************************************
:sub_parse_error
echo log = [%1], error summarized: >> %LOG_FILE%
echo. >> %LOG_FILE%

IF .%2==. (
    FINDSTR /I /N /R "\<error\>" %LOG_PATH%\%1 > ~tmp.str
) ELSE (
    FINDSTR /I /N /R "\<%2\>" %LOG_PATH%\%1 > ~tmp.str
)
type ~tmp.str >> %LOG_FILE%
del ~tmp.str
goto:eof

rem ************************************************************
rem **************** Copy Default Files ************************
rem ************************************************************
:sub_copy_default
echo copy default resouce output files
if not exist ..\..\Framework\EventHandling\EventsInc\mmi_menu_handlers.h copy .\DefaultOutput\mmi_menu_handlers.h ..\..\Framework\EventHandling\EventsInc\
if not exist ..\CustResource\CustFastLogoImgData.h copy .\DefaultOutput\CustFastLogoImgData.h ..\CustResource\
if not exist ..\CustResource\CustWebcamImgData.h copy .\DefaultOutput\CustWebcamImgData.h ..\CustResource\
echo [Dependency] plutommi\Customer\ResGenerator\DefaultOutput\mmi_menu_handlers.h plutommi\Customer\ResGenerator\DefaultOutput\CustFastLogoImgData.h plutommi\Customer\ResGenerator\DefaultOutput\CustWebcamImgData.h >>%LOG_PATH%\resgen_misc_tool.log
goto:eof

rem ************************************************************
rem **************** Menu To Select Project ********************
rem ************************************************************
:menu
@echo off
rem cls
rem echo MediaTek Resource Generator
rem echo. 
rem echo Please select one project to generate resource...
rem echo.
rem echo    SELECT MENU
rem echo    ==========
rem echo.
rem echo    1 - PLUTO
rem echo.
rem echo    Q - Quit
rem choice /C:1Q>nul

rem if errorlevel 23 goto done
rem if errorlevel 1 goto PLUTO:
goto PLUTO:

goto done


:PLUTO
set prj=PLUTO
goto a:

:done