External makefile for calling Eclipse CDT generated makefile - according to Debug \ Release config

I use Eclipse CDT on Linux to create a C ++ executable and several static libraries that the executable depends on. All is well - Eclipse generates makefiles for both Debug and Release, as expected.

However, I want to compile this code on the computer without installing Eclipse, so I thought to write a simple makefile that calls the Eclipse makefile.

So, I started with something like:

all:  
cd Lib1/Release && make all  
cd Lib2/Release && make all  
...  
cd Exec/Release && make all

This only works for Release, as you can see ...

How to modify makefile so that I can use the selected user configuration?

Many thanks.

+3
source share
1 answer

makefile "make debug" "make release" :

config:
    cd Lib1/$(CONFIG) && make all
    ...
    cd LibN/$(CONFIG) && make all
    cd Exec/$(CONFIG) && make all
debug:
    make config CONFIG=Debug 
release:
    make config CONFIG=Release
.PHONY: debug release config
0

Source: https://habr.com/ru/post/1787399/


All Articles