Replaced the harcoded g++ with $(CXX) in Makefiles