[tools] Using object name to decide whether use alias name in Keil MDK.

This commit is contained in:
Bernard Xiong 2015-04-24 11:43:38 +08:00
parent 6459839f28
commit b6951f64b8
1 changed files with 24 additions and 4 deletions

View File

@ -66,9 +66,19 @@ def MDK4AddGroupForFN(ProjectFiles, parent, name, filename, project_path):
file = SubElement(files, 'File')
file_name = SubElement(file, 'FileName')
name = os.path.basename(path)
if ProjectFiles.count(name):
if name.find('.cpp') != -1:
obj_name = name.replace('.cpp', '.o')
elif name.find('.c') != -1:
obj_name = name.replace('.c', '.o')
elif name.find('.s') != -1:
obj_name = name.replace('.s', '.o')
elif name.find('.S') != -1:
obj_name = name.replace('.s', '.o')
if ProjectFiles.count(obj_name):
name = basename + '_' + name
ProjectFiles.append(name)
ProjectFiles.append(obj_name)
file_name.text = name.decode(fs_encoding)
file_type = SubElement(file, 'FileType')
file_type.text = '%d' % _get_filetype(name)
@ -98,9 +108,19 @@ def MDK4AddGroup(ProjectFiles, parent, name, files, project_path):
file = SubElement(files, 'File')
file_name = SubElement(file, 'FileName')
name = os.path.basename(path)
if ProjectFiles.count(name):
if name.find('.cpp') != -1:
obj_name = name.replace('.cpp', '.o')
elif name.find('.c') != -1:
obj_name = name.replace('.c', '.o')
elif name.find('.s') != -1:
obj_name = name.replace('.s', '.o')
elif name.find('.S') != -1:
obj_name = name.replace('.s', '.o')
if ProjectFiles.count(obj_name):
name = basename + '_' + name
ProjectFiles.append(name)
ProjectFiles.append(obj_name)
file_name.text = name.decode(fs_encoding)
file_type = SubElement(file, 'FileType')
file_type.text = '%d' % _get_filetype(name)