在GNU make中,您可以执行以下操作.想象一下,你想生成.h并.cpp从简单的文件名,文件名不带扩展添加一些规则的来源.你可以写:
define h_and_cpp_sources
$(1).h $(1).cpp
endef
Run Code Online (Sandbox Code Playgroud)
这将生成一个Makefile宏,该宏获取第一个参数$(1),第二个$(2),等等.然后:
target: $(call h_and_cpp_sources,file)
...
Run Code Online (Sandbox Code Playgroud)
这将构建规则:
target: file.h file.cpp
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4739 次 |
| 最近记录: |