@cyysu
2017-10-16T09:58:34.000000Z
字数 1289
阅读 869
- 时间:2017年10月16日
- 作者:Kali
- 邮箱:cyysu.github.io@gmail.com
- 版本:3.0
- 描述:Makefile-基础四,为Linux 4.4 Makefile中所遇到的知识点汇总
Makefile系列教程
# makefile引用其他makefile中的变量,来看下面的例子
mj@DZ:~/桌面$ cat test/test.mk
SIGNAL = $(shell printf "\033[34;1m★\033[0m")
build=stringStrip
mj@DZ:~/桌面$ cat Makefile
SIGNAL = $(shell printf "\033[34;1m★\033[0m")
build=string
build2=Strip
PHONY := _all
include ./test/test.mk
xxx=$(build)
_all:
_all: $(xxx)
string: ;$(info $(SIGNAL) build $@ goal)
@echo "前:" $(string1)
@echo "后:" $(string2)
stringStrip: ;$(info $(SIGNAL) build $@ goal)
@echo "前:" $(stringStrip1)
@echo "后:" $(stringStrip2)
stringWord:
@echo "前:" $(stringword1)
@echo "中:" $(stringword2)
@echo "后:" $(stringword3)
getMakefile:
@echo "当前Makefile有:" $(MAKEFILE_LIST)
@echo $(MAKEFILE_LIST) | cut -d " " -f 1
@echo $(MAKEFILE_LIST) | cut -d " " -f 2
# 执行结果
mj@DZ:~/桌面$ make
★ build stringStrip goal
前:
后:
mj@DZ:~/桌面$
# 然后我们在看一下用 = 号来连接字符串的例子
mj@DZ:~/桌面$ cat Makefile
SIGNAL = $(shell printf "\033[34;1m★\033[0m")
build=string
build2=Strip
PHONY := _all
xxx=$(build)=$(build2)
_all:
_all: $(xxx)
# 运行结果,可以看我我们的目标文件中间加上了 = 号
mj@DZ:~/桌面$ make
Makefile:14: warning: overriding recipe for target '_all'
Makefile:11: warning: ignoring old recipe for target '_all'
make: *** No rule to make target 'string=Strip', needed by '_all'。 停止。
这里我建议上面出现的知识点自己最好亲自操作一下,记得要温习这个知识点
这里我建议上面出现的知识点自己最好亲自操作一下,记得要温习这个知识点
这里我建议上面出现的知识点自己最好亲自操作一下,记得要温习这个知识点
支付宝 微信