summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2021-09-06 09:54:04 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2022-05-18 11:36:06 +0200
commitdf7918212948651700ab73cda8f646c332ced62a (patch)
tree11657ceb4828b728833a67fba402bcba044bb945
parent4730a413184e73e7405e64e3d82adf6b47aa30b8 (diff)
build: Add cflags to BuildItemContext
-rwxr-xr-xwscript38
1 files changed, 26 insertions, 12 deletions
diff --git a/wscript b/wscript
index c14724c64d..e7159ad724 100755
--- a/wscript
+++ b/wscript
@@ -293,7 +293,7 @@ class Item(object):
if target is None:
target = os.path.splitext(source)[0] + ".o"
bld(
- cflags=self.substitute(bld, self.data["cflags"]),
+ cflags=bic.cflags + self.substitute(bld, self.data["cflags"]),
cppflags=cppflags + self.substitute(bld, self.data["cppflags"]),
features="c",
includes=bic.includes + self.get_values(bld, "includes"),
@@ -308,7 +308,7 @@ class Item(object):
target = os.path.splitext(source)[0] + ".o"
bld(
cppflags=cppflags + self.substitute(bld, self.data["cppflags"]),
- cxxflags=self.substitute(bld, self.data["cxxflags"]),
+ cxxflags=bic.cflgas + self.substitute(bld, self.data["cxxflags"]),
features="cxx",
includes=bic.includes + self.get_values(bld, "includes"),
rule="${CXX} ${CXXFLAGS} ${CPPFLAGS} ${DEFINES_ST:DEFINES} ${CPPPATH_ST:INCPATHS} -c ${SRC[0]} -o ${TGT}",
@@ -519,6 +519,7 @@ class GroupItem(Item):
def prepare_build(self, bld, bic):
return BuildItemContext(
bic.includes + self.get_values(bld, "includes"),
+ bic.cflags,
self.data["use-before"] + bic.use + self.data["use-after"],
bic.ldflags + self.get_values(bld, "ldflags"),
bic.objects,
@@ -587,9 +588,9 @@ class ObjectsItem(Item):
def do_build(self, bld, bic):
bld.objects(
asflags=self.substitute(bld, self.data["cppflags"]),
- cflags=self.substitute(bld, self.data["cflags"]),
+ cflags=bic.cflags + self.substitute(bld, self.data["cflags"]),
cppflags=self.substitute(bld, self.data["cppflags"]),
- cxxflags=self.substitute(bld, self.data["cxxflags"]),
+ cxxflags=bic.cflags + self.substitute(bld, self.data["cxxflags"]),
includes=bic.includes + self.get_values(bld, "includes"),
source=self.data["source"],
target=self.uid,
@@ -606,12 +607,16 @@ class BSPItem(Item):
def prepare_build(self, bld, bic):
return BuildItemContext(
- bic.includes + bld.env.BSP_INCLUDES.split(), [], [], []
+ bic.includes + bld.env.BSP_INCLUDES.split(),
+ bic.cflags + bld.env.BSP_CFLAGS,
+ [],
+ [],
+ [],
)
def do_build(self, bld, bic):
bld(
- cflags=self.substitute(bld, self.data["cflags"]),
+ cflags=bic.cflags + self.substitute(bld, self.data["cflags"]),
cppflags=self.substitute(bld, self.data["cppflags"]),
features="c cstlib",
includes=bic.includes + self.get_values(bld, "includes"),
@@ -628,11 +633,17 @@ class LibraryItem(Item):
super(LibraryItem, self).__init__(uid, data)
def prepare_build(self, bld, bic):
- return BuildItemContext(bic.includes, [], [], [])
+ return BuildItemContext(
+ bic.includes,
+ bic.cflags + self.get_values(bld, "cflags"),
+ [],
+ [],
+ [],
+ )
def do_build(self, bld, bic):
bld(
- cflags=self.substitute(bld, self.data["cflags"]),
+ cflags=bic.cflags,
cppflags=self.substitute(bld, self.data["cppflags"]),
cxxflags=self.substitute(bld, self.data["cxxflags"]),
features="c cxx cstlib",
@@ -656,11 +667,13 @@ class TestProgramItem(Item):
return [{"and": [{"not": self.exclude}, self.data["enabled-by"]]}]
def prepare_build(self, bld, bic):
- return BuildItemContext(bic.includes, bic.use, bic.ldflags, [])
+ return BuildItemContext(
+ bic.includes, bic.cflags, bic.use, bic.ldflags, []
+ )
def do_build(self, bld, bic):
bld(
- cflags=self.substitute(bld, self.data["cflags"]),
+ cflags=bic.cflags + self.substitute(bld, self.data["cflags"]),
cppflags=bld.env[self.cppflags] + self.substitute(bld, self.data["cppflags"]),
cxxflags=self.substitute(bld, self.data["cxxflags"]),
features=self.data["features"],
@@ -1111,8 +1124,9 @@ class ConfigItemContext(object):
class BuildItemContext(object):
- def __init__(self, includes, use, ldflags, objects):
+ def __init__(self, includes, cflags, use, ldflags, objects):
self.includes = includes
+ self.cflags = cflags
self.use = use
self.ldflags = ldflags
self.objects = objects
@@ -1561,7 +1575,7 @@ def build(bld):
append_variant_builds(bld)
return
long_command_line_workaround(bld)
- bic = BuildItemContext(bld.env.ARCH_INCLUDES.split(), [], [], [])
+ bic = BuildItemContext(bld.env.ARCH_INCLUDES.split(), [], [], [], [])
bsps[bld.env.ARCH][bld.env.BSP_BASE].build(bld, bic)
items[bld.env.TOPGROUP].build(bld, bic)