Use the -o option in conjunction with -c.
-o
-c
exptrtest.o: exprtest.cpp g++ -Wall -g -c exprtest.cpp -o exptrtest.o