SCons:调用 Makefile 项目的构建

发布于 2024-12-03 11:45:01 字数 438 浏览 0 评论 0原文

SCons 提供了 env.Command,理论上它应该能够在 Makefile 项目上调用 ./configurema​​ke 。然而,我的理解是,Makefile 项目文件夹首先必须复制到 SCons 的构建目录中,因为构建过程不应更改源树中的任何内容。这怎么能做到呢?

我想我正在寻找的是这样的:

env.Command('lib/moo/Makefile', '', [Copy('BUILD_DIR/lib/moo', 'SOURCE_DIR/lib/moo', 'cd BUILD_DIR/lib/moo', './configure'])

虽然我怀疑有更好的方法来做到这一点。另外,上面命令中的 BUILD_DIR 和 SOURCE_DIR 应该用什么来代替?

谢谢 :-)

SCons provides env.Command which should theoretically be able to invoke ./configure and make on a Makefile project. However, my understanding is that the Makefile project folder would first have to be copied into SCons' build directory, since the build process should not be changing anything in the source tree. How can this be done?

I guess what I'm looking for is something like this:

env.Command('lib/moo/Makefile', '', [Copy('BUILD_DIR/lib/moo', 'SOURCE_DIR/lib/moo', 'cd BUILD_DIR/lib/moo', './configure'])

Although I suspect there is a better way of doing this. Also, what would go in place of BUILD_DIR and SOURCE_DIR in the above command?

Thanks :-)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

呆° 2024-12-10 11:45:01

SCons Wiki 上有一些解决此问题的方法。也许其中之一足以满足您的需求:

There are a couple of recipes for this on the SCons Wiki. Maybe one of them will be good enough for your needs:

挽袖吟 2024-12-10 11:45:01

作为@kichik 的附录。如果您只想运行 make,请将以下内容添加到您的 SConscript 文件中:

 call_vars = {}
 call_vars['PATH'] = '/bin/:/usr/bin/'                                    
 artifacts = env.Make(target = 'Config.jason', source = None,
     MakeTargets = "clean all",                 
     MakePath = Dir('./'), MakeOpts = [], MakeEnv=call_vars)
 env.AlwaysBuild(artifacts)

这将调用此处描述的脚本 https://bitbucket.org/scons/scons/wiki/MakeBuilder

请注意,环境变量可能与预期不符,例如 PATH。这让我颇为头疼。

As an addendum to @kichik. If you only want to run make, add the following to your SConscript file:

 call_vars = {}
 call_vars['PATH'] = '/bin/:/usr/bin/'                                    
 artifacts = env.Make(target = 'Config.jason', source = None,
     MakeTargets = "clean all",                 
     MakePath = Dir('./'), MakeOpts = [], MakeEnv=call_vars)
 env.AlwaysBuild(artifacts)

This calls the script described here https://bitbucket.org/scons/scons/wiki/MakeBuilder

Please be aware that the Environment variables might not be as expected, e.g, PATH. This gave me quite a bit of a headache.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文