【问题标题】:what is the proper way to use "include makefile"? [duplicate]使用“include makefile”的正确方法是什么? [复制]
【发布时间】:2012-05-27 07:46:21
【问题描述】:

可能重复:
Common GNU makefile directory path

阅读Recursive Make Considered Harmful 后,我决定在我的下一个项目中使用“include makefile”。我有一个主 Makefile,其中包含两个位于不同目录中的子 Makefile。问题是子makefile中的路径是相对于他的目录的,所以当我从主Makefile中包含它时,他找不到文件。有没有办法在不改变路径的情况下解决这个问题?

【问题讨论】:

标签: linux unix makefile


【解决方案1】:

虽然关于递归make和DAG树的文章是对的,但我大约半年前阅读了这篇文章并尝试使用其中描述的方法,发现递归make的“经典”方法更方便。考虑一下:

big_project
|--Makefile
|
|--sub_project_1
|  |--...
|  |--Makefile
|
|--sub_project_2
   |--...
   |--Makefile

当你从 big_project 项目目录运行 make 时,这很棒,但是,如果你按照文章中的建议进行操作,sub_project_x 目录中将没有 Makefile,因此你将无法分别对待每个子项目。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-12-06
    • 1970-01-01
    • 1970-01-01
    • 2019-09-30
    • 2016-09-03
    • 2020-03-12
    • 2012-07-25
    • 2018-05-10
    相关资源
    最近更新 更多