1

I've this really simple make file:

run:
        test -f ./bin/alfred-proxy || wget "http://localhost:8081/1.0.26/my-binary-1.0.26.tar.gz
" -O /tmp/my-binary.tar.gz && tar xfvz /tmp/my-binary.tar.gz
        go build && ./my-awesome-binary

I want to move the version 1.0.26 to a variable so that I can change it easily in future and it's not part of the long command. How can I accomplish that?

2

Variables in makefiles are pretty straight forward:

version = 1.0.26
run:
        test -f ./bin/alfred-proxy || wget "http://localhost:8081/$(version)/my-binary-$(version).tar.gz
  • 1
    Thanks @Stephen, I was defining it under run: block and hence the issue. – Abhijeet Rastogi Mar 31 '17 at 2:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.