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

Sebastian Huber sebastian.huber at embedded-brains.de
Wed Apr 13 18:38:02 UTC 2022


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?

-- 
embedded brains GmbH
Herr Sebastian HUBER
Dornierstr. 4
82178 Puchheim
Germany
email: sebastian.huber at embedded-brains.de
phone: +49-89-18 94 741 - 16
fax:   +49-89-18 94 741 - 08

Registergericht: Amtsgericht München
Registernummer: HRB 157899
Vertretungsberechtigte Geschäftsführer: Peter Rasmussen, Thomas Dörfler
Unsere Datenschutzerklärung finden Sie hier:
https://embedded-brains.de/datenschutzerklaerung/


More information about the devel mailing list