from building import *
import os

#add include path
if GetOption('target') == 'mdk5' or GetOption('target') == 'iar':

    #add include path
    include_path = ['src', 'inc','../OS_CONFIG']
    include_path=[os.path.realpath(i) for i in include_path]

    src = Glob('src/*.c')
    if os.path.isfile(os.path.normpath(os.getcwd()+'/../Inc')+'//ald_conf.h'):
        src.append(os.path.normpath(os.getcwd()+'/../Inc')+'//ald_conf.h')

    group = DefineGroup('USER', src, depend = [''], CPPPATH = include_path)

    #add doc path
    doc_path = ''
    txt=[]

    if os.path.isfile(os.path.normpath(os.getcwd()+'/../ReadMe.txt')):
        txt.append(os.path.normpath(os.getcwd()+'/../ReadMe.txt'))
        
    doc_group = DefineGroup('doc', txt, depend = [''], CPPPATH = doc_path)
    Return('group','doc_group')

else:
    include_path = ['src', 'inc','../OS_CONFIG']
    include_path=[os.path.realpath(i) for i in include_path]

    src = Glob('src/*.c')

    group = DefineGroup('USER', src, depend = [''], CPPPATH = include_path)


    Return('group')
