Allow separate optimization flags for libraries and tests. For example, the libraries may be built without optimization if coverage instrumentation is enabled, however, the tests may still use optimization.
Update #4670. --- spec/build/bsps/bspopts.yml | 6 ++++++ spec/build/bsps/optcflags.yml | 17 +++++++++++++++++ spec/build/bsps/optliboptflags.yml | 18 ++++++++++++++++++ spec/build/bsps/opto0.yml | 4 +--- spec/build/bsps/opto1.yml | 4 +--- spec/build/bsps/opto2.yml | 4 +--- spec/build/bsps/optog.yml | 4 +--- spec/build/bsps/optos.yml | 4 +--- spec/build/bsps/opttestoptflags.yml | 18 ++++++++++++++++++ spec/build/cpukit/grp.yml | 6 ++++-- spec/build/testsuites/grp.yml | 6 ++++-- wscript | 2 +- 12 files changed, 73 insertions(+), 20 deletions(-) create mode 100644 spec/build/bsps/optcflags.yml create mode 100644 spec/build/bsps/optliboptflags.yml create mode 100644 spec/build/bsps/opttestoptflags.yml diff --git a/spec/build/bsps/bspopts.yml b/spec/build/bsps/bspopts.yml index d43136e94e..522b1865bc 100644 --- a/spec/build/bsps/bspopts.yml +++ b/spec/build/bsps/bspopts.yml @@ -7,6 +7,10 @@ guard: __BSP_OPTIONS_H include-headers: [] install-path: ${BSP_INCLUDEDIR} links: +- role: build-dependency + uid: optliboptflags +- role: build-dependency + uid: opttestoptflags - role: build-dependency uid: optabi - role: build-dependency @@ -17,6 +21,8 @@ links: uid: optfatalverb - role: build-dependency uid: optincludes +- role: build-dependency + uid: optcflags - role: build-dependency uid: optlinkflags - role: build-dependency diff --git a/spec/build/bsps/optcflags.yml b/spec/build/bsps/optcflags.yml new file mode 100644 index 0000000000..8035640ae3 --- /dev/null +++ b/spec/build/bsps/optcflags.yml @@ -0,0 +1,17 @@ +SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause +actions: +- set-value: | + ${LIBRARY_OPTIMIZATION_FLAGS} +- substitute: null +- split: null +- env-assign: null +build-type: option +copyrights: +- Copyright (C) 2022 embedded brains GmbH (http://www.embedded-brains.de) +default: null +default-by-variant: [] +description: '' +enabled-by: true +links: [] +name: BSP_CFLAGS +type: build diff --git a/spec/build/bsps/optliboptflags.yml b/spec/build/bsps/optliboptflags.yml new file mode 100644 index 0000000000..039284299a --- /dev/null +++ b/spec/build/bsps/optliboptflags.yml @@ -0,0 +1,18 @@ +SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause +actions: +- get-string: null +- substitute: null +- split: null +- env-assign: null +build-type: option +copyrights: +- Copyright (C) 2022 embedded brains GmbH (http://www.embedded-brains.de) +default: ${OPTIMIZATION_FLAGS} +default-by-variant: [] +description: | + Optimization flags passed to the C and C++ compiler for libraries. +enabled-by: true +format: '{}' +links: [] +name: LIBRARY_OPTIMIZATION_FLAGS +type: build diff --git a/spec/build/bsps/opto0.yml b/spec/build/bsps/opto0.yml index 406286980f..9f54709c07 100644 --- a/spec/build/bsps/opto0.yml +++ b/spec/build/bsps/opto0.yml @@ -3,8 +3,6 @@ actions: - get-string: null - split: null - env-assign: null -- env-append: CFLAGS -- env-append: CXXFLAGS build-type: option copyrights: - Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de) @@ -15,7 +13,7 @@ default: - -ffunction-sections default-by-variant: [] description: | - Optimization flags passed to the C and C++ compiler + Default optimization flags for C and C++ compilers. enabled-by: true links: [] name: OPTIMIZATION_FLAGS diff --git a/spec/build/bsps/opto1.yml b/spec/build/bsps/opto1.yml index 52d285c2ab..e0668a887b 100644 --- a/spec/build/bsps/opto1.yml +++ b/spec/build/bsps/opto1.yml @@ -3,8 +3,6 @@ actions: - get-string: null - split: null - env-assign: null -- env-append: CFLAGS -- env-append: CXXFLAGS build-type: option copyrights: - Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de) @@ -15,7 +13,7 @@ default: - -ffunction-sections default-by-variant: [] description: | - Optimization flags passed to the C and C++ compiler + Default optimization flags for C and C++ compilers. enabled-by: true links: [] name: OPTIMIZATION_FLAGS diff --git a/spec/build/bsps/opto2.yml b/spec/build/bsps/opto2.yml index 071e5411d5..7b54556c5b 100644 --- a/spec/build/bsps/opto2.yml +++ b/spec/build/bsps/opto2.yml @@ -3,8 +3,6 @@ actions: - get-string: null - split: null - env-assign: null -- env-append: CFLAGS -- env-append: CXXFLAGS build-type: option copyrights: - Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de) @@ -15,7 +13,7 @@ default: - -ffunction-sections default-by-variant: [] description: | - Optimization flags passed to the C and C++ compiler + Default optimization flags for C and C++ compilers. enabled-by: true links: [] name: OPTIMIZATION_FLAGS diff --git a/spec/build/bsps/optog.yml b/spec/build/bsps/optog.yml index d08bd7b2b2..2eab2acdd1 100644 --- a/spec/build/bsps/optog.yml +++ b/spec/build/bsps/optog.yml @@ -3,8 +3,6 @@ actions: - get-string: null - split: null - env-assign: null -- env-append: CFLAGS -- env-append: CXXFLAGS build-type: option copyrights: - Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de) @@ -15,7 +13,7 @@ default: - -ffunction-sections default-by-variant: [] description: | - Optimization flags passed to the C and C++ compiler + Default optimization flags for C and C++ compilers. enabled-by: true links: [] name: OPTIMIZATION_FLAGS diff --git a/spec/build/bsps/optos.yml b/spec/build/bsps/optos.yml index df9e0efd02..1c2c106064 100644 --- a/spec/build/bsps/optos.yml +++ b/spec/build/bsps/optos.yml @@ -3,8 +3,6 @@ actions: - get-string: null - split: null - env-assign: null -- env-append: CFLAGS -- env-append: CXXFLAGS build-type: option copyrights: - Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de) @@ -15,7 +13,7 @@ default: - -ffunction-sections default-by-variant: [] description: | - Optimization flags passed to the C and C++ compiler + Default optimization flags for C and C++ compilers. enabled-by: true links: [] name: OPTIMIZATION_FLAGS diff --git a/spec/build/bsps/opttestoptflags.yml b/spec/build/bsps/opttestoptflags.yml new file mode 100644 index 0000000000..141fac6653 --- /dev/null +++ b/spec/build/bsps/opttestoptflags.yml @@ -0,0 +1,18 @@ +SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause +actions: +- get-string: null +- substitute: null +- split: null +- env-assign: null +build-type: option +copyrights: +- Copyright (C) 2022 embedded brains GmbH (http://www.embedded-brains.de) +default: ${OPTIMIZATION_FLAGS} +default-by-variant: [] +description: | + Optimization flags passed to the C and C++ compiler for tests. +enabled-by: true +format: '{}' +links: [] +name: TEST_OPTIMIZATION_FLAGS +type: build diff --git a/spec/build/cpukit/grp.yml b/spec/build/cpukit/grp.yml index 24aa2f0634..9958b0bd66 100644 --- a/spec/build/cpukit/grp.yml +++ b/spec/build/cpukit/grp.yml @@ -1,10 +1,12 @@ SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause build-type: group -cflags: [] +cflags: +- ${LIBRARY_OPTIMIZATION_FLAGS} copyrights: - Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de) cppflags: [] -cxxflags: [] +cxxflags: +- ${LIBRARY_OPTIMIZATION_FLAGS} enabled-by: true includes: [] install: [] diff --git a/spec/build/testsuites/grp.yml b/spec/build/testsuites/grp.yml index 82c7b87f2e..18c8ccd4d8 100644 --- a/spec/build/testsuites/grp.yml +++ b/spec/build/testsuites/grp.yml @@ -1,10 +1,12 @@ SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause build-type: group -cflags: [] +cflags: +- ${TEST_OPTIMIZATION_FLAGS} copyrights: - Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de) cppflags: [] -cxxflags: [] +cxxflags: +- ${TEST_OPTIMIZATION_FLAGS} enabled-by: true includes: - ${BSP_INCLUDES} diff --git a/wscript b/wscript index 9894dcd7fd..4071cc9ef8 100755 --- a/wscript +++ b/wscript @@ -625,7 +625,7 @@ class BSPItem(Item): + bld.env.BSP_INCLUDES + self.substitute(bld, self.data["includes"]), self.substitute(bld, self.data["cppflags"]), - self.substitute(bld, self.data["cflags"]), + bld.env.BSP_CFLAGS + self.substitute(bld, self.data["cflags"]), [], [], [], -- 2.35.3 _______________________________________________ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel