]> git.lizzy.rs Git - metalua.git/blob - src/make.bat
Merge remote branch 'origin/master'
[metalua.git] / src / make.bat
1 @CLS
2
3 @REM *** Settings ***
4
5 @REM BASE        = root directory of metalua sources
6 @REM DISTRIB_BIN = metalua executables target directory
7 @REM DISTRIB_LIB = metalua libraries target directory, can be an existing path referenced in LUA_PATH
8 @REM LUA, LUAC   = Lua executables, provided by metalua by default.
9
10 @REM --- BEGINNING OF USER-EDITABLE PART ---
11
12 @set BASE=%CD%
13 @set DISTRIB=%BASE%\..\distrib
14 @set DISTRIB_BIN=%DISTRIB%\bin
15 @set DISTRIB_LIB=%DISTRIB%\lib
16 @set LUA=%DISTRIB_BIN%\lua
17 @set LUAC=%DISTRIB_BIN%\luac
18
19 @REM --- END OF USER-EDITABLE PART ---
20
21
22 @REM *** Create the distribution directories, populate them with lib sources ***
23
24 @set LUA_PATH=?.luac;?.lua;%DISTRIB_LIB%\?.luac;%DISTRIB_LIB%\?.lua
25 @set LUA_MPATH=?.mlua;%DISTRIB_LIB%\?.mlua
26
27 mkdir %DISTRIB%
28 mkdir %DISTRIB_BIN%
29 mkdir %DISTRIB_LIB%
30 xcopy /y /s lib %DISTRIB_LIB%
31 xcopy /y /s bin %DISTRIB_BIN%
32
33 @REM *** Generate a callable batch metalua.bat script ***
34
35 echo @set LUA_PATH=?.luac;?.lua;%DISTRIB_LIB%\?.luac;%DISTRIB_LIB%\?.lua > %DISTRIB_BIN%\metalua.bat
36 echo @set LUA_MPATH=?.mlua;%DISTRIB_LIB%\?.mlua >> %DISTRIB_BIN%\metalua.bat
37 echo @%LUA% %DISTRIB_LIB%\metalua.luac %%* >> %DISTRIB_BIN%\metalua.bat
38
39
40 @REM *** Compiling the parts of the compiler written in plain Lua ***
41
42 cd compiler
43 %LUAC% -o %DISTRIB_LIB%\metalua\bytecode.luac lopcodes.lua lcode.lua ldump.lua compile.lua
44 %LUAC% -o %DISTRIB_LIB%\metalua\mlp.luac lexer.lua gg.lua mlp_lexer.lua mlp_misc.lua mlp_table.lua mlp_meta.lua mlp_expr.lua mlp_stat.lua mlp_ext.lua
45 cd ..
46
47 @REM *** Bootstrap the parts of the compiler written in metalua ***
48
49 %LUA% %BASE%\build-utils\bootstrap.lua %BASE%\compiler\mlc.mlua output=%DISTRIB_LIB%\metalua\mlc.luac
50 %LUA% %BASE%\build-utils\bootstrap.lua %BASE%\compiler\metalua.mlua output=%DISTRIB_LIB%\metalua.luac
51
52 @REM *** Finish the bootstrap: recompile the metalua parts of the compiler with itself ***
53
54 call %DISTRIB_BIN%\metalua -vb -f compiler\mlc.mlua     -o %DISTRIB_LIB%\metalua\mlc.luac
55 call %DISTRIB_BIN%\metalua -vb -f compiler\metalua.mlua -o %DISTRIB_LIB%\metalua.luac
56
57 @REM *** Precompile metalua libraries ***
58 %LUA% %BASE%\build-utils\precompile.lua directory=%DISTRIB_LIB% command=%DISTRIB_BIN%\metalua