SConstruct 1.0 KB
Newer Older
M
Ming, Bai 已提交
1 2 3 4 5 6 7
import os
import sys
import rtconfig

if os.getenv('RTT_ROOT'):
    RTT_ROOT = os.getenv('RTT_ROOT')
else:
G
guozhanxin 已提交
8
    RTT_ROOT = os.path.normpath(os.getcwd() + '/../../../..')
M
Ming, Bai 已提交
9 10 11 12 13 14

sys.path = sys.path + [os.path.join(RTT_ROOT, 'tools')]
from building import *

TARGET = 'rtthread.' + rtconfig.TARGET_EXT

E
Ernest 已提交
15
DefaultEnvironment(tools=[])
M
Ming, Bai 已提交
16 17
env = Environment(tools = ['mingw'],
	AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS,
L
liukangcc 已提交
18
	CC = rtconfig.CC, CFLAGS = rtconfig.CFLAGS,
M
Ming, Bai 已提交
19 20 21 22 23
	AR = rtconfig.AR, ARFLAGS = '-rc',
	LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS)
env.PrependENVPath('PATH', rtconfig.EXEC_PATH)

if rtconfig.PLATFORM == 'iar':
L
liukangcc 已提交
24
    env.Replace(CCCOM = ['$CC $CFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS -o $TARGET $SOURCES'])
25 26
    env.Replace(ARFLAGS = [''])
    env.Replace(LINKCOM = env["LINKCOM"] + ' --map project.map')
M
Ming, Bai 已提交
27 28 29 30 31 32 33 34 35

Export('RTT_ROOT')
Export('rtconfig')

# prepare building environment
objs = PrepareBuilding(env, RTT_ROOT)

objs = objs + SConscript('CMSIS/SConscript', variant_dir='build/bsp/CMSIS', duplicate=0)

wuyangyong's avatar
wuyangyong 已提交
36 37
# make a building
DoBuilding(TARGET, objs)