mirror of
https://git.rtems.org/rtems-libbsd/
synced 2025-06-28 22:14:58 +08:00
Allow to set optimization level during configure.
This allows to set the optimization level for libbsd via a configure switch. Useful for building with for example no optimization during debug or with size optimization for space restricted targets.
This commit is contained in:
parent
a70edfc49a
commit
d18c6435c4
@ -156,8 +156,7 @@ class diffRecord:
|
||||
# This stuff needs to move to libbsd.py.
|
||||
#
|
||||
def commonFlags():
|
||||
return ['-O2',
|
||||
'-g',
|
||||
return ['-g',
|
||||
'-fno-strict-aliasing',
|
||||
'-ffreestanding',
|
||||
'-fno-common']
|
||||
|
@ -34,7 +34,7 @@ def configure(conf):
|
||||
def build(bld):
|
||||
# C/C++ flags
|
||||
common_flags = []
|
||||
common_flags += ["-O2"]
|
||||
common_flags += ["-O" + bld.env.OPTIMIZATION]
|
||||
common_flags += ["-g"]
|
||||
common_flags += ["-fno-strict-aliasing"]
|
||||
common_flags += ["-ffreestanding"]
|
||||
|
@ -371,6 +371,7 @@ class ModuleManager(builder.ModuleManager):
|
||||
self.add('def build(bld):')
|
||||
self.add(' # C/C++ flags')
|
||||
self.add(' common_flags = []')
|
||||
self.add(' common_flags += ["-O%s" % (bld.env.OPTIMIZATION)]')
|
||||
for f in builder.commonFlags():
|
||||
self.add(' common_flags += ["%s"]' % (f))
|
||||
self.add(' if bld.env.WARNINGS:')
|
||||
|
6
wscript
6
wscript
@ -68,6 +68,11 @@ def options(opt):
|
||||
default = "",
|
||||
dest = "freebsd_options",
|
||||
help = "Set FreeBSD options (developer option).")
|
||||
opt.add_option("--optimization",
|
||||
action = "store",
|
||||
default = "2",
|
||||
dest = "optimization",
|
||||
help = "Set optimization level to OPTIMIZATION (-On compiler flag). Default is 2 (-O2).")
|
||||
libbsd_waf.options(opt)
|
||||
|
||||
def bsp_configure(conf, arch_bsp):
|
||||
@ -88,6 +93,7 @@ def configure(conf):
|
||||
conf.env.WARNINGS = conf.options.warnings
|
||||
conf.env.NET_CONFIG = conf.options.net_config
|
||||
conf.env.FREEBSD_OPTIONS =conf.options.freebsd_options
|
||||
conf.env.OPTIMIZATION = conf.options.optimization
|
||||
rtems.configure(conf, bsp_configure)
|
||||
libbsd_waf.configure(conf)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user