This code uses a trivial function to illustrate adding tests and collect statement coverage with makefiles. To use this in Linux, you will need
sudo apt-get install -y libgtest-dev lcov
cd /usr/src/gtest
sudo cmake CMakeLists.txt
sudo make
sudo cp *.a /usr/lib
The files:
make -f SmallerMakefile
(or simply rename it to Makefile)