编译lua5.1工程的批处理程序

清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>

@rem Script to build Lua with MSVC.
@rem Copyright (C) 2010-2011 <chaishushan{AT}gmail.com>.
@rem
@rem Either open a "Visual Studio .NET Command Prompt"
@rem Then cd to this directory and run this script.

@if not defined INCLUDE goto :FAIL
@setlocal

@if "%1"=="clean" goto :CLEAN

@rem --------------------------------------------------------------------------
@rem 

@set CC=cl
@set LD=link
@set AR=lib
@set RC=rc
@set CP=copy

@set DBG_CFLAGS=/nologo /c /Zi /Od /Ob0 /RTC1 /MD
@set CFLAGS=/nologo /c /O2 /W3
@set CFLAGS_MD=/MD
@set CFLAGS_MT=/MT
@set LDFLAGS=

@rem --------------------------------------------------------------------------
@rem Lua

@set LUA_CFLAGS=^
	/DNDEBUG^
	/D_WINDOWS^
	/DWIN32^
	/DWINNT^
	^
	/I./include^
	/I./src^
	
	
@set LUA_SRC=^
	./src/lapi.c^
	./src/lcode.c^
	./src/ldebug.c^
	./src/ldo.c^
	./src/ldump.c^
	./src/lfunc.c^
	./src/lgc.c^
	./src/llex.c^
	./src/lmem.c^
	./src/lobject.c^
	./src/lopcodes.c^
	./src/lparser.c^
	./src/lstate.c^
	./src/lstring.c^
	./src/ltable.c^
	./src/ltm.c^
	./src/lundump.c^
	./src/lvm.c^
	./src/lzio.c^
	^
	./src/lauxlib.c^
	./src/lbaselib.c^
	./src/ldblib.c^
	./src/liolib.c^
	./src/lmathlib.c^
	./src/loslib.c^
	./src/ltablib.c^
	./src/lstrlib.c^
	./src/loadlib.c^
	./src/linit.c
	
	
@set DEP_LIB=
	
@rem --------------------------------------------------------------------------

@rem Multithreaded, dynamic link
%CC% %CFLAGS_MD% %CFLAGS% %LUA_CFLAGS% %LUA_SRC%
%AR% /OUT:lua51-md.lib *.obj
del *.obj *.manifest

@rem Multithreaded, static link
%CC% %CFLAGS_MT% %CFLAGS% %LUA_CFLAGS% %LUA_SRC%
%AR% /OUT:lua51-mt.lib *.obj
del *.obj *.manifest

@rem Debug, /MD
%CC% %DBG_CFLAGS% %LUA_CFLAGS% %LUA_SRC%
%AR% /OUT:lua51-dbg.lib *.obj
del *.obj *.manifest
	
@rem --------------------------------------------------------------------------

%CC% %CFLAGS_MT% %CFLAGS% %LUA_CFLAGS% ./src/lua.c
%LD% /OUT:lua.exe lua.obj lua51-mt.lib %DEP_LIB%
del *.obj *.manifest *.exp

%CC% %CFLAGS_MT% %CFLAGS% %LUA_CFLAGS% ./src/luac.c ./src/print.c
%LD% /OUT:luac.exe  luac.obj print.obj lua51-mt.lib %DEP_LIB%
del *.obj *.manifest *.exp

@goto :END

@rem --------------------------------------------------------------------------

:CLEAN

del *.lib *.obj *.manifest *.exp
@goto :END

:FAIL
@echo You must open a "Visual Studio .NET Command Prompt" to run this script
@goto :END

@rem --------------------------------------------------------------------------
:END
PAUSE