Fix: stat ambiguous files as well as inputs.

As the item we're currently considering may end up being an input, we should
stat it just in case. This was observable as a bug when tracing gcc.
Avoid caching /proc and /dev.

A common pattern is to read from, /proc/meminfo to probe the setup of the
system. It makes no sense to cache things like this, so we avoid doing it.
Promote ADD_AS to a function.
Makefile: Add a target to statically link libxcache.