Import('env')

if GetOption("help"):
    # early exit here not to execute config checks
    Return()

env = env.Clone()

common_compiler_flags = [ "-Wall", "-std=c++11" ]
env.Append(
    LIBS=[ "string_util" ],
    CPPPATH=[ "./src" ],
    CFLAGS=common_compiler_flags,
    CXXFLAGS=common_compiler_flags,
)

sources = Glob("src/*.c*")

msg_defs_used = """
ln/resource_event
ln/log_service
lnrecorder/replay
lnrecorder/record
lnrecorder/record_waiting
lnrecorder/stop
"""
env.ln_generate("src/ln_messages.h", msg_defs_used, "./message_definitions", sources)

SConscript("lnrdb/SConscript", exports=dict(env=env))

lnrecorder = env.Program("lnrecorder", source=sources)

#import pdb; pdb.set_trace()
env.InstallProgram("$PREFIX/bin", lnrecorder)
env.install_mds(Dir("message_definitions"), excludes=("lnrecorder_test/*", ))
