Use the correct compiler to compute dependencies.

This uses $(CXX) instead of $(CC) to generate the .d files for tests built
with Makefiles.