aboutsummaryrefslogtreecommitdiffstats
path: root/configure.py
diff options
context:
space:
mode:
authorlloyd <[email protected]>2009-07-01 20:40:28 +0000
committerlloyd <[email protected]>2009-07-01 20:40:28 +0000
commit3099bb7ca65d111c40b08527e3671f29cb333618 (patch)
tree5f5af85264165d0250e3bc4acaa6894d79243f9d /configure.py
parent57e1d755db98d5d22b1d69be76accab478c5623e (diff)
Further template handling goop
Diffstat (limited to 'configure.py')
-rwxr-xr-xconfigure.py25
1 files changed, 22 insertions, 3 deletions
diff --git a/configure.py b/configure.py
index a76ebeb81..307827559 100755
--- a/configure.py
+++ b/configure.py
@@ -20,6 +20,10 @@ def process_command_line(args):
parser.add_option("--cpu", dest="cpu",
help="set the target processor type/model")
+ parser.add_option("--with-build-dir", dest="build-dir",
+ metavar="DIR", default="build",
+ help="setup the build in DIR [default %default]")
+
parser.add_option("--prefix", dest="prefix",
help="set the base installation directory")
@@ -232,21 +236,34 @@ def guess_processor(archinfo):
def process_makefile_template(template, options):
class MakefileTemplate(Template):
+ delimiter = '@'
+
pattern = r"""
@(?:
(?P<escaped>@) |
- (var:(?P<named>[_a-z]+)) |
- {(var:(?P<braced>[_a-z]+))} |
+ (var:(?P<named>[_\-a-z]+)) |
+ {(var:(?P<braced>[_\-a-z]+))} |
(?P<invalid>)
)
"""
try:
makefile = MakefileTemplate(''.join(open(template).readlines()))
- print makefile.substitute(options.__dict__)
+ return makefile.safe_substitute(options.__dict__)
except KeyError, e:
raise Exception("Unbound variable %s in template %s" % (e, template))
+def add_compiler_info(options, ccinfo):
+ for cc in ccinfo:
+ if options.compiler != cc.basename:
+ continue
+
+ options.cc = cc.binary_name
+ options.lib_opt = cc.lib_opt_flags
+ options.check_opt = cc.check_opt_flags
+ #options.mach_opt = cc.mach_opt
+ options.lang_flags = cc.lang_flags
+ options.warn_flags = cc.warning_flags
def main(argv = None):
if argv is None:
@@ -286,6 +303,8 @@ def main(argv = None):
if options.compiler is None:
options.compiler = 'gcc'
+ add_compiler_info(options, ccinfo)
+
all_files = []
for module in modules: