do not build test programs by default

The test binaries are used when you run `make check`, so change the code
so they're only built when you run that target.  It doesn't make sense
to always compile these when you run plain `make`.