Makefile updates

The main points of these changes are:
 - easier cross-compiling
 - ability to set one's own flags without overwriting ones that are needed, e.g. `make CXXFLAGS='-O2'`
 - using standard make variables