Add CPPASRC to the mk file
[bertos.git] / wizard / bertos_utils.py
index 933d9ed5175fec2bfe8fd5a12fac10a96a93533e..1c8caaa74adde5ffb9d37c3f8dda7f1ca648b005 100644 (file)
@@ -52,9 +52,10 @@ def createBertosProject(project_info):
     cfgdir = prjdir + "/cfg"
     shutil.rmtree(cfgdir, True)
     os.mkdir(cfgdir)
-    for key, value in project_info.info("CONFIGURATIONS").items():
-        string = open(sources_dir + "/" + key, "r").read()
-        for parameter, infos in value.items():
+    for configuration, information in project_info.info("CONFIGURATIONS").items():
+        string = open(sources_dir + "/" + configuration, "r").read()
+        for start, parameter in information["paramlist"]:
+            infos = information[parameter]
             value = infos["value"]
             if "type" in infos["informations"] and infos["informations"]["type"] == "autoenabled":
                 value = "1"
@@ -63,7 +64,7 @@ def createBertosProject(project_info):
             if "long" in infos["informations"].keys() and infos["informations"]["long"]:
                 value += "L"
             string = sub(string, parameter, value)
-        f = open(cfgdir + "/" + os.path.basename(key), "w")
+        f = open(cfgdir + "/" + os.path.basename(configuration), "w")
         f.write(string)
         f.close()
     ## Destinatio mk file
@@ -88,7 +89,7 @@ def mkGenerator(project_info, makefile):
     mk_data["$cpuname"] = project_info.info("CPU_INFOS")["CORE_CPU"]
     mk_data["$cflags"] = " ".join(project_info.info("CPU_INFOS")["C_FLAGS"])
     mk_data["$ldflags"] = " ".join(project_info.info("CPU_INFOS")["LD_FLAGS"])
-    mk_data["$csrc"], mk_data["$pcsrc"], mk_data["$constants"] = csrcGenerator(project_info)
+    mk_data["$csrc"], mk_data["$pcsrc"], mk_data["$asrc"], mk_data["$constants"] = csrcGenerator(project_info)
     mk_data["$prefix"] = project_info.info("TOOLCHAIN")["path"].split("gcc")[0]
     mk_data["$suffix"] = project_info.info("TOOLCHAIN")["path"].split("gcc")[1]
     mk_data["$cross"] = project_info.info("TOOLCHAIN")["path"].split("gcc")[0]
@@ -118,13 +119,15 @@ def csrcGenerator(project_info):
     csrc = []
     ## file to be included in PCSRC variable
     pcsrc = []
+    ## files to be included in CPPASRC variable
+    asrc = []
     ## constants to be included at the beginning of the makefile
     constants = {}
-    module_files = set([])
-    dependency_files = set([])
-    ## assembly sources
-    asm_files = set([])
     for module, information in modules.items():
+        module_files = set([])
+        dependency_files = set([])
+        ## assembly sources
+        asm_files = set([])
         if information["enabled"]:
             if "constants" in information:
                 constants.update(information["constants"])
@@ -143,10 +146,13 @@ def csrcGenerator(project_info):
                     pcsrc.append(file)
             for file in dependency_files:
                 csrc.append(file)
+            for file in asm_files:
+                asrc.append(file)
     csrc = " \\\n\t".join(csrc) + " \\"
     pcsrc = " \\\n\t".join(pcsrc) + " \\"
+    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, constants
+    return csrc, pcsrc, asrc, constants
     
 def findModuleFiles(module, project_info):
     ## Find the files related to the selected module
@@ -442,9 +448,11 @@ def loadConfigurationInfos(path):
             "value_list": the name of the enum for enum parameters
     """
     configuration_infos = {}
+    configuration_infos["paramlist"] = []
     for comment, define, start in getDefinitionBlocks(open(path, "r").read()):
         name, value = formatParamNameValue(define)
         brief, description, informations = getDescriptionInformations(comment)
+        configuration_infos["paramlist"].append((start, name))
         configuration_infos[name] = {}
         configuration_infos[name]["value"] = value
         configuration_infos[name]["informations"] = informations