aboutsummaryrefslogtreecommitdiff
path: root/src/xedkbuild.bat
diff options
context:
space:
mode:
Diffstat (limited to 'src/xedkbuild.bat')
-rw-r--r--src/xedkbuild.bat91
1 files changed, 91 insertions, 0 deletions
diff --git a/src/xedkbuild.bat b/src/xedkbuild.bat
new file mode 100644
index 00000000..0d84d92c
--- /dev/null
+++ b/src/xedkbuild.bat
@@ -0,0 +1,91 @@
1@rem Script to build LuaJIT with the XBox 360 SDK.
2@rem Donated to the public domain.
3@rem
4@rem Open a "Visual Studio .NET Command Prompt" (32 bit host compiler)
5@rem Then cd to this directory and run this script.
6
7@if not defined INCLUDE goto :FAIL
8@if not defined XEDK goto :FAIL
9
10@setlocal
11@rem ---- Host compiler ----
12@set LJCOMPILE=cl /nologo /c /MD /O2 /W3 /D_CRT_SECURE_NO_DEPRECATE
13@set LJLINK=link /nologo
14@set LJMT=mt /nologo
15@set DASMDIR=..\dynasm
16@set DASM=%DASMDIR%\dynasm.lua
17@set ALL_LIB=lib_base.c lib_math.c lib_bit.c lib_string.c lib_table.c lib_io.c lib_os.c lib_package.c lib_debug.c lib_jit.c lib_ffi.c
18
19%LJCOMPILE% host\minilua.c
20@if errorlevel 1 goto :BAD
21%LJLINK% /out:minilua.exe minilua.obj
22@if errorlevel 1 goto :BAD
23if exist minilua.exe.manifest^
24 %LJMT% -manifest minilua.exe.manifest -outputresource:minilua.exe
25
26@rem Error out for 64 bit host compiler
27@minilua
28@if errorlevel 8 goto :FAIL
29
30@set DASMFLAGS=-D GPR64 -D FRAME32 -D PPE -D SQRT -D DUALNUM
31minilua %DASM% -LN %DASMFLAGS% -o host\buildvm_arch.h vm_ppc.dasc
32@if errorlevel 1 goto :BAD
33
34%LJCOMPILE% /I "." /I %DASMDIR% /D_XBOX_VER=200 /DLUAJIT_TARGET=LUAJIT_ARCH_PPC host\buildvm*.c
35@if errorlevel 1 goto :BAD
36%LJLINK% /out:buildvm.exe buildvm*.obj
37@if errorlevel 1 goto :BAD
38if exist buildvm.exe.manifest^
39 %LJMT% -manifest buildvm.exe.manifest -outputresource:buildvm.exe
40
41buildvm -m peobj -o lj_vm.obj
42@if errorlevel 1 goto :BAD
43buildvm -m bcdef -o lj_bcdef.h %ALL_LIB%
44@if errorlevel 1 goto :BAD
45buildvm -m ffdef -o lj_ffdef.h %ALL_LIB%
46@if errorlevel 1 goto :BAD
47buildvm -m libdef -o lj_libdef.h %ALL_LIB%
48@if errorlevel 1 goto :BAD
49buildvm -m recdef -o lj_recdef.h %ALL_LIB%
50@if errorlevel 1 goto :BAD
51buildvm -m vmdef -o jit\vmdef.lua %ALL_LIB%
52@if errorlevel 1 goto :BAD
53buildvm -m folddef -o lj_folddef.h lj_opt_fold.c
54@if errorlevel 1 goto :BAD
55
56@rem ---- Cross compiler ----
57@set LJCOMPILE="%XEDK%\bin\win32\cl" /nologo /c /MT /O2 /W3 /GF /Gm- /GR- /GS- /Gy /openmp- /D_CRT_SECURE_NO_DEPRECATE /DNDEBUG /D_XBOX /D_LIB /DLUAJIT_USE_SYSMALLOC
58@set LJLIB="%XEDK%\bin\win32\lib" /nologo
59
60@if "%1" neq "debug" goto :NODEBUG
61@shift
62@set LJCOMPILE="%LJCOMPILE%" /Zi
63:NODEBUG
64@if "%1"=="amalg" goto :AMALG
65%LJCOMPILE% /DLUA_BUILD_AS_DLL lj_*.c lib_*.c
66@if errorlevel 1 goto :BAD
67%LJLIB% /OUT:luajit20.lib lj_*.obj lib_*.obj
68@if errorlevel 1 goto :BAD
69@goto :NOAMALG
70:AMALG
71%LJCOMPILE% /DLUA_BUILD_AS_DLL ljamalg.c
72@if errorlevel 1 goto :BAD
73%LJLIB% /OUT:luajit20.lib ljamalg.obj lj_vm.obj
74@if errorlevel 1 goto :BAD
75:NOAMALG
76
77@del *.obj *.manifest minilua.exe buildvm.exe
78@echo.
79@echo === Successfully built LuaJIT for XBox 360 ===
80
81@goto :END
82:BAD
83@echo.
84@echo *******************************************************
85@echo *** Build FAILED -- Please check the error messages ***
86@echo *******************************************************
87@goto :END
88:FAIL
89@echo To run this script you must open a "Visual Studio .NET Command Prompt"
90@echo (32 bit host compiler). The XBox 360 SDK must be installed, too.
91:END