[Scons-users] 答复: [scons-users] Replacing Builder while perserving Scanner

yangsc yangsc2009 at gmail.com
Sun Jun 15 08:56:33 EDT 2014


Thank you,

 

I’v read the scanner object, but my problem is I want to use the default
C-Scanner to proceed my ‘.input’ file and I don’t want to write my own
scanner because the preprocesser derictive is the same as in C.

 

It seems scons have flexibility to write user’s own scanner, but I just
want a way to reuse some already existed scanner for building the dependency
graph, and then use my own builder to build the source file into target
file.

 

发件人: Scons-users [mailto:scons-users-bounces at scons.org] 代表 Dirk B?chle
发送时间: 2014年6月15日 16:24
收件人: scons-users at scons.org
主题: Re: [Scons-users] [scons-users] Replacing Builder while perserving
Scanner

 

Hi,

On 15.06.2014 21:38, yangsc wrote:

Hello,

 

Now I have some ‘.input’ files to be built to ‘.obj’-like targets. I
have written a build action function and replace the env’s object builder:

myBuilder = Builder(action     = mybuilder.MyBuilder,

                                        src_suffix = '.input',

                                        emitter    = mybuilder.MyEmitter)

env.Replace(BUILDERS = {'Object' : myBuilder})

 

In ‘.input’ files, there are some preprocessor directives as the
C-Preprocessor has: ‘#include’, ‘#ifdef’ etc. So I want to preserve the
default C-Scanner.

But when I run the sconscript the default CScanner doesn’t work at all. I
also tried replace ‘CFILESUFFIX’,‘ CPPSUFFIXES’,’ CXXFILESUFFIX’ .

 

So Is there some method can I use the default C-Scanner for .h dependencies
while use my builder function to build the targets?


please refer to the MAN page, in the section "Scanner objects" you'll find
an example of how to add, or better: link, your scanner to the additional
filename extension ".input". Note, that building targets and scanning source
files are completely independent (well, almost) of each other...so you can
build C/CPP targets and scan ".c"/".h"/".input" files at the same time.

Best regards,

Dirk

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://four.pairlist.net/pipermail/scons-users/attachments/20140615/4b6bd86c/attachment.html>


More information about the Scons-users mailing list