mirror of
https://git.rtems.org/rtems-libbsd/
synced 2025-06-29 06:11:30 +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.
|
# This stuff needs to move to libbsd.py.
|
||||||
#
|
#
|
||||||
def commonFlags():
|
def commonFlags():
|
||||||
return ['-O2',
|
return ['-g',
|
||||||
'-g',
|
|
||||||
'-fno-strict-aliasing',
|
'-fno-strict-aliasing',
|
||||||
'-ffreestanding',
|
'-ffreestanding',
|
||||||
'-fno-common']
|
'-fno-common']
|
||||||
|
@ -34,7 +34,7 @@ def configure(conf):
|
|||||||
def build(bld):
|
def build(bld):
|
||||||
# C/C++ flags
|
# C/C++ flags
|
||||||
common_flags = []
|
common_flags = []
|
||||||
common_flags += ["-O2"]
|
common_flags += ["-O" + bld.env.OPTIMIZATION]
|
||||||
common_flags += ["-g"]
|
common_flags += ["-g"]
|
||||||
common_flags += ["-fno-strict-aliasing"]
|
common_flags += ["-fno-strict-aliasing"]
|
||||||
common_flags += ["-ffreestanding"]
|
common_flags += ["-ffreestanding"]
|
||||||
|
@ -371,6 +371,7 @@ class ModuleManager(builder.ModuleManager):
|
|||||||
self.add('def build(bld):')
|
self.add('def build(bld):')
|
||||||
self.add(' # C/C++ flags')
|
self.add(' # C/C++ flags')
|
||||||
self.add(' common_flags = []')
|
self.add(' common_flags = []')
|
||||||
|
self.add(' common_flags += ["-O%s" % (bld.env.OPTIMIZATION)]')
|
||||||
for f in builder.commonFlags():
|
for f in builder.commonFlags():
|
||||||
self.add(' common_flags += ["%s"]' % (f))
|
self.add(' common_flags += ["%s"]' % (f))
|
||||||
self.add(' if bld.env.WARNINGS:')
|
self.add(' if bld.env.WARNINGS:')
|
||||||
|
6
wscript
6
wscript
@ -68,6 +68,11 @@ def options(opt):
|
|||||||
default = "",
|
default = "",
|
||||||
dest = "freebsd_options",
|
dest = "freebsd_options",
|
||||||
help = "Set FreeBSD options (developer option).")
|
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)
|
libbsd_waf.options(opt)
|
||||||
|
|
||||||
def bsp_configure(conf, arch_bsp):
|
def bsp_configure(conf, arch_bsp):
|
||||||
@ -88,6 +93,7 @@ def configure(conf):
|
|||||||
conf.env.WARNINGS = conf.options.warnings
|
conf.env.WARNINGS = conf.options.warnings
|
||||||
conf.env.NET_CONFIG = conf.options.net_config
|
conf.env.NET_CONFIG = conf.options.net_config
|
||||||
conf.env.FREEBSD_OPTIONS =conf.options.freebsd_options
|
conf.env.FREEBSD_OPTIONS =conf.options.freebsd_options
|
||||||
|
conf.env.OPTIMIZATION = conf.options.optimization
|
||||||
rtems.configure(conf, bsp_configure)
|
rtems.configure(conf, bsp_configure)
|
||||||
libbsd_waf.configure(conf)
|
libbsd_waf.configure(conf)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user