how to generate a makefile into a specific folder?

I’m trying to generate the eclipse makefile in the same folder I have my /src
I want to have a structure like this:

[path-to-project]/makefile (and others .mk)

But eclipse generates:
[path-to-project]/Release/src (objects…)

I want it because I’m using a repository and I just want to do a checkout/update in other computer and to do a ‘make all’ and get executable ready to run without eclipse.

So, I want a simple folder structure in my repository:


I’ve tried to change the build directory to a specific one, but it doesn’t work.

make all 
make: *** No rule to make target `all'.  Stop.

I’ve also tried many other things without success.

Do you have any idea?
Thank you very much.

Note that the reason for Release/Debug subfolders is to make sure different build modes results do not get intermixed (e.g. so you don’t get some object files with debug symbols and others without - that would really mess up debugging). Also note that Nsight will regenerate Makefiles every time you build the project - that might result in bogus changes in your VCM. As a rule of thumb, you should not commit generated artifacts to the VCM.

Having said that, I would like to suggest you create a custom Makefile in the project root folder that will invoke make in the subfolder, e.g. “make -C Debug -f makefile”

This way you will also be able to create different targets - e.g. (this is not an example suitable for copy/pasting - it has spaces instead of tabs, targets not marked as phony, etc.):

@echo Building debug configuration
make -C Debug -f makefile

@echo Building release configuration
make -C Release -f makefile

Thank you very much! I’ve been trying some other things, but finally I’ve decided to do that you said. I’ll add Debub/Release structure to the repository in order to have the needed .mk files.