[Scons-users] scons add source file suffix for env.Object()
于
yjtyzw at 126.com
Mon Nov 4 08:58:55 EST 2024
Hi Mats,
Thanks for your help.
I think your solution is better. So that I don't need to create many builders for different suffix.
I create a new builder(such as below) to build .850, and "AsmBulder_ex" can build .850 also.
bld = Builder( action= Action('$ASCOM', '$ASCOMSTR'), \
suffix='.o', \
src_suffix='.850')
env.Append(BUILDERS={'AsmBulder_ex': bld})
And could you anwser me a new question? What are the differences between your solution and new builder.
---- Replied Message ----
| From | <scons-users-request at scons.org> |
| Date | 10/30/2024 13:36 |
| To | <scons-users at scons.org> |
| Subject | Scons-users Digest, Vol 158, Issue 4 |
Send Scons-users mailing list submissions to
scons-users at scons.org
To subscribe or unsubscribe via the World Wide Web, visit
https://pairlist4.pair.net/mailman/listinfo/scons-users
or, via email, send a message with subject or body 'help' to
scons-users-request at scons.org
You can reach the person managing the list at
scons-users-owner at scons.org
When replying, please edit your Subject line so it is more specific
than "Re: Contents of Scons-users digest..."
Today's Topics:
1. scons add source file suffix for env.Object() (?)
2. Re: scons add source file suffix for env.Object() (Mats Wichmann)
----------------------------------------------------------------------
Message: 1
Date: Tue, 29 Oct 2024 21:17:43 +0800 (CST)
From: ? <yjtyzw at 126.com>
To: scons-users at scons.org
Subject: [Scons-users] scons add source file suffix for env.Object()
Message-ID: <5a6ab2f7.9f90.192d86cd431.Coremail.yjtyzw at 126.com>
Content-Type: text/plain; charset="gbk"
Hello,
I use scons to build MCU project, and the project need asm files. The file suffix is *.850.
Scons report a error message "scons: *** While building `['']': Cannot deduce file extension from source files".
I think I can add environment to resolve the problem. But I don't know how to set src_suffix.
Thanks everyone.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20241029/9f742eb8/attachment-0001.htm>
------------------------------
Message: 2
Date: Tue, 29 Oct 2024 08:14:14 -0600
From: Mats Wichmann <mats at wichmann.us>
To: scons-users at scons.org
Subject: Re: [Scons-users] scons add source file suffix for
env.Object()
Message-ID: <e8e3b66a-8274-436a-90ed-ab2de49abcd2 at wichmann.us>
Content-Type: text/plain; charset=UTF-8; format=flowed
On 10/29/24 07:17, ? wrote:
Hello,
? ? ? ? I use scons to build MCU project, and the project need asm
files. The file suffix is *.850.
? ? ? ? Scons report a error message "scons: *** While building `['']':
Cannot deduce file extension from source files".
? ? ? ? I think I can add environment to resolve the problem. But I
don't know how to set src_suffix.
? ? ? ? Thanks everyone.
It's not entirely trivial, and involves using features that are not
documented as part of the "public API" - that is, you won't find these
in the man page.
You can write your own builder for those files - that's the place you
can specify src_suffix by that name - or you can sneak in and modify the
existing Object (and maybe SharedObject?) builders. The latter is
probably easier because Object (which is a synonym for StaticObject) is
already plumbed into the system.
In general terms, that could look like this, assuming your situation
just uses the regular assembler and doesn't require special syntax, etc.
(you didn't say). This has to happen after the construction environment
is created:
import SCons.Defaults
static_obj = env["BUILDERS"]["StaticObject"]
suffix = ".850"
static_obj.add_action(suffix, SCons.Defaults.ASAction)
static_obj.add_emitter(suffix, SCons.Defaults.StaticObjectEmitter)
# repeat if needed for SharedObject
There may be additional steps needed.
It that works out you can turn it into a tool - see the User Guide for
some details on how to do that. The advantage of a tool is you put its
name in the tool list when instantiating an Environment, like
env = Environment(tools=["default", "myasm"])
and it just gets taken care of...
------------------------------
Subject: Digest Footer
_______________________________________________
Scons-users mailing list
Scons-users at scons.org
https://pairlist4.pair.net/mailman/listinfo/scons-users
------------------------------
End of Scons-users Digest, Vol 158, Issue 4
*******************************************
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20241104/438c1169/attachment.htm>
More information about the Scons-users
mailing list