# Copyright AllSeen Alliance. All rights reserved.
#
#    Permission to use, copy, modify, and/or distribute this software for any
#    purpose with or without fee is hereby granted, provided that the above
#    copyright notice and this permission notice appear in all copies.
#
#    THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
#    WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
#    MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
#    ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
#    WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
#    ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
#    OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

Import('config_env')

if not config_env.has_key('_ALLJOYNCORE_'):
    config_env.Append(LIBS = ['alljoyn'])
    if config_env['BR'] == 'on' :
        config_env['ajrlib'] = 'ajrouter'
    if config_env['OS'] == 'openwrt':
        config_env.AppendUnique(LIBS = [ 'stdc++', 'pthread' ])

# Make config dist a sub-directory of the alljoyn dist.  This avoids any conflicts with alljoyn dist targets.
config_env['CONFIG_DISTDIR'] = config_env['DISTDIR'] + '/config'

config_env.Install('$CONFIG_DISTDIR/inc/alljoyn/config', config_env.Glob('inc/alljoyn/config/*.h'))

# Libraries
config_env.Install('$CONFIG_DISTDIR/lib', config_env.SConscript('src/SConscript', exports = ['config_env']))

# Sample programs
if config_env['BUILD_SERVICES_SAMPLES'] == 'on':
    config_env.Install('$CONFIG_DISTDIR/bin', config_env.SConscript('samples/SConscript', exports = ['config_env']))

# Build docs
installDocs = config_env.SConscript('docs/SConscript', exports = ['config_env'])
config_env.Depends(installDocs, config_env.Glob('$CONFIG_DISTDIR/inc/alljoyn/config/*.h'));
