Updated Makefile to include a "check" target.

Also updated the build process for test to avoid rebuilding the test binaries if the sources remain unmodified.