gnu makefile目标中的默认env变量如何
How can default env variable in gnu makefile target
我想做这样的事情
test.install:
export BUILD_NUMBER=${BUILD_NUMBER:-$${ANOTHER_VAR}}
但它不起作用。它总是空白
编辑:
这很好用。如果我在调用 make 命令
之前在 shell 中导出 BUILD_NUMBER
test.install:
export BUILD_NUMBER=${BUILD_NUMBER}
这些不起作用。他们都给空白 BUILD_NUMBER
test.install:
export BUILD_NUMBER=${BUILD_NUMBER:-$${ANOTHER_VAR}}
和
test.install:
export BUILD_NUMBER=${BUILD_NUMBER:-55}}
如果你想在 bash 中而不是在 makefile 中扩展变量,你需要转义扩展,否则 make 将寻找一个字面上称为 BUILD_NUMBER:-${ANOTHER_VAR}
或 BUILD_NUMBER:-55
test.install:
export BUILD_NUMBER=$${BUILD_NUMBER:-$${ANOTHER_VAR}}
test.install:
export BUILD_NUMBER=$${BUILD_NUMBER:-55}}
我想做这样的事情
test.install:
export BUILD_NUMBER=${BUILD_NUMBER:-$${ANOTHER_VAR}}
但它不起作用。它总是空白
编辑:
这很好用。如果我在调用 make 命令
之前在 shell 中导出 BUILD_NUMBERtest.install:
export BUILD_NUMBER=${BUILD_NUMBER}
这些不起作用。他们都给空白 BUILD_NUMBER
test.install:
export BUILD_NUMBER=${BUILD_NUMBER:-$${ANOTHER_VAR}}
和
test.install:
export BUILD_NUMBER=${BUILD_NUMBER:-55}}
如果你想在 bash 中而不是在 makefile 中扩展变量,你需要转义扩展,否则 make 将寻找一个字面上称为 BUILD_NUMBER:-${ANOTHER_VAR}
或 BUILD_NUMBER:-55
test.install:
export BUILD_NUMBER=$${BUILD_NUMBER:-$${ANOTHER_VAR}}
test.install:
export BUILD_NUMBER=$${BUILD_NUMBER:-55}}