Search code examples
makefilenmake

How to use wait in MAKEFILE when I use it through NMAKE in windows


I'm not familiar with MAKEFILE and trying to figure out how to wait between destroy and deploy for 2 seconds.

It looks like NMAKE has very limited resource on internet and the one I found sleep 2 throws 'sleep' is not recognized as an internal or external command, operable program or batch file.

I'm working on WINDOWS not LINUX.

REGISTRY=registry.cengiz.dev
IMAGE=cengiz.geocode.host
TAG=latest

MARATHON=http://mesos.cengiz.dev/v2/apps/geocode
PAYLOAD=Marathon_geocode.json

.PHONY: deploy

push:
    docker push $(REGISTRY)/$(IMAGE):$(TAG)

destroy:push
    curl -X DELETE $(MARATHON)
    echo Waiting
    sleep 2

deploy:destroy
    curl -X PUT -H "Content-Type: application/json" $(MARATHON) -d@$(PAYLOAD)

Solution

  • Try the timeout command:

    timeout 3
    

    Note that I intentionally wrote 3 to assure that two seconds passed (instead of 2: the current second will pass and then another one). See more about it in here.