Update variables within makefile label
I have C++ static libraries and executable that uses them, each one is in a seperate folder. Each such project can be built in Debug or Release configuration, when the files hierarchy is like the following: Static_Lib1\Debug\staticlib1.a
Static_Lib1\Release\staticlib1.a //same for all other static libraries Executable\Debug\executable Executable\Release\executableAll Debug and Release folders contain makefiles.
I'm trying to write an external makefile to call each one of the internal projects, using the selected configuration - debug or release. So, I tried something like:CFG= #empty declaration
PROJECTS=Static_Lib1 Static_Lib2 ... Executable
all:
release #default config is release
release:
CFG = Release
make build-all
debug:
CFG = Debug
make build-all
build-all:
make clean
$(foreach projectName, $(PROJECTS), cd $(projectName)/$(CFG) && make all;)
But I get this output when trying, for example, to run make debug
:
CFG = Debug
make: CFG: Command not found
make: *** [debug] Error 127
How can I fix this?
开发者_开发技巧 My OS is SLED 11x64.Thank you in advance!
Change it to:
...
release:
make CFG=Release build-all
debug:
make CFG=Debug build-all
...
精彩评论