<br/>windows
luabinaries是http://sourceforge.net/上的一个项目,主要功能是集合lua各个版本的二进制文件。我下载的windows二进制文件包括(lua52.dll lua52.exe luac52.exe wlua5.2.exe),为了在windows上生成这些文件,它在lua官方给出的源码中加入了一些文件,帮助其编译,如给上面的.exe文件加个图标等等。除了多加了个wmain.c,luabinaries并无修改官方给出的源码,并且给出的编译方案好像是tecmake,貌似相似于cmake的东东。api
我从官方下载的lua5.2.2源码包括2个文件夹:src和doc,2个文件:Makefile和README文件,可谓至关的干净。ui
解压官方给出的源码,在src目录下新建一个文件夹other,用于存放来自luabinaries项目的: wmain.c lua.ico lua52.def lua_dll.rc lua.rc 5个文件,修改.rc文件中的版本信息。在src目录下添加一个makefile文件,名为:makefile-dlldef,编译的时候就使用nmake /f makefile-dlldef
nmake /f makefile-dlldef release=
nmake /f makefile-dlldef clean
命令来执行,release编译出的文件要比官方给出的二进制小不少。lua
<pre> objs = lapi.obj lauxlib.obj lbaselib.obj lbitlib.obj lcode.obj lcorolib.obj lctype.obj ldblib.obj ldebug.obj ldo.obj ldump.obj lfunc.obj lgc.obj linit.obj liolib.obj llex.obj lmathlib.obj lmem.obj loadlib.obj lobject.obj lopcodes.obj loslib.obj lparser.obj lstate.obj lstring.obj lstrlib.obj ltable.obj ltablib.obj ltm.obj lundump.obj lvm.obj lzio.obj !message nmake usage: !message 'nmake' : build debug version. !message 'nmake release=' : build release version. !message 'nmake clean' : clean workshop !message lkf = /nologo /debug /INCREMENTAL:no /libpath:%MYLIB% lbf = /nologo mtf = -nologo !ifdef release clfcc = /nologo /c /O2 /MD /Zi /DNDEBUG /I%MYINCLUDE% /EHsc clfc = /nologo /c /O2 /MD /Zi /DNDEBUG /I%MYINCLUDE% !else clfcc = /nologo /c /MDd /Zi /I%MYINCLUDE% /EHsc clfc = /nologo /c /MDd /Zi /I%MYINCLUDE% !endif !ifdef release mydll = lua52 all : $(mydll).dll lua52.exe luac52.exe wlua52.exe !else mydll = lua52 all : $(mydll).dll lua52.exe luac52.exe wlua52.exe !endif $(mydll).dll : $(objs) other\lua_dll.res link $(lkf) /out:$@ /dll /def:other\lua52.def $** lua52.exe : lua.obj $(mydll).lib other\lua.res link $(lkf) /out:$@ $** wlua52.exe : wmain.obj lua.obj $(mydll).lib other\lua.res link $(lkf) /out:$@ /subsystem:windows $** luac52.exe : luac.obj $(objs) $(mydll).lib other\lua.res link $(lkf) /out:$@ $** .c.obj: cl $(clfc) /DLUA_COMPAT_MODULE $** wmain.obj : other\wmain.c cl $(clfc) /DLUA_COMPAT_MODULE $** .rc.res: rc $** clean: del *.exe *.obj *.pdb *.dll *.exp *.lib other\*.res </pre>.net