代码拉取完成,页面将自动刷新
#!/bin/sh
#
# Shell script wrapper to convert Lua to C and optionally
# compile and run it.
#
# option -c causes compilation only (no run)
# option -C causes C source generation only (no compile or run)
pushd "`dirname \"$0\"`" > /dev/null
export CWD="$PWD"
popd > /dev/null
# You may need to change these variables:
LUA=lua
CC=gcc
CFLAGS="-O3 -fomit-frame-pointer -DNDEBUG -Wall -Ilua/src"
#CFLAGS="-O2 -DNDEBUG -Wall -Ilua/src"
#CFLAGS=-g
LFLAGS="-Llua/src -llua"
LUA2C="${LUA} $CWD/lua2c.lua"
#LUA2C="./lua2c"
COMPILEONLY=
if [ "$1" = "-c" ]
then
COMPILEONLY=1
shift
elif [ "$1" = "-C" ]
then
COMPILEONLY=2
shift
fi
if [ "$1" = "" ]
then
echo "usage: clua [options] [filename.lua] ..."
echo " options:"
echo " -c compile only (no run)"
echo " -C generate C source only (no compile or run)"
exit 1
fi
LUAFILE=$1
FILENAME=${LUAFILE%.*}
CFILE=${FILENAME}.c
LUA_PATH=$CWD/lib/?.lua ${LUA2C} ${LUAFILE} > ${CFILE} || exit 1
if [ "$COMPILEONLY" = "2" ]
then
exit 0
fi
${CC} ${CFLAGS} ${CFILE} -o ${FILENAME} ${LFLAGS} || exit 1
if [ "$COMPILEONLY" = "1" ]
then
exit 0
fi
shift
./${FILENAME} $@
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。