[Scons-users] defining map files

Bill Deegan bill at baddogconsulting.com
Thu Aug 2 13:07:30 EDT 2018


+1 to Chris. Good solution!

A good way to find these options is to look at the Manpage, here's a link:
https://scons.org/doc/production/HTML/scons-man.html#variable_substitution



On Thu, Aug 2, 2018 at 5:53 AM, Chris Redlats <chris.redlats at gmail.com>
wrote:

> Hi Thosten
>
> I did it this way (for gcc on windows, SCons version : 2.5.1):
>  env.Append(LINKFLAGS = '--Map=${TARGET.base}.map')
>
> Regards
> Christoph
>
>
> 2018-08-02 14:25 GMT+02:00 Torsten Robitzki <Torsten at robitzki.de>:
>
>> Hello,
>>
>> I try to build several Programs in the same environment. I would like to
>> let the linker generate a map file and that map file name should depend on
>> $TARGET (foo.elf -> foo.map).
>>
>> All Programs share some common object files. According to "4.2.5.
>> Variable substitution“ it should be possible to call functions during
>> construction variable substitution:
>>
>>     env = Environment(FUNC = myfunc)
>>     env.Command(target = ‚foo.out‘, source = 'foo.in', command =
>> "${FUNC($<)}")
>>
>> I’ve tried that:
>>
>>     def map_file_name_from_target(target):
>>         return os.path.splitext(target)[ 0 ] + '.map'
>>
>>     hsm_env.Append(
>>         FUNC = map_file_name_from_target,
>>         EXEC_LDFLAGS = „-Wl,-Map=${FUNC($<)},—cref
>> -Wl,-T,STM32F746NGHx_FLASH.ld „ )
>>
>> but with no luck:
>>
>>     SyntaxError `invalid syntax (<string>, line 1)’ trying to evaluate
>> `${FUNC($<)}'
>>
>> I’m very new to Scons, but I think that deriving file names from other
>> file name is such a common thing, when building software, so there must be
>> a way to achieve what I want to do. Most likely there is a Sconish way that
>> I’m not aware of.
>>
>> Any hints, tipps?
>>
>> Kind regards,
>>
>> Torsten
>> _______________________________________________
>> Scons-users mailing list
>> Scons-users at scons.org
>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>
>
>
> _______________________________________________
> Scons-users mailing list
> Scons-users at scons.org
> https://pairlist4.pair.net/mailman/listinfo/scons-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20180802/07ababfe/attachment.html>


More information about the Scons-users mailing list