Linux

導出 Makefile 參數

  • March 8, 2022

如何將導出的值更改為參數傳遞的值?

生成文件:

default_value=Default-Value
export ENV_VALUE=default_value

build:
     python3 script.py

執行:

$ make build
python3 script.py
ENV_VALUE: default_value
script executed.!
$ make build default_value=modified_value
python3 script.py
ENV_VALUE: default_value
script executed.!
export ENV_VALUE="$(default_value)"

引用自:https://unix.stackexchange.com/questions/693606