Add .gitignore to ignore build files/dirs.

Make the ignore patterns in the .gitgnore file absolute to avoid
unintentional matches in subdirs.