Add a very basic .gitignore
Moved common stuff into a separate makefile
Minor changes to improve readability
Also accept .git as a file in case we are a submodule

Also, the usage of REVISION_VERSION is a bit strange. It's much easier to
avoid redefining GIT_REV, so that we can use "make GIT_REV=foo" or
"GIT_REV=foo make".