标题: 用Tiny C Compiler编译Lua
作者: Demon
链接: http://demon.tw/programming/tiny-c-compiler-lua.html
版权: 本博客的所有文章,都遵守“署名-非商业性使用-相同方式共享 2.5 中国大陆”协议条款。
很久以前写过一篇《Windows下用TCC编译Lua源码》,现在Lua已经更新到Lua 5.3.2了,想编译一个玩玩,但是发现之前的脚本是把源文件hard code进去的,对于最新版的没法用,于是改进了一下脚本。
@echo off setlocal enabledelayedexpansion :: By Demon :: http://demon.tw set tcc=C:\tcc\tcc.exe 2>nul del *.exe *.a if exist src\luac rmdir /s /q src\luac for /f "delims=" %%i in ( 'dir /s /b src\*.c' ) do ( if not "%%~nxi" == "lua.c" ( if not "%%~nxi" == "luac.c" set src=!src! "%%i" ) ) set tcc=%tcc% -Iinclude -Isrc -w if exist src\lua set lua=lua\ %tcc% -o lua.exe %src% src\%lua%lua.c lua.exe
为了兼容性没有编译luac.exe,兼容Lua 4.0以上版本源码的编译。
随机文章: