From: duplo Date: Mon, 2 Feb 2009 17:43:06 +0000 (+0000) Subject: Add the Makefile template in the mktemplates directory X-Git-Tag: 2.1.0~433 X-Git-Url: https://codewiz.org/gitweb?a=commitdiff_plain;h=24cb311b180d96e12fa70cb063b044a550780bc0;p=bertos.git Add the Makefile template in the mktemplates directory git-svn-id: https://src.develer.com/svnoss/bertos/trunk@2249 38d2e660-2303-0410-9eaa-f027e97ec537 --- diff --git a/wizard/bertos_utils.py b/wizard/bertos_utils.py index 6fbd254a..05fd3546 100644 --- a/wizard/bertos_utils.py +++ b/wizard/bertos_utils.py @@ -39,7 +39,9 @@ def createBertosProject(projectInfos): makefile = directory + "/Makefile" if os.path.exists(makefile): os.remove(makefile) - shutil.copy(sourcesDir + "/Makefile", makefile) + makefile = open("mktemplates/Makefile").read() + makefile = makefileGenerator(makefile) + open(directory + "/Makefile", "w").write(makefile) ## Destination project dir prjdir = directory + "/" + os.path.basename(directory) shutil.rmtree(prjdir, True) @@ -61,7 +63,7 @@ def createBertosProject(projectInfos): ## Destinatio mk file makefile = open("mktemplates/template.mk", "r").read() makefile = mkGenerator(projectInfos, makefile) - open(prjdir + "/" + "template.mk", "w").write(makefile) + open(prjdir + "/" + "project.mk", "w").write(makefile) def mkGenerator(projectInfos, makefile): """ @@ -77,6 +79,15 @@ def mkGenerator(projectInfos, makefile): makefile = makefile.replace(key, mkData[key]) return makefile +def makefileGenerator(projectInfos, 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(projectInfos.info("PROJECT_PATH"))) + return makefile + def getSystemPath(): path = os.environ["PATH"] if os.name == "nt": diff --git a/wizard/mktemplates/Makefile b/wizard/mktemplates/Makefile new file mode 100644 index 00000000..46f049f1 --- /dev/null +++ b/wizard/mktemplates/Makefile @@ -0,0 +1,17 @@ +# +# Copyright 2009 Develer S.r.l. (http://www.develer.com/) +# All rights reserved. +# +# Author: Lorenzo Berni +# + +# Set to 1 for verbose build output, 0 for terse output +V := 0 + +default: all + +include bertos/config.mk + +include project_name/project_name.mk + +include bertos/rules.mk