[PATCH] build: Use build context for custom commands

Sebastian Huber sebastian.huber at embedded-brains.de
Mon Sep 11 09:37:59 UTC 2023


Revert duplicated listing of TEST_OPTIMIZATION_FLAGS.

Close #4947.
---
 spec/build/testsuites/grp.yml           |  1 -
 spec/build/testsuites/libtests/dl01.yml |  3 +--
 spec/build/testsuites/libtests/dl02.yml |  3 +--
 spec/build/testsuites/libtests/dl03.yml |  3 +--
 spec/build/testsuites/libtests/dl04.yml |  3 +--
 spec/build/testsuites/libtests/dl05.yml |  3 +--
 spec/build/testsuites/libtests/dl06.yml |  3 +--
 spec/build/testsuites/libtests/dl07.yml |  3 +--
 spec/build/testsuites/libtests/dl08.yml |  3 +--
 spec/build/testsuites/libtests/dl09.yml |  3 +--
 spec/build/testsuites/libtests/dl10.yml |  3 +--
 spec/build/testsuites/libtests/dl11.yml |  3 +--
 wscript                                 | 14 +++++++++-----
 13 files changed, 20 insertions(+), 28 deletions(-)

diff --git a/spec/build/testsuites/grp.yml b/spec/build/testsuites/grp.yml
index 85b50e01e8..c50693420c 100644
--- a/spec/build/testsuites/grp.yml
+++ b/spec/build/testsuites/grp.yml
@@ -12,7 +12,6 @@ includes:
 - ${BSP_INCLUDES}
 install: []
 ldflags:
-- ${TEST_OPTIMIZATION_FLAGS}
 - ${COVERAGE_LINKER_FLAGS}
 links:
 - role: build-dependency
diff --git a/spec/build/testsuites/libtests/dl01.yml b/spec/build/testsuites/libtests/dl01.yml
index ae3d125a65..3cc04a6611 100644
--- a/spec/build/testsuites/libtests/dl01.yml
+++ b/spec/build/testsuites/libtests/dl01.yml
@@ -1,7 +1,6 @@
 SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
 build-type: script
-cflags:
-- ${TEST_OPTIMIZATION_FLAGS}
+cflags: []
 copyrights:
 - Copyright (C) 2020 embedded brains GmbH & Co. KG
 cppflags: []
diff --git a/spec/build/testsuites/libtests/dl02.yml b/spec/build/testsuites/libtests/dl02.yml
index 59ddf27a96..9fd81dc7c8 100644
--- a/spec/build/testsuites/libtests/dl02.yml
+++ b/spec/build/testsuites/libtests/dl02.yml
@@ -1,7 +1,6 @@
 SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
 build-type: script
-cflags:
-- ${TEST_OPTIMIZATION_FLAGS}
+cflags: []
 copyrights:
 - Copyright (C) 2020 embedded brains GmbH & Co. KG
 cppflags: []
diff --git a/spec/build/testsuites/libtests/dl03.yml b/spec/build/testsuites/libtests/dl03.yml
index edeceeef3b..363e3a925f 100644
--- a/spec/build/testsuites/libtests/dl03.yml
+++ b/spec/build/testsuites/libtests/dl03.yml
@@ -1,7 +1,6 @@
 SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
 build-type: test-program
-cflags:
-- ${TEST_OPTIMIZATION_FLAGS}
+cflags: []
 copyrights:
 - Copyright (C) 2020 embedded brains GmbH & Co. KG
 cppflags: []
diff --git a/spec/build/testsuites/libtests/dl04.yml b/spec/build/testsuites/libtests/dl04.yml
index c31dab7e69..7dd41e3338 100644
--- a/spec/build/testsuites/libtests/dl04.yml
+++ b/spec/build/testsuites/libtests/dl04.yml
@@ -1,7 +1,6 @@
 SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
 build-type: script
-cflags:
-- ${TEST_OPTIMIZATION_FLAGS}
+cflags: []
 copyrights:
 - Copyright (C) 2020 embedded brains GmbH & Co. KG
 cppflags: []
diff --git a/spec/build/testsuites/libtests/dl05.yml b/spec/build/testsuites/libtests/dl05.yml
index db64528dd1..80f72131d0 100644
--- a/spec/build/testsuites/libtests/dl05.yml
+++ b/spec/build/testsuites/libtests/dl05.yml
@@ -1,7 +1,6 @@
 SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
 build-type: script
-cflags:
-- ${TEST_OPTIMIZATION_FLAGS}
+cflags: []
 copyrights:
 - Copyright (C) 2020 embedded brains GmbH & Co. KG
 cppflags: []
diff --git a/spec/build/testsuites/libtests/dl06.yml b/spec/build/testsuites/libtests/dl06.yml
index 11243412b1..0fc5af1478 100644
--- a/spec/build/testsuites/libtests/dl06.yml
+++ b/spec/build/testsuites/libtests/dl06.yml
@@ -1,7 +1,6 @@
 SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
 build-type: script
