2013-04-18 01:46:47 +02:00
|
|
|
#!/usr/bin/python
|
2013-04-18 22:09:45 +02:00
|
|
|
import debug
|
|
|
|
import datetime
|
|
|
|
import buildTools
|
|
|
|
import environement
|
2013-04-18 01:46:47 +02:00
|
|
|
|
2013-04-18 22:09:45 +02:00
|
|
|
class Target:
|
|
|
|
def __init__(self):
|
|
|
|
self.name='Linux'
|
|
|
|
debug.info("create board target : "+self.name);
|
2013-04-19 22:06:05 +02:00
|
|
|
if "clang"==environement.GetClangMode():
|
2013-04-18 22:09:45 +02:00
|
|
|
self.cc='clang'
|
|
|
|
self.xx='clang++'
|
|
|
|
else:
|
|
|
|
self.cc='gcc'
|
|
|
|
self.xx='g++'
|
|
|
|
self.ar='ar'
|
|
|
|
self.ld='ld'
|
|
|
|
self.nm='nm'
|
|
|
|
self.strip='strip'
|
|
|
|
self.ranlib='ranlib'
|
|
|
|
self.dlltool='dlltool'
|
|
|
|
###############################################################################
|
|
|
|
# Target global variables.
|
|
|
|
###############################################################################
|
|
|
|
self.global_include_cc=''
|
|
|
|
self.global_flags_cc=['-D__TARGET_OS__Linux', "-DBUILD_TIME=\"\\\""+str(datetime.datetime.now())+"\\\"\""]
|
|
|
|
self.global_flags_xx=''
|
|
|
|
self.global_flags_mm=''
|
|
|
|
self.global_flags_m=''
|
|
|
|
self.global_flags_ar='rcs'
|
|
|
|
self.global_flags_ld=''
|
|
|
|
self.global_flags_ld_shared=''
|
|
|
|
self.global_libs_ld=''
|
|
|
|
self.global_libs_ld_shared=''
|
|
|
|
|
2013-04-19 22:06:05 +02:00
|
|
|
self.suffix_dependence='.d'
|
2013-04-18 22:09:45 +02:00
|
|
|
self.suffix_obj='.o'
|
|
|
|
self.suffix_lib_static='.a'
|
|
|
|
self.suffix_lib_dynamic='.so'
|
|
|
|
self.suffix_binary=''
|
|
|
|
self.suffix_package='.deb'
|
|
|
|
|
|
|
|
self.folder_arch="/" + self.name
|
|
|
|
|
|
|
|
if 1==environement.GetDebugMode():
|
|
|
|
self.buildMode = "debug"
|
|
|
|
else:
|
|
|
|
self.buildMode = "release"
|
|
|
|
self.folder_out="/out" + self.folder_arch + "/" + self.buildMode
|
|
|
|
self.folder_final="/final"
|
|
|
|
self.folder_staging="/staging"
|
|
|
|
self.folder_build="/build"
|
|
|
|
self.folder_bin="/usr/bin"
|
|
|
|
self.folder_lib="/usr/lib"
|
|
|
|
self.folder_data="/usr/share"
|
|
|
|
self.folder_doc="/usr/share/doc"
|
|
|
|
self.buildDone=[]
|
|
|
|
self.buildTreeDone=[]
|
|
|
|
|
|
|
|
"""
|
|
|
|
return a list of 3 elements :
|
|
|
|
0 : sources files (can be a list)
|
|
|
|
1 : destination file
|
|
|
|
2 : dependence files module (*.d)
|
|
|
|
"""
|
2013-04-19 22:06:05 +02:00
|
|
|
def GenerateFile(self,binaryName,moduleName,basePath,file,type):
|
2013-04-18 22:09:45 +02:00
|
|
|
list=[]
|
|
|
|
if (type=="bin"):
|
|
|
|
list.append(file)
|
2013-04-19 22:06:05 +02:00
|
|
|
list.append(self.GetStagingFolder(binaryName) + self.folder_bin + "/" + moduleName + self.suffix_binary)
|
|
|
|
list.append(self.GetBuildFolder(moduleName) + moduleName + self.suffix_dependence)
|
2013-04-18 22:09:45 +02:00
|
|
|
elif (type=="obj"):
|
|
|
|
list.append(basePath + "/" + file)
|
2013-04-19 22:06:05 +02:00
|
|
|
list.append(self.GetBuildFolder(moduleName) + file + self.suffix_obj)
|
|
|
|
list.append(self.GetBuildFolder(moduleName) + file + self.suffix_dependence)
|
2013-04-18 22:09:45 +02:00
|
|
|
elif (type=="lib-shared"):
|
|
|
|
list.append(file)
|
2013-04-19 22:06:05 +02:00
|
|
|
list.append(self.GetStagingFolder(binaryName) + self.folder_lib + "/" + moduleName + self.suffix_lib_dynamic)
|
|
|
|
list.append(self.GetBuildFolder(moduleName) + moduleName + self.suffix_dependence)
|
2013-04-18 22:09:45 +02:00
|
|
|
elif (type=="lib-static"):
|
|
|
|
list.append(file)
|
2013-04-19 22:06:05 +02:00
|
|
|
list.append(self.GetBuildFolder(moduleName) + moduleName + self.suffix_lib_static)
|
|
|
|
list.append(self.GetBuildFolder(moduleName) + moduleName + self.suffix_dependence)
|
2013-04-18 22:09:45 +02:00
|
|
|
else:
|
|
|
|
debug.error("unknow type : " + type)
|
|
|
|
return list
|
|
|
|
|
2013-04-19 22:06:05 +02:00
|
|
|
def GetStagingFolder(self, binaryName):
|
|
|
|
return buildTools.GetRunFolder() + self.folder_out + self.folder_staging + "/" + binaryName + "/"
|
|
|
|
|
|
|
|
def GetStagingFolderData(self, binaryName):
|
|
|
|
return self.GetStagingFolder(binaryName) + self.folder_data + "/"
|
|
|
|
|
|
|
|
def GetBuildFolder(self, moduleName):
|
|
|
|
return buildTools.GetRunFolder() + self.folder_out + self.folder_build + "/" + moduleName + "/"
|
2013-04-18 22:09:45 +02:00
|
|
|
|
|
|
|
def IsModuleBuild(self,module):
|
|
|
|
for mod in self.buildDone:
|
|
|
|
if mod == module:
|
|
|
|
return True
|
|
|
|
self.buildDone.append(module)
|
|
|
|
return False
|
|
|
|
|
|
|
|
def IsModuleBuildTree(self,module):
|
|
|
|
for mod in self.buildTreeDone:
|
|
|
|
if mod == module:
|
|
|
|
return True
|
|
|
|
self.buildTreeDone.append(module)
|
|
|
|
return False
|
|
|
|
|
|
|
|
|
2013-04-18 01:46:47 +02:00
|
|
|
|
|
|
|
"""
|
|
|
|
TARGET_GLOBAL_LDFLAGS = "-L$(TARGET_OUT_STAGING)/lib
|
|
|
|
TARGET_GLOBAL_LDFLAGS += -L$(TARGET_OUT_STAGING)/usr/lib
|
|
|
|
TARGET_GLOBAL_LDFLAGS_SHARED += -L$(TARGET_OUT_STAGING)/lib
|
|
|
|
TARGET_GLOBAL_LDFLAGS_SHARED += -L$(TARGET_OUT_STAGING)/usr/lib
|
|
|
|
"""
|