我想"建立"一个命令直接进入我的Makefile。 我需要这样的东西:
# Makefile
CLUSTERS: 1 2 3
build:
COMMAND=""
for cluster in $(CLUSTERS) ; do \
COMMAND+=$(shell echo "path\to\command command "$$cluster" & ") ; \
done
COMMAND+=$(shell echo "wait")
$(DOCKER_EXEC) ${COMMAND}
然后,make build
相当于:
path\to\command command 1 & path\to\command command 2 & path\to\command command 3 & wait
答案 0 :(得分:1)
我假设你使用GNU Makefile
。
在这种情况下
CLUSTERS=1 2 3
COMMAND=$(subst &, &,$(addprefix path\to\command command,$(addsuffix &,${CLUSTERS}))
COMMAND+="wait"
build:
$(DOCKER_EXEC) ${COMMAND}