开发者

SCons: Invoke the build of a Makefile project

开发者 https://www.devze.com 2023-04-03 15:10 出处:网络
SCons provides env.Command which should theoretically be able to invo开发者_开发百科ke ./configure and make on a Makefile project. However, my understanding is that the Makefile project folder would f

SCons provides env.Command which should theoretically be able to invo开发者_开发百科ke ./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 :-)


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


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消