当我更改SConstruct文件时,scons不会触发重建吗? [英] When I change SConstruct file, scons doesn't trigger rebuild?

查看:164
本文介绍了当我更改SConstruct文件时,scons不会触发重建吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

首先,我有这样的SConstruct文件:

First, I've got SConstruct file like this:

Object('a.s')
Program('mya','a.o')

我运行scons,它会生成"mya".好的.然后将我的SConstruct更改为:

I run scons, it generates 'mya'. OK. Then I change my SConstruct to be:

Object('a.s',CCFLAGS='-DHello')
Program('mya','a.o')

再次运行scons.什么都没做:

Run scons again. Nothing is done:

scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
scons: `.' is up to date.
scons: done building targets.

这对我来说很奇怪.当我使用make或msbuild系统时,只要项目配置文件中的argumenet发生更改,就会进行重建.这是默认规则.

This is quite weird to me. When I used make or msbuild systems, whenever there's argumenet change in project configuration file, there'll be a rebuild. This is a default rule.

但是似乎scons的规则不同,这是设计使然吗?仅当源文件更改时才会触发重建吗?如果这是设计,那么我认为存在一个缺陷,即当更改编译/链接器选项时,目标文件应该有所不同,因此应该触发重建,对吧?

But seems scons's rule is different, is this by design? Only when source file change will trigger rebuild? If this is the design, I think there's a flaw that when compilation/linker option changes, target file should be different and thus, should trigger rebuild, right?

我的理解是不正确的,还是我仍然需要了解的一些特殊要点? 非常感谢.

Is my understanding incorrect, or there's some special points in scons that I still need to know about? Thanks a lot.

推荐答案

直接参考您的最后一段,并基于您的最后三个问题(更改.c文件的注释时,scons 以及它的深度,是的,似乎还有很多关于SCons的东西你不知道.

Refering directly to your last paragraph, and based on your last three questions (Using 'LIBS' in scons 'Program' command failed to find static library, why? and When changing the comment of a .c file, scons still re-compile it? and this one) and the depth of them, yes there seem to be a lot of things that you don't know about SCons.

因此,请采取以下步骤阅读其手册页 UserGuide .您可能还想降低语气,而不是质疑其设计或声称您的作业似乎有缺陷"(另请参见

So please take the next steps in reading its MAN page and the UserGuide. You might also want to step your tone down a bit and instead of questioning its design or claiming that there seems to be a "flaw" doing your homework (see also How To Ask Questions The Smart Way).

在调用"scons -c"后跟"scons"时,您应该看到即使重新构建了"a.o",命令行中也不会出现"-DHello" .变量$CCFLAGS不用于编译汇编程序文件,但是$ASFLAGS是...并且在对其进行设置时,您确实应该立即看到重新生成的内容,而无需编辑源文件.

When you are calling a "scons -c" followed by a "scons" you should see that the "-DHello" doesn't appear in the command-line, even though "a.o" gets rebuilt. The variable $CCFLAGS isn't used to compile assembler files, but $ASFLAGS is...and when setting it instead, you should indeed see a rebuild immediately, without editing the source file.

这篇关于当我更改SConstruct文件时,scons不会触发重建吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