Misha M
Misha M

Reputation: 11289

Scons: run a make command as a dependency for a target

I have a library that needs to by built as a dependency for my target. The library is distributed with a Makefile and there's nothing special needed to build it other than to run:

make my_target

How would I run this command as part of my SConstruct file if my file looks something like:

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

Upvotes: 4

Views: 2473

Answers (1)

Greg Hewgill
Greg Hewgill

Reputation: 992707

Create a Command builder with the name of the library as the target:

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

Be sure to add this library to your Program line:

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

Upvotes: 5

Related Questions