Commit c9474c0b authored by Sebastian Huber's avatar Sebastian Huber Committed by Christian Mauderer

build: Ensure mandatory compiler/linker flags

parent 6da0dda3
......@@ -55,6 +55,11 @@ 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.
#
......@@ -168,6 +173,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):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment