Check whitespace

This PR adds a lint check for:
 * Trailing empty lines
 * No newline at end of file
 * CR characters
 * Trailing whitespace

The reason for checking this is that whitespace differences add unnecessary lines to diffs and patches (e.g. adding or removing a newline at the end of a file). In extreme cases some editors will modify every line of a file (e.g. by adding Windows-style `\r\n` line endings). By including the whitespace check as part of the `lint` target, we'll catch these errors very quickly.