From e34dc0282b9cc8414207891d9882bcde8984b8a0 Mon Sep 17 00:00:00 2001 From: duplo Date: Wed, 26 Aug 2009 13:41:38 +0000 Subject: [PATCH] Split the mk file in two files: one for the user, the other, created by the wizard. git-svn-id: https://src.develer.com/svnoss/bertos/trunk@2784 38d2e660-2303-0410-9eaa-f027e97ec537 --- wizard/bertos_utils.py | 15 ++++++--- wizard/mktemplates/Makefile | 2 +- wizard/mktemplates/template.mk | 45 ++----------------------- wizard/mktemplates/template_wiz.mk | 54 ++++++++++++++++++++++++++++++ 4 files changed, 67 insertions(+), 49 deletions(-) create mode 100644 wizard/mktemplates/template_wiz.mk diff --git a/wizard/bertos_utils.py b/wizard/bertos_utils.py index d22fa7cf..71b07384 100644 --- a/wizard/bertos_utils.py +++ b/wizard/bertos_utils.py @@ -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() @@ -234,8 +239,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): diff --git a/wizard/mktemplates/Makefile b/wizard/mktemplates/Makefile index 46f049f1..d266fc9f 100644 --- a/wizard/mktemplates/Makefile +++ b/wizard/mktemplates/Makefile @@ -12,6 +12,6 @@ default: all include bertos/config.mk -include project_name/project_name.mk +include $pname/$pname.mk include bertos/rules.mk diff --git a/wizard/mktemplates/template.mk b/wizard/mktemplates/template.mk index 9d7dabce..fc81e51c 100644 --- a/wizard/mktemplates/template.mk +++ b/wizard/mktemplates/template.mk @@ -8,22 +8,8 @@ # # -# Constants automatically defined by the selected modules -$constants - -# Our target application -TRG += $pname - -$pname_PREFIX = "$prefix" - -$pname_SUFFIX = "$suffix" - -$pname_$cpuflag = $cpuname - -# Files automatically generated by the wizard. DO NOT EDIT, USE $pname_USER_CSRC INSTEAD! -$pname_WIZARD_CSRC = \ - $csrc - # +# Include the mk file generated by the wizard +include $pname/$pname_wiz.mk # Files included by the user. $pname_USER_CSRC = \ @@ -33,11 +19,6 @@ $pname_USER_CSRC = \ # Automatically generated by the wizard. PLEASE DO NOT EDIT! $pname_CSRC = $($pname_WIZARD_CSRC) $($pname_USER_CSRC) -# Files automatically generated by the wizard. DO NOT EDIT, USE $pname_USER_PCSRC INSTEAD! -$pname_WIZARD_PCSRC = \ - $pcsrc - # - # Files included by the user. $pname_USER_PCSRC = \ # @@ -45,11 +26,6 @@ $pname_USER_PCSRC = \ # Automatically generated by the wizard. PLEASE DO NOT EDIT! $pname_PCSRC = $($pname_WIZARD_PCSRC) $($pname_USER_PCSRC) -# Files automatically generated by the wizard. DO NOT EDIT, USE $pname_USER_CPPASRC INSTEAD! -$pname_WIZARD_CPPASRC = \ - $cppasrc - # - # Files included by the user. $pname_USER_CPPASRC = \ # @@ -57,11 +33,6 @@ $pname_USER_CPPASRC = \ # Automatically generated by the wizard. PLEASE DO NOT EDIT! $pname_CPPASRC = $($pname_WIZARD_CPPASRC) $($pname_USER_CPPASRC) -# Files automatically generated by the wizard. DO NOT EDIT, USE $pname_USER_CXXSRC INSTEAD! -$pname_WIZARD_CXXSRC = \ - $cxxsrc - # - # Files included by the user. $pname_USER_CXXSRC = \ # @@ -69,11 +40,6 @@ $pname_USER_CXXSRC = \ # Automatically generated by the wizard. PLEASE DO NOT EDIT! $pname_CXXSRC = $($pname_WIZARD_CXXSRC) $($pname_USER_CXXSRC) -# Files automatically generated by the wizard. DO NOT EDIT, USE $pname_USER_ASRC INSTEAD! -$pname_WIZARD_ASRC = \ - $asrc - # - # Files included by the user. $pname_USER_ASRC = \ # @@ -81,10 +47,3 @@ $pname_USER_ASRC = \ # Automatically generated by the wizard. PLEASE DO NOT EDIT! $pname_ASRC = $($pname_WIZARD_ASRC) $($pname_USER_ASRC) -$pname_CFLAGS = $cflags -$pname_LDFLAGS = $ldflags -$pname_CPPFLAGS = -D'CPU_FREQ=($cpuclockfreqUL)' -D'ARCH=(ARCH_DEFAULT)' -D'WIZ_AUTOGEN' -I$pname/ $cppflags -$pname_CPPAFLAGS = $cppaflags -$pname_CXXFLAGS = $cxxflags -$pname_ASFLAGS = $asflags -$pname_ARFLAGS = $arflags diff --git a/wizard/mktemplates/template_wiz.mk b/wizard/mktemplates/template_wiz.mk new file mode 100644 index 00000000..eeca4c9f --- /dev/null +++ b/wizard/mktemplates/template_wiz.mk @@ -0,0 +1,54 @@ +# +# Copyright 2009 Develer S.r.l. (http://www.develer.com/) +# All rights reserved. +# +# Makefile template for BeRTOS wizard. +# +# Author: Lorenzo Berni +# +# + +# Constants automatically defined by the selected modules +$constants + +# Our target application +TRG += $pname + +$pname_PREFIX = "$prefix" + +$pname_SUFFIX = "$suffix" + +$pname_$cpuflag = $cpuname + +# Files automatically generated by the wizard. DO NOT EDIT, USE $pname_USER_CSRC INSTEAD! +$pname_WIZARD_CSRC = \ + $csrc + # + +# Files automatically generated by the wizard. DO NOT EDIT, USE $pname_USER_PCSRC INSTEAD! +$pname_WIZARD_PCSRC = \ + $pcsrc + # + +# Files automatically generated by the wizard. DO NOT EDIT, USE $pname_USER_CPPASRC INSTEAD! +$pname_WIZARD_CPPASRC = \ + $cppasrc + # + +# Files automatically generated by the wizard. DO NOT EDIT, USE $pname_USER_CXXSRC INSTEAD! +$pname_WIZARD_CXXSRC = \ + $cxxsrc + # + +# Files automatically generated by the wizard. DO NOT EDIT, USE $pname_USER_ASRC INSTEAD! +$pname_WIZARD_ASRC = \ + $asrc + # + +$pname_CFLAGS = $cflags +$pname_LDFLAGS = $ldflags +$pname_CPPFLAGS = -D'CPU_FREQ=($cpuclockfreqUL)' -D'ARCH=(ARCH_DEFAULT)' -D'WIZ_AUTOGEN' -I$pname/ $cppflags +$pname_CPPAFLAGS = $cppaflags +$pname_CXXFLAGS = $cxxflags +$pname_ASFLAGS = $asflags +$pname_ARFLAGS = $arflags -- 2.25.1