That's because your syntax isn't quite right. Try this:

Code:
obj_files/AP_commons.o: AP_commons.cpp
   g++ AP_commons.cpp -g -O2 -Wall -MT obj_files/AP_commons.o -MD -MP -MF
"./obj_files/AP_commons.Tpo" -c
You can't specify where to compile to in the compile line itself, instead you tell it what output file the compile line belongs to.

The syntax for compiling only goes:
Code:
Target: All dependancies (including libraries)
   compiler command