开发者社区> 问答> 正文

linux 简单makefile,foo=sort,在sort的函数中以$(foo)引用会失败?

line 8里面以$(func)引用sort函数,没效果,直接以sort替换$(func),是OK,什么情况?

makefile
1 do_sort=
2 ifdef do_sort
3 func=strip
4 else
5 func=sort
6 endif
7 bar:=cd g p b a
8 foo=$($(func) $(bar))
9 all:
10 @echo $(foo) 
11 @echo $(sort $(bar))
make:
a b cd g p

展开
收起
云栖技术 2016-06-06 09:56:44 2644 0
1 条回答
写回答
取消 提交回答
  • 社区爱好者,专为云栖社区服务!
    line 8里面以$(func)引用sort函数,没效果,直接以sort替换$(func),是OK,什么情况?
    makefile
     1  do_sort=
     2  ifdef do_sort
     3      func=strip
     4  else
     5      func=sort
     6  endif
     7  bar:=cd g p b a
     8  foo=$($(func) $(bar))
     9  all:
    10      @echo $(foo) 
    11      @echo $(sort $(bar))
    make:
    
    2019-07-17 19:27:43
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
Alibaba Cloud Linux 3 发布 立即下载
ECS系统指南之Linux系统诊断 立即下载
ECS运维指南 之 Linux系统诊断 立即下载