makefile: refactor ccache use

Signed-off-by: Dan Trifan <jimsth@gmail.com>