导入使file进口时不会发生可变扩展
我有一个带有一些变量带有变量扩展的shell脚本:
$ cat version
#!/bin/bash
export GIT_TAG=`git describe --tags --always --dirty`
export BUILD_NUM=${TRAVIS_BUILD_NUMBER:-${GIT_TAG}}
export VERSION="0.1.${BUILD_NUM}"
然后,我正在尝试将变量导入makefile:
$ cat Makefile
MAKEFLAGS += --warn-undefined-variables
include version
all:
@echo $(VERSION)
但是,似乎变量扩展似乎不起作用:
$ make
Makefile:5: warning: undefined variable `TRAVIS_BUILD_NUMBER:-`git describe --tags --always --dirty`'
version:16: warning: undefined variable `TRAVIS_BUILD_NUMBER:-`git describe --tags --always --dirty`'
version:13: warning: undefined variable `TRAVIS_BUILD_NUMBER:-`git describe --tags --always --dirty`'
0.1.
有什么建议吗?
I have a shell script with some variables w/ variable expansions:
$ cat version
#!/bin/bash
export GIT_TAG=`git describe --tags --always --dirty`
export BUILD_NUM=${TRAVIS_BUILD_NUMBER:-${GIT_TAG}}
export VERSION="0.1.${BUILD_NUM}"
Then I'm trying to import the variables into a Makefile:
$ cat Makefile
MAKEFLAGS += --warn-undefined-variables
include version
all:
@echo $(VERSION)
However it seems variable expansion isn't working:
$ make
Makefile:5: warning: undefined variable `TRAVIS_BUILD_NUMBER:-`git describe --tags --always --dirty`'
version:16: warning: undefined variable `TRAVIS_BUILD_NUMBER:-`git describe --tags --always --dirty`'
version:13: warning: undefined variable `TRAVIS_BUILD_NUMBER:-`git describe --tags --always --dirty`'
0.1.
Any suggestions?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论