Artificial intelligent assistant

Pass a Make variable to Bashscript that is invoked from inside Make In a pattern rule I would like to export `make` variable like `$(TargetLocation)`, `$@`. I tried the following but It didn't get exported. The bash script is executable. export $(TargetLocation); \ export $@; \ ./EditHtml.sh; I also tried this (I have used `${VarA}` instead of `${TargetLocation}` inside bash script), but it didn't get exported: ./EditHtml.sh VarA=$(TargetLocation); \ I would like to use these variables in the Bash script. Any suggestions?

You need to export the variable name, not the value.

You can either export the name for all sub processes with the GNU Make `export` statement


export TargetLocation


If you want the value just for one rule, then your statement must be regular shell syntax


export TargetLocation="$(TargetLocation)"; \
./EditHtml.sh


In this case, depending on the content of the variable, quotes may be necessary, and it would still be vulnerable if there may be arbitrary values for the variable. On the other hand, if make runs with the privileges of the invoking user, there is no additional danger.

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy 7a5f2acd4806de6af6a4890637c79da7