Advertisement

SCons教程(5) 目标节点和依赖项

阅读量:

目标节点

SCons 将所有文件与目录均视为节点,因此若能熟练运用对节点的操作方式,则能够更为便捷地完成构建文件的编写工作。

选项

撰写以下文件

复制代码
    // hello.c
    #include <stdio.h>
    
    extern void hello2(void);
    
    int main(void)
    {
    #ifdef HELLO
    printf("hello\r\n");
    #endif
    hello2();
    return 0;
    }
    
    
    // hello2.c
    #include <stdio.h>
    
    int hello2(void)
    {
    #ifdef HELLO2
    printf("hello2\r\n");
    #endif
    return 0;
    }
    
    # SConstruct
    Object('hello.c', CCFLAGS='-DHELLO')
    Object('hello2.c', CCFLAGS='-DHELLO2')
    Program(['hello.o', 'hello2.o'])
    
    
      

全部评论 (0)

还没有任何评论哟~