【问题标题】:Makefile process different files in different stepsMakefile 在不同的步骤中处理不同的文件
【发布时间】:2015-02-28 20:12:03
【问题描述】:

我有以下使用 GNU 自动工具的 makefile:

AUTOMAKE_OPTIONS = subdir-objects

bin_PROGRAMS = app

app_SOURCES = \
    core/main.cpp

nodist_app_SOURCES = \
    index.cpp \
    index.ecpp.js.cpp

AM_INCLUDES = -I$(top_srcdir)/src

index.cpp: index.ecpp
    $(ECPPC) index.ecpp -o index.cpp

index.ecpp.js.cpp: index.ecpp.js
    $(ECPPC) -b index.ecpp.js

index.ecpp:
    vulcanize -o index.ecpp core/view/index.html --inline --strip --csp

会发生什么(在这种情况下仅针对 index.html):

  • vulcanize 从 .html 文件中创建一个 .ecpp 和一个 .ecpp.js 文件
  • 这些新创建的文件由 ecppc 编译器编译为 .cpp 文件
  • 创建的 .cpp 文件是用 g++ 编译的

我有很多 .html 文件需要处理,我该如何处理?

【问题讨论】:

  • 试试通配符吧?

标签: c++ makefile gnu autotools tntnet


【解决方案1】:

您可以使用Suffix rulesPattern rules。在您的情况下,两者都应该同样出色地完成工作。

唯一的区别是 Pattern 规则是 GNU-Make 特定的(与 Unix make 不兼容),尽管我链接到的 GNU 手册不鼓励使用 Suffix 规则,可能是因为它可能的用例受到更多限制比那些模式规则。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-04-28
    • 1970-01-01
    • 2022-10-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-26
    • 1970-01-01
    相关资源
    最近更新 更多