为什么makefile目标始终运行?
Makefile:
OUTPUT_ILA = "path/file"
OUTPUT_ILA = "path/file"
all: syn ila opt ...
$(OUTPUT_SYN): $(INPUT_SYN)
@echo "syn"
...
$(OUTPUT_ILA): $(OUTPUT_SYN)
@echo "ila"
...
$(OUTPUT_OPT): $(INPUT_OPT)
@echo "opt"
...
syn: $(OUTPUT_SYN)
ila: $(OUTPUT_ILA)
opt: $(OUTPUT_OPT)
...
不了解为什么总是执行步骤ila.当$(OUTPUT_SYN)不变并且ila之前运行时,make仍会运行ila步骤.
预期的行为是仅在第一步更改$(OUTPUT_SYN)时才运行.如果$(OUTPUT_SYN)不变,则应跳过ila并运行opt.
如何调试和解决此问题?
Don't understand why step ila is always run. When $(OUTPUT_SYN) is unchanged and ila run before, make still runs ila step.
The expected behavior is ila to only run when, in the first step, $(OUTPUT_SYN) is changed. If $(OUTPUT_SYN) is unchanged, it shall skip ila and run opt.
How to debug and fix this?
由于您没有提供有关变量的值或配方的作用的任何信息,因此我们几乎无法告诉您原因.
Since you don't provide any information about what the value of the variables are, or the what the recipes do, there's little we can tell you about why.
但是,请注意,如果配方的目标不存在,则该配方将始终运行(必须这样做,因为make无法确定其是否过时).因此,如果您的$(OUTPUT_ILA)
目标配方没有创建由变量OUTPUT_ILA
命名的文件(无论扩展为什么),那么该配方将始终运行.
However, note that if the target of a recipe does not exist then the recipe is always run (it has to be, since make cannot determine if it's out of date or not). So, if your recipe for the $(OUTPUT_ILA)
target does not create the file named by the variable OUTPUT_ILA
(whatever that expands to) then this recipe will always be run.
使用另一种方法,如果您希望它能正常工作,则应确保该食谱更新了由自动变量$@
指定的文件.
Put another way, you should make sure that the recipe updates the file specified by the automatic variable $@
, if you want it to work properly.