SCons: Invoke the build of a Makefile project

假装没事ソ 提交于 2020-01-04 06:22:06

问题


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 :-)


回答1:


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

  • Running Configure and Make
  • Auto Config Builder



回答2:


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.



来源:https://stackoverflow.com/questions/7341908/scons-invoke-the-build-of-a-makefile-project

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!