Add gdb init script variable for wizard.
[bertos.git] / wizard / bertos_utils.py
index d22fa7cf786985e37cdb98477420e374bcc88648..8ad1568b1d9280b1ce60cc844176eb31f1370eca 100644 (file)
@@ -183,10 +183,15 @@ def createBertosProject(project_info, edit=False):
         f = open(cfgdir + "/" + os.path.basename(configuration), "w")
         f.write(string)
         f.close()
-    # Destinatio mk file
-    makefile = open("mktemplates/template.mk", "r").read()
+    if not edit:
+        # Destination user mk file (only on project creation)
+        makefile = open("mktemplates/template.mk", "r").read()
+        makefile = mkGenerator(project_info, makefile)
+        open(prjdir + "/" + os.path.basename(prjdir) + ".mk", "w").write(makefile)
+    # Destination wizard mk file
+    makefile = open("mktemplates/template_wiz.mk", "r").read()
     makefile = mkGenerator(project_info, makefile)
-    open(prjdir + "/" + os.path.basename(prjdir) + ".mk", "w").write(makefile)
+    open(prjdir + "/" + os.path.basename(prjdir) + "_wiz.mk", "w").write(makefile)
     # Destination main.c file
     if not edit:
         main = open("srctemplates/main.c", "r").read()
@@ -224,6 +229,9 @@ def mkGenerator(project_info, makefile):
     mk_data["$prefix"] = replaceSeparators(project_info.info("TOOLCHAIN")["path"].split("gcc")[0])
     mk_data["$suffix"] = replaceSeparators(project_info.info("TOOLCHAIN")["path"].split("gcc")[1])
     mk_data["$main"] = os.path.basename(project_info.info("PROJECT_PATH")) + "/main.c"
+    mk_data["$programmercpu"] = project_info.info("CPU_INFOS")["PROGRAMMER_CPU"]
+    mk_data["$flashscript"] = project_info.info("CPU_INFOS")["FLASH_SCRIPT"]
+    mk_data["$debugscript"] = project_info.info("CPU_INFOS")["DEBUG_SCRIPT"]
     for key in mk_data:
         while makefile.find(key) != -1:
             makefile = makefile.replace(key, mk_data[key])
@@ -234,8 +242,8 @@ def makefileGenerator(project_info, makefile):
     Generate the Makefile for the current project.
     """
     # TODO write a general function that works for both the mk file and the Makefile
-    while makefile.find("project_name") != -1:
-        makefile = makefile.replace("project_name", os.path.basename(project_info.info("PROJECT_PATH")))
+    while makefile.find("$pname") != -1:
+        makefile = makefile.replace("$pname", os.path.basename(project_info.info("PROJECT_PATH")))
     return makefile
 
 def csrcGenerator(project_info):