本文介绍了可以使用doxygen来记录makefile模板并包含* .mk文件界面吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一些makefile模板,通过设置一些参数makefile变量来实现某些构建操作,并通过包含如

应用一个makefile模板 GENERIC_PARAM1-y:= paramA 
GENERIC_PARAM2-y:= paramB

包含$(MAKE_TOOLS)/doaction.mk

doaction.mk 这样的文件包含make模板来生成标准规则定义,包括操作步骤。



现在我们要使用doxygen来为 *。mk 片段记录这些接口

  ## @file 
## @brief doaction.mk旨在...
# #
##有关规则应用的一些更详细的描述...
## @param GENERIC_PARAM1-y Parameter1描述...
## @param GENERIC_PARAM2-y Parameter2 description ...

有没有一种简单的方法来实现这一点,使用任何有效的doxygen语法/配置at /?

解决方案

是的,您可以使用doxygen的 INPUT_FILTER FILE_PATTERNS FILTER_SOURCE_FILES 配置设置



将这些设置放在您的 Doxyfile 配置中

  FILE_PATTERNS = * .mk 
INPUT_FILTER =sed -e's | ## | //!|'
FILTER_SOURCE_FILES = YES

INPUT_FILTER 实际上是诀窍, sed 命令是由doxygen用来打开管道沿着指定的命令过滤输入文件。



注意:

上述m引用的命令不嵌入到shell中,因此链接的命令语句如

 grep'##' sed -e的| ## | //!|'

将无法正常工作。 / p>




根据建议的样例 ## 将您的意见扩大对于doxygen看到的评论

  ## @file 
## @brief doaction.mk旨在...
##
##有关规则应用的一些更详细的描述...
## @param GENERIC_PARAM1-y Parameter1 description ...
## @param GENERIC_PARAM2-y Parameter2描述...

此外,你应该放一个

  ## @cond 
...
## @endcond

围绕你的makefile规则/模板代码,以避免doxygen解析这些部分。



上面的示例应该在生成的文档HTML




We have a number of makefile templates, that realize certain build actions by setting a few parameter makefile variables, and applying a makefile template via inclusion like

GENERIC_PARAM1-y := paramA
GENERIC_PARAM2-y := paramB

include $(MAKE_TOOLS)/doaction.mk

And files like doaction.mk contain make templates to generate standard rule definitions that are applied when just including the action make step.

Now we want to document these interfaces for the *.mk snippets using doxygen like

## @file
## @brief doaction.mk is purposed to ...
## 
## Some more detailed descriptions about rules applied ...
## @param GENERIC_PARAM1-y Parameter1 description ...
## @param GENERIC_PARAM2-y Parameter2 description ...

Is there a simple way to achieve this using any valid doxygen syntax/configuration?

解决方案

Yes, you can use doxygen's INPUT_FILTER, FILE_PATTERNS and FILTER_SOURCE_FILES configuration settings as stolen from this blog post

Put these settings in your Doxyfile configuration

FILE_PATTERNS = *.mk 
INPUT_FILTER = "sed -e 's|##|//!|'" 
FILTER_SOURCE_FILES = YES 

The INPUT_FILTER actually does the trick, the sed command is used by doxygen to open a pipe filtering the input files along the specified command.

Note:
The above mentioned command isn't embedded into a shell, thus chained command statements like

"grep '##' | sed -e 's|##|//!|'"

won't work.


Put your comments as proposed in the sample ## will expand for comments seen by doxygen

## @file
## @brief doaction.mk is purposed to ...
## 
## Some more detailed descriptions about rules applied ...
## @param GENERIC_PARAM1-y Parameter1 description ...
## @param GENERIC_PARAM2-y Parameter2 description ...

Additionally you should put a

## @cond
...
## @endcond

around your makefile rules/templates code, to avoid doxygen parsing these parts.

The above sample should render as follows in the generated documentation HTML

这篇关于可以使用doxygen来记录makefile模板并包含* .mk文件界面吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-16 21:11