makefile 中调用shell脚本注意事项


1.在makefile文件中,周游target 的command 语句中允许调用shell命令和语句,其他的调用都被忽略或者报错。


2.makefile 变量使用 $(xxx) 或者 ${xxx}引用,shell 变量使用$$xxx 或$${xxx}引用

[root@andes.com ~]#cat makefile 
DIRS=src bin lib include 

#echo "hello"
all:
        @for i in $(DIRS);\
        do echo $$i;\
        echo $${i};\
        done;\
        echo ${DIRS};\
        echo $(DIRS);
[root@andes.com ~]#make
src
src
bin
bin
lib
lib
include
include
src bin lib include
src bin lib include
[root@andes.com ~]#

3.makefile 数组直接定义,不用添加小括号


4.makefile target  的command 每一行都是在一个独立的进程中运行,为避免语句出错,将多个语句用分号隔开,使用 反斜杠 \ 进行换行,便于书写。


  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值