Import('env')
import os

def build_setup(target, source, env):
    open(str(target[0]), 'w').write( open(str(source[0]), 'r').read() )
    os.chmod(str(target[0]), 0755)
    return 0

targets = []
manfile = []
if 'swig' in env['TOOLS']:
    targets.append('mucous')
    manfile.append("mucous.1")
    man_install = env.Install(env['DESTDIR'] + env['MANDIR'], manfile)

    install = env.Install(env['DESTDIR'] + env['BINDIR'], targets)
    env.Alias('install_mucous', man_install)
    env.Alias('install_mucous', install)
    env.Alias('install', 'install_mucous')
    SConscript(os.path.join('pymucous', 'SConscript'))
    print "SWIG found, mucous will be installed"
else:
	print "WARNING: SWIG not found, mucous will NOT be installed"