如何创建运行astyle的makefile规则?

时间:2011-09-06 14:52:54

标签: formatting makefile astyle

我想创建一个makefile规则来在任何可写源文件上运行astyle。目前,我有以下规则:

style:
  find . -perm -200 -regex ".*[.][CHch]p*" -exec astyle --suffix=none --style=ansi --convert-tabs "{}" \;

此规则基本上有效,但似乎不是 make 做事方式。

1 个答案:

答案 0 :(得分:1)

假设您有一个源文件列表(或者可以使用shell函数创建它们),例如:

style : $(SOURCES:.cpp=.astyle-check-stamp)
    astyle $(ASTYLEFLAGS) $< && touch $@

将是制作风格。它将使用astyle重新检查每个更改的源文件并跳过已检查的文件。