[PATCH v1 1/2] wscript: Allow defines to be used for substitution

Kinsey Moore kinsey.moore at oarcorp.com
Wed Apr 13 21:44:04 UTC 2022


On 4/13/2022 13:38, Sebastian Huber wrote:
> On 13/04/2022 20:06, Kinsey Moore wrote:
>> 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.
>
> Ok, so you want to use this for command line defines using -D option? 
> I am strongly opposed to the use of command line defines. Why can't 
> you place the defines in bspopts.h or cpuopts.h?
>
I'm going to drop this patch from the set as I've found a way around the 
need for dealing with -D defines using env-assign. This was only in 
place because it was how the RTEMS5 BSP provided that information. 
Fortunately, it wasn't a hard requirement.


I'll resubmit v2 of the other patch now that I've reworked it.


Thanks,

Kinsey



More information about the devel mailing list