It's undoubtedly not the right way, but I patched lib/Makefile.in.
The basic problem in lib I think is twofold:
1) chartable.c being dynamically built during make, so it's
not there when the makedepend is run
2) cyrusdb_quotalegacy.c including glob.h, which has a name
collision with a similar Cyr
After hours of struggle, I am abandoning this and switching to
simply having my script unpack the tarball into /tmp and
compile it there. Every time I found some fix for one
piece there was another one that needed fixing. Like in
the sieve dir there is the xversion.sh that creates an xversion.h.
I have a repository copy of the cyrus source, and build in an 'lndir'-
d tree. Sadly, while building-outside-the-source tree should work
fine, every once and awhile you run into gotchas like this which
aren't work the time tracking down. lndir symlink trees give you
almost the same functi