Modify the Makefile so that gtest is successfully rebuilt on Ubuntu

Still preserve functionality on systems which just link against a prebuilt gtest (e.g. Fedora). Tested on Ubuntu 14.04 and Fedora 20.