# -*- Mode: Python -*-
import sys, os
sys.path.append(os.path.abspath("../base/tools/"))


# Files are resolved by searching the repositories in the order they
# are declared. The first match wins. Order repositories from most to
# least specific!
Repository('../base')
Repository('../demo')
Repository('../vancouver')
Repository('../passive')
Repository('../misc')

# We pull the top-level SCons logic from the first repository that has
# a SConscript file in its root directory.
SConscript('SConscript')

# Installation flags

tftp_dir = ARGUMENTS.get('tftp', '/srv/tftp')
print("Installing into %s. Use scons tftp=/foo to change this." % tftp_dir) 
Install(tftp_dir + '/nul/', Glob('bin/apps/hypervisor'))
Install(tftp_dir + '/nul/', Glob('bin/apps/*.nul.gz'))
Install(tftp_dir + '/nul/', Glob('bin/apps/*.nul'))
Install(tftp_dir + '/tools/', Glob('bin/boot/*'))
Alias('install', tftp_dir)

Default('bin/apps')
Default('bin/boot')

cmd_env = Environment(ENV = os.environ)
AlwaysBuild(cmd_env.Command("qemu", ["bin/apps/hypervisor",
                                     "bin/apps/sigma0.nul",
                                     ],
                            """qemu -cpu coreduo -serial stdio -smp 4 -kernel ${SOURCES[0]} -append "spinner serial" -initrd "${SOURCES[1]} S0_DEFAULT hostvga:0+0 hostkeyb:0+0x60+1+12 hostserial " """))

AlwaysBuild(cmd_env.Command("test", ["wvtest/wvtestrun",
                                     "wvtest/runall",
                                     ],
                            """${SOURCES[0]} ${SOURCES[1]}"""))

# EOF
