Pavel
Pavel

Reputation: 5672

SCons: Invoke the build of a Makefile project

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

Upvotes: 3

Views: 4983

Answers (2)

krissy
krissy

Reputation: 81

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.

Upvotes: 0

kichik
kichik

Reputation: 34744

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

Upvotes: 4

Related Questions