Reverting Makefiles changes and some test_caffe_main.cpp changes