我做错了什么?
VAR := $(INIT_DIR)
update_var:
for com in $(COMS); do
instances="`grep -rl $$com $(SOME_PATH) | wc -l`";
if (([ $(SOME_STRING) != $$com ])) && (([ $$instances -gt 0 ])); then
$(eval VAR+=$($(DIR)/$$com))
fi;
done
.PHONY: update_var
我得到这个错误:/bin/sh:5:语法错误:"fi";意外
这是我的解决方案:
INSTANCES = $(shell grep -rl ${1} $(SOME_PATH) | wc -l)VAL
VAR += $(foreach COM,$(COMS), $(if $(filter-out $(COM),$(SOME_STRING)), $(if $(filter-out $(call INSTANCES, $(COM)),0VAL), (DIR)/$(COM))))