Use internal class variable for resolving templates in makefiles

This allows other exporters to inherit from make and change the name of
the exporter without breaking.
pull/3187/head
Jimmy Brisson 2016-11-02 15:42:30 -05:00
parent fe80efe1bb
commit c2470e9710
1 changed files with 6 additions and 3 deletions

View File

@ -88,12 +88,12 @@ class Makefile(Exporter):
ctx.update(self.flags)
for templatefile in \
['makefile/%s_%s.tmpl' % (self.NAME.lower(),
['makefile/%s_%s.tmpl' % (self.TEMPLATE,
self.target.lower())] + \
['makefile/%s_%s.tmpl' % (self.NAME.lower(),
['makefile/%s_%s.tmpl' % (self.TEMPLATE,
label.lower()) for label
in self.toolchain.target.extra_labels] +\
['makefile/%s.tmpl' % self.NAME.lower()]:
['makefile/%s.tmpl' % self.TEMPLATE]:
try:
self.gen_file(templatefile, ctx, 'Makefile')
break
@ -108,6 +108,7 @@ class GccArm(Makefile):
TARGETS = [target for target, obj in TARGET_MAP.iteritems()
if "GCC_ARM" in obj.supported_toolchains]
NAME = 'Make-GCC-ARM'
TEMPLATE = 'make-gcc-arm'
TOOLCHAIN = "GCC_ARM"
LINK_SCRIPT_OPTION = "-T"
USER_LIBRARY_FLAG = "-L"
@ -122,6 +123,7 @@ class Armc5(Makefile):
TARGETS = [target for target, obj in TARGET_MAP.iteritems()
if "ARM" in obj.supported_toolchains]
NAME = 'Make-ARMc5'
TEMPLATE = 'make-armc5'
TOOLCHAIN = "ARM"
LINK_SCRIPT_OPTION = "--scatter"
USER_LIBRARY_FLAG = "--userlibpath "
@ -136,6 +138,7 @@ class IAR(Makefile):
TARGETS = [target for target, obj in TARGET_MAP.iteritems()
if "IAR" in obj.supported_toolchains]
NAME = 'Make-IAR'
TEMPLATE = 'make-iar'
TOOLCHAIN = "IAR"
LINK_SCRIPT_OPTION = "--config"
USER_LIBRARY_FLAG = "-L"