forked from Stephane-D/SGDK
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build_adv.bat
127 lines (103 loc) · 3.25 KB
/
build_adv.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
@echo OFF
echo.
echo " _____ _____ ____ _____ "
echo "| __| __| \| | |"
echo "|__ | | | | | -|"
echo "|_____|_____|____/|__|__|"
echo.
echo.
echo "This batch script helps to build SGDK if PATH environmental variables "
echo " are not setup for GDK already. "
echo.
echo "(1) When run the GDK and GDK_WIN EnvVars will be configured "
echo " temporarily for the local directory. "
echo "(2) The User will be asked whether to temporarily empty PATH. If yes, "
echo " PATH will be cleared for the the local script's execution only. "
echo "(3) SGDK clean script will be launched and then SGDK will be rebuild. "
:START
echo.
echo.
echo.
echo 1) Starting:
echo ------------
set "str_ScriptName=%~f0"
echo Now running %str_ScriptName%
echo.
setlocal
:CREATEENVVARS
echo.
echo 2) Creating EnvVars:
echo --------------------
set "str_MyCurrentDir=%~dp0"
set "GDK=%str_MyCurrentDir%"
set "GDK_WIN=%str_MyCurrentDir%"
set "GDK=%GDK:\=/%"
if %GDK:~-1%==/ set "GDK=%GDK:~0,-1%"
if %GDK_WIN:~-1%==\ set "GDK_WIN=%GDK_WIN:~0,-1%"
echo GDK is %GDK%
echo GDK_WIN is %GDK_WIN%
:CHECKINGPATH
echo.
echo 3) Checking PATH:
echo --------------------
set "PATHREAL=%PATH%"
echo PATH = %PATH%
echo.
:PATHCLEARQUESTION
echo Conflicting GCC setups in PATH can cause issues.
set /p "EMPTYPATH=Should PATH be temporarily cleared? (Y/[N])?"
if /i "%EMPTYPATH:~,1%" EQU "Y" goto YCLEARPATH
if /i "%EMPTYPATH:~,1%" EQU "N" goto NCLEARPATH
echo Please type Y for Yes or N for No
goto PATHCLEARQUESTION
:YCLEARPATH
echo Setting PATH to just GDK stuff so that other CC1's do not conflict.
REM Assuming that the current directory exists since that is where this file is.
set "PATH=%GDK_WIN%"
if EXIST %GDK_WIN%\bin set "PATH=%PATH%;%GDK_WIN%\bin"
echo PATH = %PATH%
goto CONTINUEAFTERCLEARQUESTION
:NCLEARPATH
set "TPATH=%GDK_WIN%"
if EXIST %GDK_WIN%\bin set "TPATH=%TPATH%;%GDK_WIN%\bin"
set "PATH=%TPATH%;%PATH%"
goto CONTINUEAFTERCLEARQUESTION
:CONTINUEAFTERCLEARQUESTION
echo %GDK_WIN%\bin added to PATH
echo.
echo PATH = %PATH%
:LAUNCHING
echo.
echo 4) Launching:
echo ------------------
%GDK_WIN%\bin\make -f %GDK_WIN%\makelib.gen clean
%GDK_WIN%\bin\make -f %GDK_WIN%\makelib.gen
:MAKECARTBAT
echo.
echo 5) Creating a make_cart.bat file for this machine.
echo -------------------------------------------------
echo.
echo Batch for your machine:
echo =======================
echo set GDK=%GDK%
echo GDK_WIN=%GDK_WIN%
echo PATH=%PATH%
echo %GDK_WIN%\bin\make -f %GDK_WIN%\makefile.gen
echo.
echo ============================================
echo set GDK=%GDK%> make_cart.bat
echo set GDK_WIN=%GDK_WIN%>> make_cart.bat
echo set PATH=%PATH%>> make_cart.bat
echo %GDK_WIN%\bin\make -f %GDK_WIN%\makefile.gen>> make_cart.bat
:CLEANUP
echo.
echo 6) Done. Cleaning up.
echo ---------------------
echo.
echo Reseting PATH.
set "PATH=%PATHREAL%"
echo PATH = %PATH%
:END
endlocal
@echo ON
exit /b