Moving test building logic to outer Makefile.