#
# Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
#

import platform
if platform.system() == 'Darwin':
    Return()

Import('AgentEnv')
env = AgentEnv.Clone()

env.Append(LIBPATH = [
                      '../tables',
                      'ovsdb_client'
                     ])
env.Prepend(LIBS = [
                    'ovsdbclient',
                    'openvswitch',
                    'vnswinit'
                   ])

env.Append(LIBS = ['ssl', 'crypto'])

env.GenerateBuildInfoCode(
    target='buildinfo.cc',
    source = ['main.cc'],
    path=str(Dir('.').abspath))

env = AgentEnv.RemoveExceptionFlag(env)
env.AppendUnique(CCFLAGS='-Wno-reorder')
env.AppendUnique(CCFLAGS='-Wno-return-type')

# Add Contrail agent libraries
env.Prepend(LIBS = AgentEnv['CONTRAIL_LIBS'])

contrail_tor_agent = env.Program(target = 'contrail-tor-agent',
                        source = [
                                  'buildinfo.cc',
                                  'main.cc',
                                  'tor_agent_init.cc',
                                  'tor_agent_param.cc',
                                 ])

env.Default(contrail_tor_agent)
env.Alias('agent:contrail-tor-agent', contrail_tor_agent)
env.SConscript('ovsdb_client/SConscript', exports='AgentEnv', duplicate=0)

# Documentation
doc_files = []
doc_files += env['AGENT_COMMON_DOC_FILES']
doc_files += env['AGENT_OVS_DOC_FILES']

env.Alias('install', env.Install(env['INSTALL_BIN'], contrail_tor_agent))
env.Alias('install', env.Install(
    env['INSTALL_MESSAGE_DOC'] + '/contrail-tor-agent/', doc_files))

# Local Variables:
# mode: python
# End:
