【发布时间】:2016-10-04 15:32:16
【问题描述】:
我想告诉scons,当我更改了一个头文件时,不要重新编译我的源文件(这只是我的测试!) 我有 hello.c 文件:
#ifdef FOO
#include"~/headers/n.h"
#endif
#include<stdio.h>
int main(){
printf("hello\n");
return 2;
}
我的 SConstruct 文件是:
obj=Object('hello.c')
SideEffect('hello.d',obj)
ParseDepends('hello.d')
Program('hello',obj)
你看,我没有定义任何“FOO”,所以 hello.c 文件根本不使用我的 .h 文件。 我还希望 ParseDepends 能够读取 C 预处理器命令以忽略我的 #include "n.h",因为没有定义 "FOO"。
但是当运行scons,然后修改n.h文件,再次运行scons会触发hello.c的rebuild
然后我尝试使用以下“忽略”语句:
hello_obj=Object('hello.c')
hello=Program(hello_obj)
Ignore(hello_obj,'n.h')
我得到了相同的测试结果:n.h 内部的变化不会被 scons 忽略! 为什么?
【问题讨论】:
-
你为什么要测试这个?你想达到什么目的?
标签: c++ linux parsing dependencies scons