1
1
@rem Script to build LuaJIT with MSVC.
2
@rem Copyright (C) 2005-2011 Mike Pall. See Copyright Notice in luajit.h
2
@rem Copyright (C) 2005-2012 Mike Pall. See Copyright Notice in luajit.h
4
4
@rem Either open a "Visual Studio .NET Command Prompt"
5
5
@rem (Note that the Express Edition does not contain an x64 compiler)
19
19
@set LJMT=mt /nologo
20
20
@set LJLIB=lib /nologo
21
21
@set DASMDIR=..\dynasm
22
@set DASM=lua %DASMDIR%\dynasm.lua
22
@set DASM=%DASMDIR%\dynasm.lua
23
23
@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
25
if not exist buildvm_x86.h^
26
%DASM% -LN -o buildvm_x86.h buildvm_x86.dasc
27
@if errorlevel 1 goto :BAD
28
if not exist buildvm_x64win.h^
29
%DASM% -LN -D X64 -D X64WIN -o buildvm_x64win.h buildvm_x86.dasc
30
@if errorlevel 1 goto :BAD
32
%LJCOMPILE% /I "." /I %DASMDIR% buildvm*.c
25
%LJCOMPILE% host\minilua.c
26
@if errorlevel 1 goto :BAD
27
%LJLINK% /out:minilua.exe minilua.obj
28
@if errorlevel 1 goto :BAD
29
if exist minilua.exe.manifest^
30
%LJMT% -manifest minilua.exe.manifest -outputresource:minilua.exe
32
@set DASMFLAGS=-D WIN -D JIT -D FFI -D P64
35
@if errorlevel 8 goto :X64
36
@set DASMFLAGS=-D WIN -D JIT -D FFI
39
minilua %DASM% -LN %DASMFLAGS% -o host\buildvm_arch.h vm_x86.dasc
40
@if errorlevel 1 goto :BAD
42
%LJCOMPILE% /I "." /I %DASMDIR% host\buildvm*.c
33
43
@if errorlevel 1 goto :BAD
34
44
%LJLINK% /out:buildvm.exe buildvm*.obj
35
45
@if errorlevel 1 goto :BAD
46
56
@if errorlevel 1 goto :BAD
47
57
buildvm -m recdef -o lj_recdef.h %ALL_LIB%
48
58
@if errorlevel 1 goto :BAD
49
buildvm -m vmdef -o ..\lib\vmdef.lua %ALL_LIB%
59
buildvm -m vmdef -o jit\vmdef.lua %ALL_LIB%
50
60
@if errorlevel 1 goto :BAD
51
61
buildvm -m folddef -o lj_folddef.h lj_opt_fold.c
52
62
@if errorlevel 1 goto :BAD
85
95
if exist luajit.exe.manifest^
86
96
%LJMT% -manifest luajit.exe.manifest -outputresource:luajit.exe
88
@del *.obj *.manifest buildvm.exe
98
@del *.obj *.manifest minilua.exe buildvm.exe
90
@echo === Successfully built LuaJIT ===
100
@echo === Successfully built LuaJIT for Windows/%LJARCH% ===