gen_deps.sh 866 B

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