(自动)跨多个 makefile 建立依赖关系
我想知道这是否可能。情况如下:
我的项目使用 automake 来构建其目标。顶层目录包含常见的 configure.ac
和 Makefile.am
。其中,Makefile.am
包含一个 SUBDIRS
变量,列出了子目录,对我的问题来说重要的是 doc
和 include目录。
include
目录的 makefile 如下所示:
nobase_include_HEADERS = <lot-of-headers>
所以它基本上安装了标头。 doc
中的 makefile 应该从这些文件中生成 html 文档:
doxygen-stamp: Doxyfile
$(DOXYGEN) $<
echo "timestamp for Doxyfile" > $@
all-local: doxygen-stamp
到目前为止一切正常,但如果我更改 include
中的任何标头,文档仍然有效-迄今为止 - 因为我没有将它们列为依赖项。我想要的是有一个 doxygen-stamp
目标,一旦标头更改,就会重建而不再次将所有标头列为依赖项。这可能吗?如果可能的话,如何实现?
I am wondering if this is possible at all. Here is the situation:
My project uses automake to build its targets. The top-directory contains the usual configure.ac
and Makefile.am
. Amongst others, the Makefile.am
contains a SUBDIRS
variable listing the subdirectories, important for my question is the doc
and include
directory. The include
directory's makefile looks like:
nobase_include_HEADERS = <lot-of-headers>
so it basically installs the headers. The makefile in doc
is supposed to generate html documentation out of those files:
doxygen-stamp: Doxyfile
$(DOXYGEN) lt;
echo "timestamp for Doxyfile" > $@
all-local: doxygen-stamp
Everything works fine so far, but if I change any of the headers in include
the documentation is still up-to-date - because I did not list them as dependencies. What I would like to have is to have a doxygen-stamp
-target that is rebuilt once the headers change without again listing all headers as dependencies. Is that possible and if it is, how?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在这种情况下,将提示使用单个 Makefile — 尽管您可以使用 automake
include
指令将其拆分(另请参阅 am 手册的第 7.3 节“子目录的替代方法”) 。所以:In this case, using a single Makefile would be hinted at — though you can split it up by using the automake
include
instruction (also see section 7.3 "An alternative approach to subdirectories" of the am manual). Therefore:我认为,如果您使 doxygen-stamp 也依赖于 '$(top_srcdir)/include/*.h' (或 .hpp 或其他),当 doxygen-stamp 相对于包含中的任何 .h 文件已过时时,它将重建目录。
I think if you make doxygen-stamp also depend on '$(top_srcdir)/include/*.h' (or .hpp or whatever) it will rebuild when doxygen-stamp is out of date relative to any .h file in the include directory.