Add constants at the beginning of the mk file
authorduplo <duplo@38d2e660-2303-0410-9eaa-f027e97ec537>
Fri, 20 Mar 2009 15:50:32 +0000 (15:50 +0000)
committerduplo <duplo@38d2e660-2303-0410-9eaa-f027e97ec537>
Fri, 20 Mar 2009 15:50:32 +0000 (15:50 +0000)
git-svn-id: https://src.develer.com/svnoss/bertos/trunk@2399 38d2e660-2303-0410-9eaa-f027e97ec537

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

index 6d4e107117f96f5aa2814d5d79f44ada94a3ac4a..e522bdf9cbe49e26e6f5be95e7d6656177e33139 100644 (file)
@@ -86,7 +86,7 @@ def mkGenerator(projectInfo, makefile):
     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"], mkData["$pcsrc"] = csrcGenerator(projectInfo)
+    mkData["$csrc"], mkData["$pcsrc"], mkData["$constants"] = 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]
@@ -113,8 +113,11 @@ def csrcGenerator(projectInfo):
         pcsrc_need = []
     csrc = []
     pcsrc = []
+    constants = {}
     for module, information in modules.items():
         if information["enabled"]:
+            if "constants" in information:
+                constants.update(information["constants"])
             for filename, path in findDefinitions(module + ".c", projectInfo):
                 path = path.replace(projectInfo.info("SOURCES_PATH"), projectInfo.info("PROJECT_PATH"))
                 csrc.append(path + "/" + filename)
@@ -133,7 +136,8 @@ def csrcGenerator(projectInfo):
                         pcsrc.append(path + "/" + filename)
     csrc = " \\\n\t".join(csrc) + " \\"
     pcsrc = " \\\n\t".join(pcsrc) + " \\"
-    return csrc, pcsrc
+    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()
@@ -262,7 +266,7 @@ def loadModuleDefinition(first_comment):
         if "module_description" in moduleDefinition.keys():
             moduleDict[moduleName]["description"] = moduleDefinition["module_description"]
             del moduleDefinition["module_description"]
-        moduleDict[moduleName]["consts"] = moduleDefinition
+        moduleDict[moduleName]["constants"] = moduleDefinition
         moduleDict[moduleName]["enabled"] = False
     return toBeParsed, moduleDict
 
index 863bc13a4bda48048a51b378d077ccd6ebef7676..acb72c0228648b2161e1d9429cc01a9021d1841e 100644 (file)
@@ -8,8 +8,8 @@
 #
 #
 
-# Set to 1 for debug builds
-$pname_DEBUG = 1
+# Constants automatically defined by the selected modules
+$constants
 
 # Our target application
 TRG += $pname