Reputation: 101
I want to "build" a command directly into my Makefile. I would need something like this:
# 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}
Then, make build
would be equivalent to:
path\to\command command 1 & path\to\command command 2 & path\to\command command 3 & wait
Upvotes: 0
Views: 182
Reputation: 6027
I assume you use GNU Makefile
.
In this case
CLUSTERS=1 2 3
COMMAND=$(subst &, &,$(addprefix path\to\command command,$(addsuffix &,${CLUSTERS}))
COMMAND+="wait"
build:
$(DOCKER_EXEC) ${COMMAND}
Upvotes: 1