[PATCH v1 1/2] wscript: Allow defines to be used for substitution
Kinsey Moore
kinsey.moore at oarcorp.com
Wed Apr 13 18:06:54 UTC 2022
On 4/13/2022 00:53, Sebastian Huber wrote:
> On 12/04/2022 20:55, Kinsey Moore wrote:
>> This allows options set as defines to the compiler to be used as targets
>> for substitution using the syntax ${DEFINES:define_target}. These need
>> special handling since they are not in a form that is trivially consumed
>> by the mapping code.
>> ---
>> wscript | 4 ++++
>> 1 file changed, 4 insertions(+)
>>
>> diff --git a/wscript b/wscript
>> index 4d63dbc66f..9de9d67b91 100755
>> --- a/wscript
>> +++ b/wscript
>> @@ -107,6 +107,10 @@ class EnvWrapper(object):
>> except IndexError:
>> fmt = "{}"
>> if isinstance(v, list):
>> + if fields[0] == "DEFINES":
>> + for D in v:
>> + if D.startswith(fields[1]+'='):
>> + return "{}".format(D.split("=")[1].strip('"'))
>> return " ".join([fmt.format(w) for w in v])
>> return fmt.format(v)
>
> Sorry, I don't understand what this is supposed to do. Could you
> please give me an example use case?
>
Currently, this is being used with the other substitution patch to allow
critical external resources for the Deos BSPs to be placed at
user-defined locations. In the BSP for RTEMS5, this was being provided
as a variable to `make` and being substituted into paths in the various
Makefiles. I had thought to codify this input a little more strictly as
a BSP configuration option in config.ini to make it more obvious or even
a required part of the `waf configure` step. The BSP option, when set as
a compiler define, can be used in substitutions to reference these
external paths.
Kinsey
More information about the devel
mailing list