In my application folder A, there are 3 source directories B,C and D. Folder B contains 1.cpp,2.cpp,3.cpp.
FOlder C contains 4.cpp,5.cpp,6.cpp. I have written makefile for my application which is in Application folder A. I am also having the makefiles for each subdirectories as well means makefileA in folder A and makefileB in folderB.
The makefile in folder A is my main application make file.
Now When you give make from A the corresponding folders source files get complied and the .o files for B folder are generated as 1.o,2.o,3.o in B folder itself.Similarly, for C folder the .o files 4.o,5.o,6.o are generated in C folder only.
Now My requirement is the generation of .o files should be in Folder D instead of getting generated in Folders B and C.
The Folder D should have 1.o,2.0,3.o,4.o,5.o,6.o and the .o files should not be present in Folders B and C.
Solution1:
=========
Add the following line in makefile for Folder B and also in makefile for Folder C
mv *.o A/B/C/D(path where .o should be generated/redirected)
Problem with Solution1:
=======================
Solution1 works but when you do changes only in one source file,for example 2.cpp, instead of compiling only 2.cpp, it compiles all the files 1.cpp,2.cpp,3.cpp,4.cpp,5.cpp,6.cpp.This is the problem what iam facing.
Could you please suggest an efficient solution.