makefile - 递归 Makefile 总是重新制作目标
问题描述
我正在尝试创建一个 Makefile 目标,该目标将使用不同的选项调用自身。
# Include config.mk which sets design-specific variables
`include $(CONFIG)
# This command runs the script once with current options
$(LOG_DIR)/compare.log: $(RESULTS_DIR)/final.bin
tclsh $(UTILS_DIR)/script.tcl | tee $@
# Alias for above command
compare: $(LOG_DIR)/compare.log
# This command runs make once for each config file
.PHONY: compare_all
compare_all:
for config in designs/*/config.mk; do \
$(MAKE) CONFIG=$$config compare; \
done
$(UTILS_DIR)/compare_all.py
问题是compare_all
目标按预期工作,但它总是认为 sub-make 目标已过时。
例如,当我跑步时
make CONFIG=designs/a/config.mk compare
make CONFIG=designs/b/config.mk compare
make CONFIG=designs/c/config.mk compare
我得到:
make: Nothing to be done for 'compare'.
make: Nothing to be done for 'compare'.
make: Nothing to be done for 'compare'.
但是当我跑步时make compare_all -n
,我得到
tclsh utils/script.tcl | tee logs/a/compare.log
tclsh utils/script.tcl | tee logs/b/compare.log
tclsh utils/script.tcl | tee logs/c/compare.log
表明它将重建所有设计,即使它们已经是最新的。
解决方案
推荐阅读
- ssh - 使用给定公钥添加操作系统用户的更好方法是什么?Terraform 与 Packer
- prestashop - 从 ps_image_lang 中删除记录
- dnspython - DNS Python,使用'relativize',但防止用'@'替换全名
- angular - 点击时只显示与点击标题相关的内容,而不是全部打开
- java - 静态变量和参数同名
- yaml - 如何使用索引引用 helm 数组参数
- python - os.path.abspath(__file__) 显示的路径与实际路径不同
- javascript - 如何确保父级将填充的道具传递给VueJS中的子组件
- arcgis - 如何在 ArcGIS REST 服务的特定距离内获取给定纬度、经度的数据?
- keras - 添加的图层必须是图层类的实例。成立: