Perhaps it's something that I'm getting wrong. Basically my task is to use make
to automate a build, deploy, starting, stopping of different services.
One of the things that I'm trying to do is to have a variable as a target prerequisite, however that variable has to be changed in another target.
Here's a basic sample of what I'm trying to do:
IMAGE_COUNT=-1
count_images:
$(eval IMAGE_COUNT=5)
_should_build: $(if $(findstring $(IMAGE_COUNT),0), build,)
build:
...some procedure to build...
start: _should_build
...some procedure to start a service...
Obviously the $(IMAGE_COUNT)
in _should_build
check will stay as -1, but what I want is to have the $(IMAGE_COUNT)
become a 5 during the prerequisite check. A thing to note is that I cannot place the counting of images outside the count_images
target.
Does anyone know if this is possible at all?