Ani
Ani

Reputation: 1536

Waf, trouble adding manual dependencies

I have a target in waf, which depends on multiple other files. There is a program which lists those dependencies, and I want to use it, and pass to waf. I.e, if I have a target T, there is a program which lists all the dependencies for T. But I'm not clear as to how to pass this to bld.add_manual_dependency().

A single file as dependency seems to be working fine:

bld.add_manual_dependency(bld.path.find_or_declare('T'), bld.path.find_resource('Dep1'))

But if I pass a list as the second argument, seems to accept, but doesnt work!. I want to know how to pass multiple files (not ant_glob(), but selected by the program).

Upvotes: 3

Views: 1245

Answers (1)

Gaslight Deceive Subvert
Gaslight Deceive Subvert

Reputation: 20428

It depends on how you want the target to be produced from the dependencies. In the simplest case, you just use a build-rule with sources and a target:

def build(bld):
    bld(
        rule = 'cat ${SRC[0].abspath()} > ${TGT}',
        source = ['hello.txt', 'there.txt'],
        target = 'out.txt'
    )

As you can see, out.txt will be produced by cat:ing hello.txt to it and both hello.txt and there.txt will be seen as the targets dependencies. Here I have hardcoded the dependencies in the wscript, but you would of course call your program that generates the dependencies list as use that.

Upvotes: 1

Related Questions