#!/bin/sh
# $UFP$

if [ "${1}" != base -a "${1}" != localbase -a "${1}" != poudriere -a "${1}" != synth ]; then
  echo "Usage: $0 <base|localbase|poudriere|synth>" >/dev/stderr
  exit 69
fi

l="0 1 2 3 4 5 6 7 8 9 a b c d e f"

for a in ${l}; do
  for b in ${l}; do
    subdirs="${subdirs} ${a}/${b}"
  done
done

parallel "cd /var/cache/ccache/${1}/{}; find . -type f | xargs rm --" ::: ${subdirs}

export CCACHE_DIR=/var/cache/ccache/${1}

ccache -c
ccache -z

# EOF
