2010-01-25 23:43:05 +00:00
|
|
|
import os, sys, platform
|
2009-06-22 23:49:21 +00:00
|
|
|
|
2009-12-04 01:46:47 +00:00
|
|
|
output = 'luarpc'
|
2011-05-20 19:22:11 +03:00
|
|
|
cdefs = "-DLUA_CROSS_COMPILER -DLUA_RPC"
|
2009-06-22 23:49:21 +00:00
|
|
|
|
|
|
|
# Lua source files and include path
|
|
|
|
lua_files = """lapi.c lcode.c ldebug.c ldo.c ldump.c lfunc.c lgc.c llex.c lmem.c lobject.c lopcodes.c
|
|
|
|
lparser.c lstate.c lstring.c ltable.c ltm.c lundump.c lvm.c lzio.c lauxlib.c lbaselib.c
|
|
|
|
ldblib.c liolib.c lmathlib.c loslib.c ltablib.c lstrlib.c loadlib.c linit.c lua.c print.c lrotable.c"""
|
|
|
|
lua_full_files = " " + " ".join( [ "src/lua/%s" % name for name in lua_files.split() ] )
|
2011-05-02 16:46:53 -05:00
|
|
|
lua_full_files += " src/modules/luarpc.c src/modules/lpack.c src/modules/bitarray.c src/modules/bit.c src/luarpc_desktop_serial.c "
|
2010-01-25 23:43:05 +00:00
|
|
|
|
2011-05-20 19:22:11 +03:00
|
|
|
external_libs = '-lm'
|
2010-01-25 23:43:05 +00:00
|
|
|
|
|
|
|
if platform.system() == "Windows":
|
|
|
|
lua_full_files += " src/serial/serial_win32.c"
|
2011-05-20 19:22:11 +03:00
|
|
|
cdefs += " -DWIN32_BUILD"
|
2010-01-25 23:43:05 +00:00
|
|
|
else:
|
2011-06-20 18:04:53 -05:00
|
|
|
lua_full_files += " src/serial/serial_posix.c src/linenoise_posix.c"
|
|
|
|
cdefs += " -DLUA_USE_LINENOISE "
|
2010-01-25 23:43:05 +00:00
|
|
|
|
2011-05-20 19:22:11 +03:00
|
|
|
local_include = "-Isrc/lua -Iinc -Isrc/modules -Iinc/desktop"
|
|
|
|
|
|
|
|
# Compiler/linker options
|
|
|
|
cccom = "gcc -O2 -g %s -Wall %s -c $SOURCE -o $TARGET" % ( local_include, cdefs )
|
|
|
|
linkcom = "gcc -o $TARGET $SOURCES %s" % external_libs
|
2009-06-22 23:49:21 +00:00
|
|
|
|
|
|
|
# Env for building the program
|
2011-05-20 19:22:11 +03:00
|
|
|
comp = Environment( CCCOM = cccom,
|
|
|
|
LINKCOM = linkcom,
|
2009-06-22 23:49:21 +00:00
|
|
|
ENV = os.environ )
|
2010-01-28 01:31:32 +00:00
|
|
|
# Debug
|
2010-01-28 19:17:22 +00:00
|
|
|
Decider( 'MD5-timestamp' )
|
2011-05-20 19:22:11 +03:00
|
|
|
Default( comp.Program( output, Split( lua_full_files ) ) )
|