I've the following makefile:
.ONESHELL:
SHELL := /bin/bash
build-%:
@[ $(findstring -, $*) ] && DIR_ENV=$(subst -,/,$*) || DIR_ENV=$*
@echo ${DIR_ENV}
I'm trying to have available the DIR_ENV but without no luck. I know that every command executed is executed in its own shell so no sharing of variavbles. However I've added ONESHELL directive. But it still doesn't work. What am I'm missing?
DIR_ENVavailable in other commands withing that rule, or in other rules? 2) Which version of Make are you using? 3) What happens when you put theechocommand in the first line (e.g.DIR_ENV=foo; echo ${DIR_ENV})? 4) have you tried doubling the '$' (echo $${DIR_ENV})?