【问题标题】:External makefile to call Eclipse CDT's generated makefile - according to Debug\ Release config调用 Eclipse CDT 生成的 makefile 的外部 makefile - 根据 Debug\Release 配置
【发布时间】:2011-06-14 09:23:58
【问题描述】:

我在 Linux 上使用 Eclipse CDT 来构建一个 c++ 可执行文件和几个可执行文件所依赖的静态库。 一切都很好 - Eclipse 按预期生成 Debug 和 Release 的 makefile。

但是,我也想在没有安装 Eclipse 的计算机上编译这段代码,所以我想写一个简单的 makefile 来调用 Eclipse makefile。

所以我从以下内容开始:

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

如您所见,这仅适用于发布...

如何更改 makefile 以便可以使用所选用户的配置?

非常感谢。

【问题讨论】:

  • 为什么不写两个脚本,比如build-dbgbuild-rel?还是一个获得输入的脚本?

标签: c++ debugging makefile release eclipse-cdt


【解决方案1】:

在您的 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

【讨论】:

    猜你喜欢
    • 2011-05-18
    • 2016-01-27
    • 2016-11-19
    • 1970-01-01
    • 2021-06-09
    • 1970-01-01
    • 2014-12-07
    • 1970-01-01
    • 2011-04-29
    相关资源
    最近更新 更多