From 52bd09d8baea7f32a13e18df724f005aa01ab2f8 Mon Sep 17 00:00:00 2001 From: duplo Date: Tue, 24 Mar 2009 11:33:41 +0000 Subject: [PATCH] Search for modules also in .c and .s files git-svn-id: https://src.develer.com/svnoss/bertos/trunk@2409 38d2e660-2303-0410-9eaa-f027e97ec537 --- wizard/bertos_utils.py | 41 ++++++++++++++++++----------------------- 1 file changed, 18 insertions(+), 23 deletions(-) diff --git a/wizard/bertos_utils.py b/wizard/bertos_utils.py index b478dc5c..68483edc 100644 --- a/wizard/bertos_utils.py +++ b/wizard/bertos_utils.py @@ -114,11 +114,15 @@ def csrcGenerator(projectInfo): harvard = True else: harvard = False + ## file to be included in CSRC variable csrc = [] + ## file to be included in PCSRC variable pcsrc = [] + ## constants to be included at the beginning of the makefile constants = {} moduleFiles = set([]) dependencyFiles = set([]) + ## assembly sources asmFiles = set([]) for module, information in modules.items(): if information["enabled"]: @@ -142,40 +146,31 @@ def csrcGenerator(projectInfo): csrc = " \\\n\t".join(csrc) + " \\" pcsrc = " \\\n\t".join(pcsrc) + " \\" constants = "\n".join([os.path.basename(projectInfo.info("PROJECT_PATH")) + "_" + key + " = " + str(value) for key, value in constants.items()]) - print asmFiles return csrc, pcsrc, constants def findModuleFiles(module, projectInfo): + ## Find the files related to the selected module cfiles = [] sfiles = [] - for filename, path in findDefinitions(module + ".c", projectInfo): + ## .c files related to the module and the cpu architecture + for filename, path in findDefinitions(module + ".c", projectInfo) + \ + findDefinitions(module + "_" + projectInfo.info("CPU_INFOS")["TOOLCHAIN"] + ".c", projectInfo): path = path.replace(projectInfo.info("SOURCES_PATH") + "/", "") cfiles.append(path + "/" + filename) - for filename, path in findDefinitions(module + "_" + projectInfo.info("CPU_INFOS")["TOOLCHAIN"] + ".c", projectInfo): + ## .s files related to the module and the cpu architecture + for filename, path in findDefinitions(module + ".s", projectInfo) + \ + findDefinitions(module + "_" + projectInfo.info("CPU_INFOS")["TOOLCHAIN"] + ".s", projectInfo) + \ + findDefinitions(module + ".S", projectInfo) + \ + findDefinitions(module + "_" + projectInfo.info("CPU_INFOS")["TOOLCHAIN"] + ".S", projectInfo): path = path.replace(projectInfo.info("SOURCES_PATH") + "/", "") - cfiles.append(path + "/" + filename) + sfiles.append(path + "/" + filename) + ## .c and .s files related to the module and the cpu tags for tag in projectInfo.info("CPU_INFOS")["CPU_TAGS"]: for filename, path in findDefinitions(module + "_" + tag + ".c", projectInfo): path = path.replace(projectInfo.info("SOURCES_PATH") + "/", "") cfiles.append(path + "/" + filename) - for filename, path in findDefinitions(module + ".s", projectInfo): - path = path.replace(projectInfo.info("SOURCES_PATH") + "/", "") - sfiles.append(path + "/" + filename) - for filename, path in findDefinitions(module + "_" + projectInfo.info("CPU_INFOS")["TOOLCHAIN"] + ".s", projectInfo): - path = path.replace(projectInfo.info("SOURCES_PATH") + "/", "") - sfiles.append(path + "/" + filename) - for tag in projectInfo.info("CPU_INFOS")["CPU_TAGS"]: - for filename, path in findDefinitions(module + "_" + tag + ".s", projectInfo): - path = path.replace(projectInfo.info("SOURCES_PATH") + "/", "") - sfiles.append(path + "/" + filename) - for filename, path in findDefinitions(module + ".S", projectInfo): - path = path.replace(projectInfo.info("SOURCES_PATH") + "/", "") - sfiles.append(path + "/" + filename) - for filename, path in findDefinitions(module + "_" + projectInfo.info("CPU_INFOS")["TOOLCHAIN"] + ".S", projectInfo): - path = path.replace(projectInfo.info("SOURCES_PATH") + "/", "") - sfiles.append(path + "/" + filename) - for tag in projectInfo.info("CPU_INFOS")["CPU_TAGS"]: - for filename, path in findDefinitions(module + "_" + tag + ".S", projectInfo): + for filename, path in findDefinitions(module + "_" + tag + ".s", projectInfo) + \ + findDefinitions(module + "_" + tag + ".S", projectInfo): path = path.replace(projectInfo.info("SOURCES_PATH") + "/", "") sfiles.append(path + "/" + filename) return cfiles, sfiles @@ -378,7 +373,7 @@ def loadModuleData(project): listInfoDict = {} configurationInfoDict = {} fileDict = {} - for filename, path in findDefinitions("*.h", project): + for filename, path in findDefinitions("*.h", project) + findDefinitions("*.c", project) + findDefinitions("*.s", project) + findDefinitions("*.S", project): commentList = getCommentList(open(path + "/" + filename, "r").read()) if len(commentList) > 0: moduleInfo = {} -- 2.25.1