【问题标题】:GNU make automatically deletes precompiled headerGNU make 自动删除预编译头文件
【发布时间】:2012-09-27 09:49:20
【问题描述】:

我正在尝试使用 gmake 和 GCC 获取预编译头文件以加快构建速度。 .gch 文件已创建,但由于某种原因,它会在构建完成后立即自动删除。

以下是相关规则:

cxx_pch := ./bin/analysis.h.gch

bin/%.cpp.o: src/%.cpp $(cxx_includes) $(cxx_pch)
    $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(cxx_include_paths) -H -c -o $@ $<

bin/%.gch: src/pch/%
    $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(cxx_include_paths) -I./src -x c++-header -o $@ $<

我构建时打印的最后一件事是:

rm bin/analysis.h.gch

我的规则不可能做到这一点; clean 只做rm -r $(output_dir)

【问题讨论】:

  • 而且,当您使用make -d 时,您会看到什么?

标签: gcc gnu-make precompiled-headers


【解决方案1】:

将其标记为 .PRECIOUS:.SECONDARY: 以防止 Make 将其作为中间目标进行清理。另见http://www.gnu.org/software/make/manual/html_node/Special-Targets.html

【讨论】:

  • 成功了。抱歉耽搁了,几分钟前我会接受这个但不得不等待构建:vP
猜你喜欢
  • 2011-05-27
  • 2018-05-06
  • 2017-10-16
  • 2014-07-08
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多