2010-02-01 18:47:41 +00:00
|
|
|
import os, sys, platform
|
|
|
|
|
|
|
|
sim = ARGUMENTS.get( 'sim', '0' )
|
|
|
|
|
|
|
|
flist = ""
|
2011-01-16 00:23:19 +00:00
|
|
|
cdefs = "-DRFS_STANDALONE_MODE"
|
|
|
|
socklib = ''
|
2010-02-01 18:47:41 +00:00
|
|
|
if sim == '0':
|
|
|
|
mainname = "main.c"
|
|
|
|
else:
|
|
|
|
mainname = 'main_sim.c'
|
|
|
|
if platform.system() == "Windows":
|
|
|
|
if sim == '1':
|
|
|
|
print "SIM target not supported under Windows"
|
|
|
|
os.exit( 1 )
|
2011-05-07 14:00:11 +02:00
|
|
|
flist = "main.c server.c os_io_win32.c log.c net_win32.c serial_win32.c deskutils.c rfs_transports.c"
|
2011-01-16 00:23:19 +00:00
|
|
|
cdefs = cdefs + " -DWIN32_BUILD"
|
|
|
|
exeprefix = ".exe"
|
|
|
|
socklib = '-lws2_32'
|
2010-02-01 18:47:41 +00:00
|
|
|
else:
|
2011-05-07 23:56:12 +03:00
|
|
|
flist = "%s server.c os_io_posix.c log.c net_posix.c serial_posix.c deskutils.c rfs_transports.c" % mainname
|
2011-01-16 00:23:19 +00:00
|
|
|
exeprefix = ""
|
2010-02-01 18:47:41 +00:00
|
|
|
|
|
|
|
if sim == '0':
|
2011-01-16 00:23:19 +00:00
|
|
|
output = 'rfs_server%s' % exeprefix
|
2010-02-01 18:47:41 +00:00
|
|
|
else:
|
2011-01-16 00:23:19 +00:00
|
|
|
output = 'rfs_sim_server%s' % exeprefix
|
2010-02-01 18:47:41 +00:00
|
|
|
#endif
|
|
|
|
|
2011-01-16 00:23:19 +00:00
|
|
|
full_files = " " + " ".join( [ "rfs_server_src/%s" % name for name in flist.split() ] )
|
|
|
|
full_files = full_files + " src/remotefs/remotefs.c src/eluarpc.c"
|
|
|
|
local_include = "-Irfs_server_src -Iinc/remotefs -Iinc"
|
2010-02-01 18:47:41 +00:00
|
|
|
|
|
|
|
# Compiler/linker options
|
2010-02-01 23:25:02 +00:00
|
|
|
cccom = "gcc -m32 -O0 -g %s -Wall %s -c $SOURCE -o $TARGET" % ( local_include, cdefs )
|
2011-01-16 00:23:19 +00:00
|
|
|
linkcom = "gcc -m32 -o $TARGET $SOURCES %s" % socklib
|
2010-02-01 18:47:41 +00:00
|
|
|
|
|
|
|
# Env for building the program
|
|
|
|
comp = Environment( CCCOM = cccom,
|
|
|
|
LINKCOM = linkcom,
|
|
|
|
ENV = os.environ )
|
|
|
|
Decider( 'MD5' )
|
|
|
|
Default( comp.Program( output, Split( full_files ) ) )
|
|
|
|
|