c++ - Linux编程中的多目录 "make"

标签 c++ c linux makefile

假设我们有一个文件列表:

  • 源代码
    • 一个
    • b
    • c
  • 生成文件

每个文件夹中都有很多.cc & .h 文件。 Makefile怎么写?

当我写这样的路径时 ./a/a.cc 或 ../a/a.cc

将会发生错误。

但是当我将文件放在同一目录中时 并写为 a.cc。 一切都好。

我在 cygwin 上运行它。 有人可以帮助我吗?

最佳答案

通配符函数就是您正在寻找的:http://www.gnu.org/software/make/manual/html_node/Wildcards.html

在 Linux 上,我更喜欢 Automake/Autoconf 构建系统:http://de.wikipedia.org/wiki/GNU_Build_System

替代方案可以是 CMake:http://www.cmake.org/

关于c++ - Linux编程中的多目录 "make",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10311122/

相关文章:

c - 查找线程堆栈大小

linux - 在 Mac OS X 上使用 AWK 拆分文件

linux - 在 coreos 上将容器暴露给互联网

带有终止符的 C++ switch case 计算器

c - 警告 : format %s expects type char * but argument 2 has type int

C++ 组合#define 和#ifndef 宏

c - mpi_comm_spawn 错误 : MPI Application rank 0 killed before MPI_Finalize() with signal 11

VI 中的 Python 测试代码

c++ - 找不到 `pthread_setaffinity_np'?

c++ - 如何使用结构作为模板编写 union ,同时将该 union 作为元素