(自动)跨多个 makefile 建立依赖关系

发布于 2024-12-25 04:02:46 字数 748 浏览 4 评论 0原文

我想知道这是否可能。情况如下:

我的项目使用 automake 来构建其目标。顶层目录包含常见的 configure.acMakefile.am。其中,Makefile.am 包含一个 SUBDIRS 变量,列出了子目录,对我的问题来说重要的是 docinclude目录。 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

恏ㄋ傷疤忘ㄋ疼 2025-01-01 04:02:46

在这种情况下,将提示使用单个 Makefile — 尽管您可以使用 automake include 指令将其拆分(另请参阅 am 手册的第 7.3 节“子目录的替代方法”) 。所以:

#can't use nobase_
include_HEADERS = include/foo.h include/bar.h

doc/doxygen-stamp: ${include_HEADERS}

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:

#can't use nobase_
include_HEADERS = include/foo.h include/bar.h

doc/doxygen-stamp: ${include_HEADERS}
阪姬 2025-01-01 04:02:46

我认为,如果您使 doxygen-stamp 也依赖于 '$(top_srcdir)/include/*.h' (或 .hpp 或其他),当 doxygen-stamp 相对于包含中的任何 .h 文件已过时时,它将重建目录。

doxygen-stamp: Doxyfile $(top_srcdir)/include/*.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.

doxygen-stamp: Doxyfile $(top_srcdir)/include/*.h
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文