Correct csrc
authorduplo <duplo@38d2e660-2303-0410-9eaa-f027e97ec537>
Thu, 19 Mar 2009 10:55:07 +0000 (10:55 +0000)
committerduplo <duplo@38d2e660-2303-0410-9eaa-f027e97ec537>
Thu, 19 Mar 2009 10:55:07 +0000 (10:55 +0000)
git-svn-id: https://src.develer.com/svnoss/bertos/trunk@2391 38d2e660-2303-0410-9eaa-f027e97ec537

wizard/bertos_utils.py
wizard/const.py
wizard/mktemplates/template.mk

index efc2631c7e3e971c0528dff58aafd1b183e094b6..7c3b687ae58934a43f539fe9325d456187d286f8 100644 (file)
@@ -80,12 +80,13 @@ def mkGenerator(projectInfo, makefile):
     """
     mkData = {}
     mkData["$pname"] = os.path.basename(projectInfo.info("PROJECT_PATH"))
-    mkData["$cpuname"] = projectInfo.info("CPU_INFOS")["CPU_NAME"]
+    mkData["$cpuname"] = projectInfo.info("CPU_INFOS")["CORE_CPU"]
     mkData["$cflags"] = " ".join(projectInfo.info("CPU_INFOS")["C_FLAGS"])
     mkData["$ldflags"] = " ".join(projectInfo.info("CPU_INFOS")["LD_FLAGS"])
-    mkData["$csrc"] = csrcGenerator(projectInfo)
-    mkData["$prefix"] = os.path.basename(projectInfo.info("TOOLCHAIN")["path"]).split("gcc")[0]
-    mkData["$suffix"] = os.path.basename(projectInfo.info("TOOLCHAIN")["path"]).split("gcc")[1]
+    mkData["$csrc"], mkData["$pcsrc"] = csrcGenerator(projectInfo)
+    mkData["$prefix"] = projectInfo.info("TOOLCHAIN")["path"].split("gcc")[0]
+    mkData["$suffix"] = projectInfo.info("TOOLCHAIN")["path"].split("gcc")[1]
+    mkData["$cross"] = projectInfo.info("TOOLCHAIN")["path"].split("gcc")[0]
     for key in mkData:
         while makefile.find(key) != -1:
             makefile = makefile.replace(key, mkData[key])
@@ -102,24 +103,45 @@ def makefileGenerator(projectInfo, makefile):
 
 def csrcGenerator(projectInfo):
     modules = projectInfo.info("MODULES")
-    files = []
+    if "harvard" in projectInfo.info("CPU_INFOS")["CPU_TAGS"]:
+        pcsrc_need = projectInfo.info("CPU_INFOS")["PC_SRC"]
+    else:
+        pcsrc_need = []
+    csrc = []
+    pcsrc = []
     for module, information in modules.items():
         if information["enabled"]:
             for filename, path in findDefinitions(module + ".c", projectInfo):
-                files.append(path + "/" + filename)
+                path = path.replace(projectInfo.info("SOURCES_PATH"), projectInfo.info("PROJECT_PATH"))
+                print path
+                csrc.append(path + "/" + filename)
+                if module in pcsrc_need:
+                    pcsrc.append(path + "/" + filename)
             for filename, path in findDefinitions(module + "_" + projectInfo.info("CPU_INFOS")["TOOLCHAIN"] + ".c", projectInfo):
-                files.append(path + "/" + filename)
+                path = path.replace(projectInfo.info("SOURCES_PATH"), projectInfo.info("PROJECT_PATH"))
+                print path
+                csrc.append(path + "/" + filename)
+                if module in pcsrc_need:
+                    pcsrc.append(path + "/" + filename)
             for tag in projectInfo.info("CPU_INFOS")["CPU_TAGS"]:
                 for filename, path in findDefinitions(module + "_" + tag + ".c", projectInfo):
-                    files.append(path + "/" + filename)
-    csrc = " \\\n\t".join(files) + " \\"
-    return csrc
+                    path = path.replace(projectInfo.info("SOURCES_PATH"), projectInfo.info("PROJECT_PATH"))
+                    print path
+                    csrc.append(path + "/" + filename)
+                    if module in pcsrc_need:
+                        pcsrc.append(path + "/" + filename)
+    csrc = " \\\n\t".join(csrc) + " \\"
+    pcsrc = " \\\n\t".join(pcsrc) + " \\"
+    return csrc, pcsrc
 
 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):
index 86115373713e24b62c9d2c42e5fd129430f13ac1..79d72ef83c4ad96b1708edd3996fd1f9215c44be 100644 (file)
@@ -45,4 +45,6 @@ EXTENSION_FILTER = (
     ".cxx",
     ".h",
     ".c++",
+    ".mk",
+    "Makefile",
 )
\ No newline at end of file
index 6dfe9b7f580b9a0de6b8a6ff1e071f739e11a484..dc2d3ea0b89e347bc3872f0aee10c4ecee31628e 100644 (file)
@@ -18,6 +18,8 @@ $pname_PREFIX = $prefix
 
 $pname_SUFFIX = $suffix
 
+$pname_CROSS = $cross
+
 $pname_MCU = $cpuname
 
 $pname_CSRC = \