3 # Compute the test dependencies for a ccan module. Usage:
4 # tools/gen_deps.sh ccan/path/to/module
7 module=`echo $path | sed 's/^ccan\///g'`
9 # The test depends on the test sources ...
10 test_srcs=`ls $path/test/*.[ch] 2>/dev/null | tr '\n' ' '`
12 # ... and the object files of our module (rather than the sources, so
13 # that we pick up the resursive dependencies for the objects)
14 module_objs=`ls $path/*.c 2>/dev/null | sed 's/.c$/.o/g' | tr '\n' ' '`
16 # ... and on the modules this test uses having passed their tests
17 deps=$(echo `$path/info depends` | tr ' ' '\n' | \
18 sort | uniq | sed -e 's/$/\/.ok/g' -e '/^\/.ok$/d' | tr '\n' ' ')
20 # Print the test targets and target aliases
21 echo "${module}_ok_deps := $test_srcs $module_objs $deps"
22 echo "$path/.ok: \$(${module}_ok_deps)"
23 echo "$path/.fast-ok: \$(${module}_ok_deps:%.ok=%.fast-ok)"