#!python
import os

#
# variable definition
#
INCLUDES = []
CFG1_DEF_TABLES = []

os.chdir(os.path.dirname(project.Path))

ADDITIONAL_INCLUDES = []

# set relative path from top proj
proj_rel_dir = ""

# call definition file
execfile("./def.py")

# path
src_abs_path = os.path.abspath(SRCDIR)

# call common file
execfile(src_abs_path + "/arch/ccrx/common.py")

#
# Update asp.mtpj
#
inputstr = ReadFile('asp.mtpj')
inputstr = SetTargetFileRelativePath(inputstr, asp_files, SRCDIR)
inputstr = SetCcrxIncludes(inputstr, asp_rel_includes, INCLUDES, SRCDIR)
inputstr = SetPythonFileRelativePath(inputstr, asp_post_python_files, SRCDIR)
WriteFile('asp.mtpj', inputstr)

#
# Update ./cfg/cfg.mtpj
#
inputstr = ReadFile('./cfg/cfg.mtsp')
inputstr = SetTargetFileRelativePath(inputstr, asp_files, SRCDIR + "../")
inputstr = SetCcrxIncludes(inputstr, cfg_rel_includes, INCLUDES, SRCDIR + "../")
inputstr = SetPythonFileRelativePath(inputstr, cfg_pre_python_files, SRCDIR + "../")
inputstr = SetPythonFileRelativePath(inputstr, cfg_post_python_files, SRCDIR + "../")
WriteFile('./cfg/cfg.mtsp', inputstr)


#
# make ccrx include path for kernel
#
inputstr = ReadFile('./kernel/kernel.mtsp')
inputstr = SetTargetFileRelativePath(inputstr, kernel_files, SRCDIR + "../")
inputstr = SetCcrxIncludes(inputstr, kernel_rel_includes, INCLUDES, SRCDIR + "../")
WriteFile('./kernel/kernel.mtsp', inputstr)
