[Scons-users] defining map files

Chris Redlats chris.redlats at gmail.com
Thu Aug 2 08:53:26 EDT 2018


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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20180802/33533714/attachment.html>


More information about the Scons-users mailing list