【问题标题】:Scons: run a make command as a dependency for a targetScons:运行 make 命令作为目标的依赖项
【发布时间】:2011-06-17 00:42:26
【问题描述】:

我有一个库需要构建为我的目标的依赖项。该库与 Makefile 一起分发,构建它除了运行之外没有什么特别需要的:

make my_target

如果我的文件看起来像这样,我将如何将此命令作为我的 SConstruct 文件的一部分运行:

env = Environment()
flags = env.ParseFlags( CCFLAGS + LDFLAGS )
env.MergeFlags( flags )
env.Program( target = 'my_prog', source = SRC )

【问题讨论】:

    标签: makefile scons


    【解决方案1】:

    以库名作为目标创建Command builder:

    env.Command("other/lib/libother.a", "", "cd other && make my_target")
    

    请务必将此库添加到您的 Program 行:

    env.Program(target="my_prog", source=SRC, LIBS=["other/lib/libother.a"])
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-03-15
      • 2019-07-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多