Reputation: 3113
I want to do something like this
test.install:
export BUILD_NUMBER=${BUILD_NUMBER:-$${ANOTHER_VAR}}
but its not working. it always come as blank
EDIT:
This works fine. provided i export BUILD_NUMBER in shell before invoking make command
test.install:
export BUILD_NUMBER=${BUILD_NUMBER}
THese are not working . They both give blank BUILD_NUMBER
test.install:
export BUILD_NUMBER=${BUILD_NUMBER:-$${ANOTHER_VAR}}
and
test.install:
export BUILD_NUMBER=${BUILD_NUMBER:-55}}
Upvotes: 1
Views: 241
Reputation: 21038
If you want to expand variables in bash rather than in the makefile, you'll need to escape the expansion otherwise make is going to look for a variable literally called BUILD_NUMBER:-${ANOTHER_VAR}
or BUILD_NUMBER:-55
test.install:
export BUILD_NUMBER=$${BUILD_NUMBER:-$${ANOTHER_VAR}}
test.install:
export BUILD_NUMBER=$${BUILD_NUMBER:-55}}
Upvotes: 3