c++ - 调用 Eclipse CDT 生成的 makefile 的外部 makefile - 根据 Debug\Release 配置

标签 c++ debugging makefile release eclipse-cdt

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

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

所以我从这样的事情开始:

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

如您所见,这仅适用于 Release...

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

非常感谢。

最佳答案

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

关于c++ - 调用 Eclipse CDT 生成的 makefile 的外部 makefile - 根据 Debug\Release 配置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4780202/

相关文章:

java - 在 Java 中使用 C++ 函数

node.js - 调试 jhipster 模块

php - 将点均匀分布在 map 上的矩形上(调试)

makefile - 将参数从 makefile 传递到 cocotb 测试平台

c++ - DLL 注入(inject)在目标进程中不起作用

c++ - 如何获取QFileDialog的最新历史路径

c++ - 如何在 Arduino serial read() 上将 char 转换为 int?

xcode - iOS:调试在 XCode 中不起作用

c++ - makefile 未从 -I 包含路径中找到头文件

c - C 中的 Makefile 错误