更新 makefile 标签中的变量
我有 C++ 静态库和使用它们的可执行文件,每个库都位于一个单独的文件夹中。当文件层次结构如下所示时,每个此类项目都可以在调试或发布配置中构建: Static_Lib1\Debug\staticlib1.a
Static_Lib1\Release\staticlib1.a
//对于所有其他静态库都相同
可执行文件\调试\可执行文件
Executable\Release\executable
所有 Debug 和 Release 文件夹都包含 makefile。
我正在尝试编写一个外部 makefile 来使用选定的配置 - 调试或发布来调用每个内部项目。
所以,我尝试了类似的操作:
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;)
但是当我尝试运行 make debug
时,我得到了这个输出:
CFG = Debug
make: CFG: Command not found
make: *** [debug] Error 127
我该如何解决这个问题?
我的操作系统是 SLED 11x64。
先感谢您!
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\executable
All 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!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
将其更改为:
Change it to: