The following is the Makefile i use. All is well, except for .o should be created in obj/ directory and it’s not.
What am i doing wrong please?

After making sure that
- src directory contains a.cpp
- target directory exists and is empty
- obj directory exists and is empty
When make is ran, i see
g++ -pedantic -Wall -c src/a.cpp -o /Users/me/Dropbox/dev/c++/hott/obj/src/a.o
when it should be
g++ -pedantic -Wall -c src/a.cpp -o /Users/me/Dropbox/dev/c++/hott/obj/a.o
What am i doing wrong please?
UPDATE: Nothing seems to change when hardcoding path and not relying on pwd resolution
If you use
-oyou have to specify the filename, not just the output path. Try:This question may help, too:
Also, you may want to call
FLAGSsomething likeCFLAGS, meaning “the flags for compilation”.Edit
Note that you are not using make efficiently, because you are always recompiling all your .o files from your .cpp files. You should instead use a Pattern Rule, so that Make can have rules to only build what is necessary. (ie. “To build any .o file from a .cpp file, do this: ___”)
You could edit this to include
$(OBJ)before the$@.