-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathmake.cmd
131 lines (107 loc) · 3.72 KB
/
make.cmd
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
@rem #!%SystemRoot%\cmd.exe
@rem **************************************************************************
@rem Usage:
@rem .\make debug|release|clean (rebuild|dry-run)
@rem **************************************************************************
@echo off
set ERRORLEVEL=
setlocal
@rem **************************************************************************
@rem Set defaults
set debuglevel=release
set target=all
set MAKE=nmake -nologo
set proj_desc=NeonCube GPL project
@rem **************************************************************************
@rem Accept only rebuild, dry-run or no 2nd parameter
if "%2" == "rebuild" goto trig_rebuild_mode
if "%2" == "dry-run" goto trig_simul_mode
if "%1" == "clean" goto trig_clean_mode
if "%2" == "clean" goto trig_clean_mode
if not "%2" == "" goto bad_cmdspec_arg2
goto trig_lazy_mode
@rem **************************************************************************
:trig_rebuild_mode
set target=clean all
goto trig_lazy_mode
@rem **************************************************************************
:trig_simul_mode
set target=all /n
goto trig_lazy_mode
@rem **************************************************************************
:trig_clean_mode
set target=clean
goto trig_lazy_mode
@rem **************************************************************************
:trig_lazy_mode
if "%1" == "release" goto release
if "%1" == "debug" goto debug
if "%1" == "clean" goto implicit
if not "%1" == "" goto bad_cmdspec_arg1
:implicit
if "%1" == "" echo No configuration specified; defaulting to: _________ %debuglevel% _________
if "%debuglevel%" == "release" goto release
goto debug
@rem **************************************************************************
:release
set debugspec=
goto start_build
@rem **************************************************************************
:debug
set debugspec=DEBUG=Yay
@rem **************************************************************************
:start_build
echo Building %proj_desc% from directory: %~dp0
echo SLN_DIR=%~dp0 > sln.cfg
echo DIR_ZLIB=%~dp0zlib >> sln.cfg
echo DIR_GRF=%~dp0libgrf >> sln.cfg
echo DIR_UNRAR=%~dp0unrar >> sln.cfg
echo DIR_BROWSER=%~dp0browser >> sln.cfg
@rem **************************************************************************
rem Sample
rem @echo %MAKE% /f %proj_mak% %target% %debugspec%
rem %MAKE% /f %proj_mak% %target% %debugspec%
rem if errorlevel 1 goto make_sad_end
rem goto happy_end
@rem **************************************************************************
for %%D in ( zlib libgrf unrar browser ) do (
echo.
echo = Building %%D...
pushd %%D
@%MAKE% /f Makefile.msc %target% %debugspec%
if errorlevel 1 goto make_sad_end
popd
)
@rem **************************************************************************
@rem mkdir bin 2> NUL
@rem **************************************************************************
echo.
echo Building NeonCube executable...
rem pushd src
@%MAKE% /f Makefile.msc %target% %debugspec%
@rem %MAKE% /f Makefile.msc %target% %debugspec%
if errorlevel 1 goto make_sad_end
rem popd
@rem **************************************************************************
goto happy_end
@rem **************************************************************************
:bad_cmdspec_arg1
echo error: First parameter should be "release", "debug" or "clean"
%ComSpec% /c exit /b 1
goto sad_end
@rem **************************************************************************
:bad_cmdspec_arg2
echo error: Second parameter should be "rebuild", "dry-run" or empty
%ComSpec% /c exit /b 1
goto sad_end
:make_sad_end
echo ** Program has returned with code %ERRORLEVEL%
popd
:sad_end
endlocal
goto real_end
:happy_end
popd
endlocal
:real_end
%ComSpec% /c exit /b %ERRORLEVEL%