diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2020-07-08 11:17:38 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2020-09-19 13:26:41 +0200 |
commit | f1f03620800b14146977d78fb4322d80da04b53a (patch) | |
tree | 5e4f43b95a57e720448e8ffa6fcaa3357721ba06 | |
parent | waf: Implement module dependency checking in the build system (diff) | |
download | rtems-libbsd-f1f03620800b14146977d78fb4322d80da04b53a.tar.bz2 |
build: Ensure mandatory compiler/linker flags
-rw-r--r-- | waf_libbsd.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/waf_libbsd.py b/waf_libbsd.py index b8ec0ce0..ac7c2752 100644 --- a/waf_libbsd.py +++ b/waf_libbsd.py @@ -57,6 +57,10 @@ if windows: else: host_shell = '' +def _add_flags_if_not_present(current_flags, addional_flags): + for flag in addional_flags: + if flag not in current_flags: + current_flags.append(flag) # # The waf builder for libbsd. @@ -182,6 +186,10 @@ class Builder(builder.ModuleManager): mandatory=False) else: bld.fatal('invalid config test: %s' % (configTest)) + section_flags = ["-fdata-sections", "-ffunction-sections"] + _add_flags_if_not_present(conf.env.CFLAGS, section_flags) + _add_flags_if_not_present(conf.env.CXXFLAGS, section_flags) + _add_flags_if_not_present(conf.env.LINKFLAGS, ["-Wl,--gc-sections"]) def build(self, bld): # |