-cflags:
-- ${TEST_OPTIMIZATION_FLAGS}
+cflags: []
 copyrights:
 - Copyright (C) 2020 embedded brains GmbH & Co. KG
 cppflags: []
diff --git a/spec/build/testsuites/libtests/dl07.yml b/spec/build/testsuites/libtests/dl07.yml
index f8e27fa9c3..a6f1ac4a4c 100644
--- a/spec/build/testsuites/libtests/dl07.yml
+++ b/spec/build/testsuites/libtests/dl07.yml
@@ -1,7 +1,6 @@
 SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
 build-type: script
-cflags:
-- ${TEST_OPTIMIZATION_FLAGS}
+cflags: []
 copyrights:
 - Copyright (C) 2020 embedded brains GmbH & Co. KG
 cppflags: []
diff --git a/spec/build/testsuites/libtests/dl08.yml b/spec/build/testsuites/libtests/dl08.yml
index 34ed1ba67b..0755666c3d 100644
--- a/spec/build/testsuites/libtests/dl08.yml
+++ b/spec/build/testsuites/libtests/dl08.yml
@@ -1,7 +1,6 @@
 SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
 build-type: script
-cflags:
-- ${TEST_OPTIMIZATION_FLAGS}
+cflags: []
 copyrights:
 - Copyright (C) 2020 embedded brains GmbH & Co. KG
 cppflags: []
diff --git a/spec/build/testsuites/libtests/dl09.yml b/spec/build/testsuites/libtests/dl09.yml
index 0fcc631122..563323d6c8 100644
--- a/spec/build/testsuites/libtests/dl09.yml
+++ b/spec/build/testsuites/libtests/dl09.yml
@@ -1,7 +1,6 @@
 SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
 build-type: script
-cflags:
-- ${TEST_OPTIMIZATION_FLAGS}
+cflags: []
 copyrights:
 - Copyright (C) 2020 embedded brains GmbH & Co. KG
 cppflags: []
diff --git a/spec/build/testsuites/libtests/dl10.yml b/spec/build/testsuites/libtests/dl10.yml
index df88b806f2..880abeff9b 100644
--- a/spec/build/testsuites/libtests/dl10.yml
+++ b/spec/build/testsuites/libtests/dl10.yml
@@ -1,7 +1,6 @@
 SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
 build-type: script
-cflags:
-- ${TEST_OPTIMIZATION_FLAGS}
+cflags: []
 copyrights:
 - Copyright (C) 2020 embedded brains GmbH & Co. KG
 cppflags: []
diff --git a/spec/build/testsuites/libtests/dl11.yml b/spec/build/testsuites/libtests/dl11.yml
index 788502ed65..6eaaeaeecc 100644
--- a/spec/build/testsuites/libtests/dl11.yml
+++ b/spec/build/testsuites/libtests/dl11.yml
@@ -1,7 +1,6 @@
 SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
 build-type: script
-cflags:
-- ${TEST_OPTIMIZATION_FLAGS}
+cflags: []
 copyrights:
 - Copyright (C) 2023 On-Line Applications Research (OAR)
 cppflags: []
diff --git a/wscript b/wscript
index 03c6ac1035..00b81b4874 100755
--- a/wscript
+++ b/wscript
@@ -307,7 +307,8 @@ class Item(object):
             target = os.path.splitext(source)[0] + ".o"
         bld(
             asflags=self.substitute(bld, self.data["asflags"]),
-            cppflags=self.substitute(bld, self.data["cppflags"]),
+            cppflags=bic.cppflags +
+            self.substitute(bld, self.data["cppflags"]),
             features="asm_explicit_target asm c",
             includes=bic.includes +
             self.substitute(bld, self.data["includes"]),
@@ -320,8 +321,9 @@ class Item(object):
         if target is None:
             target = os.path.splitext(source)[0] + ".o"
         bld(
-            cflags=self.substitute(bld, self.data["cflags"]),
-            cppflags=cppflags + self.substitute(bld, self.data["cppflags"]),
+            cflags=bic.cflags + self.substitute(bld, self.data["cflags"]),
+            cppflags=bic.cppflags + cppflags +
+            self.substitute(bld, self.data["cppflags"]),
             features="c",
             includes=bic.includes +
             self.substitute(bld, self.data["includes"]),
@@ -336,8 +338,10 @@ class Item(object):
         if target is None:
             target = os.path.splitext(source)[0] + ".o"
         bld(
-            cppflags=cppflags + self.substitute(bld, self.data["cppflags"]),
-            cxxflags=self.substitute(bld, self.data["cxxflags"]),
+            cppflags=bic.cppflags + cppflags +
+            self.substitute(bld, self.data["cppflags"]),
+            cxxflags=bic.cxxflags +
+            self.substitute(bld, self.data["cxxflags"]),
             features="cxx",
             includes=bic.includes +
             self.substitute(bld, self.data["includes"]),
-- 
2.35.3



More information about the devel mailing list