- constants = "\n".join([os.path.basename(projectInfo.info("PROJECT_PATH")) + "_" + key + " = " + str(value) for key, value in constants.items()])
- return csrc, pcsrc, constants
-
-def codeliteProjectGenerator(projectInfo):
- template = open("cltemplates/bertos.project").read()
- filelist = "\n".join(codelite_project.clFiles(codelite_project.findSources(projectInfo.info("PROJECT_PATH")), projectInfo.info("PROJECT_PATH")))
- while template.find("$filelist") != -1:
- template = template.replace("$filelist", filelist)
- projectName = os.path.basename(projectInfo.info("PROJECT_PATH"))
- while template.find("$project") != -1:
- template = template.replace("$project", projectName)
- return template
-
-def codeliteWorkspaceGenerator(projectInfo):
- template = open("cltemplates/bertos.workspace").read()
- projectName = os.path.basename(projectInfo.info("PROJECT_PATH"))
- while template.find("$project") != -1:
- template = template.replace("$project", projectName)
- return template
-
+ cppasrc = " \\\n\t".join(cppasrc) + " \\"
+ cxxsrc = " \\\n\t".join(cxxsrc) + " \\"
+ asrc = " \\\n\t".join(asrc) + " \\"
+ constants = "\n".join([os.path.basename(project_info.info("PROJECT_PATH")) + "_" + key + " = " + str(value) for key, value in constants.items()])
+ return csrc, pcsrc, cppasrc, cxxsrc, asrc, constants
+
+def findModuleFiles(module, project_info):
+ # Find the files related to the selected module
+ cfiles = []
+ sfiles = []
+ # .c files related to the module and the cpu architecture
+ for filename, path in findDefinitions(module + ".c", project_info) + \
+ findDefinitions(module + "_" + project_info.info("CPU_INFOS")["TOOLCHAIN"] + ".c", project_info):
+ path = path.replace(project_info.info("SOURCES_PATH") + os.sep, "")
+ path = replaceSeparators(path)
+ cfiles.append(path + "/" + filename)
+ # .s files related to the module and the cpu architecture
+ for filename, path in findDefinitions(module + ".s", project_info) + \
+ findDefinitions(module + "_" + project_info.info("CPU_INFOS")["TOOLCHAIN"] + ".s", project_info) + \
+ findDefinitions(module + ".S", project_info) + \
+ findDefinitions(module + "_" + project_info.info("CPU_INFOS")["TOOLCHAIN"] + ".S", project_info):
+ path = path.replace(project_info.info("SOURCES_PATH") + os.sep, "")
+ path = replaceSeparators(path)
+ sfiles.append(path + "/" + filename)
+ # .c and .s files related to the module and the cpu tags
+ for tag in project_info.info("CPU_INFOS")["CPU_TAGS"]:
+ for filename, path in findDefinitions(module + "_" + tag + ".c", project_info):
+ path = path.replace(project_info.info("SOURCES_PATH") + os.sep, "")
+ if os.sep != "/":
+ path = replaceSeparators(path)
+ cfiles.append(path + "/" + filename)
+ for filename, path in findDefinitions(module + "_" + tag + ".s", project_info) + \
+ findDefinitions(module + "_" + tag + ".S", project_info):
+ path = path.replace(project_info.info("SOURCES_PATH") + os.sep, "")
+ path = replaceSeparators(path)
+ sfiles.append(path + "/" + filename)
+ return cfiles, sfiles
+
+def replaceSeparators(path):
+ """
+ Replace the separators in the given path with unix standard separator.
+ """
+ if os.sep != "/":
+ while path.find(os.sep) != -1:
+ path = path.replace(os.sep, "/")
+ return path
+