3

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

Ani
  • 1,448
  • 1
  • 16
  • 38
  • 2
    Hi, can you be a little more specific regarding your need ? waf has a system of tools, with task generators, that can scan for file dependencies. You could ask for the external program to provide the names of the dependencies, and resolve them to nodes in the source folder. – cJ Zougloub Sep 02 '13 at 22:40
  • visiting this after a long time!, @Zouloub - ok, I think I was stuck in the names->nodes I think! because the external program lists the names on `stdout` – Ani Sep 04 '15 at 17:40

1 Answers1

1

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.

Björn Lindqvist
  • 19,221
  • 20
  • 87
  • 122
  • Its such an old post that now I have moved on from this, but still, IIRC the problem that I had was adding the dependencies - which were not sources (something similar to `.h` files when we compile a `.c` file, but this was, for a different language, tool) – Ani Sep 04 '15 at 17:39
  • My example demonstrates just that. `there.txt` is a dependency even though it is not used by the process. If you mean something else maybe you can clarify? – Björn Lindqvist Sep 04 '15 at 17:46
  • ok, I should check back the sources, cant remember exactly where I was stuck! :( – Ani Sep 04 '15 at 18:03