Chinaunix首页 | 论坛 | 博客
  • 博客访问: 500114
  • 博文数量: 104
  • 博客积分: 3045
  • 博客等级: 少校
  • 技术积分: 1230
  • 用 户 组: 普通用户
  • 注册时间: 2008-02-29 10:18
文章分类

全部博文(104)

文章存档

2011年(72)

2010年(1)

2009年(1)

2008年(30)

分类: 项目管理

2011-04-27 20:13:39

介绍几个比较常见的
1 call function
语法规则
$(call macro-name[, param1 ...])
call is a built-in make function that expands its first argument and replaces occur-
rences of $1, $2, etc., with the remaining arguments it is given.
看下面的例子
define parent
  echo "parent has two parameters: $1, $2"
  $(call child,$1)
endef
define child
  echo "child has one parameter: $1"
  echo "but child can also see parent's second parameter: $2!"
endef
scoping_issue:
        @$(call parent,one,two)
$ make
parent has two parameters: one, two
child has one parameter: one
but child can also see parent's second parameter: two!
2 filter function
words := he the hen other the%
get-the:
         @echo he matches: $(filter he, $(words))
         @echo %he matches: $(filter %he, $(words))
         @echo he% matches: $(filter he%, $(words))
         @echo %he% matches: $(filter %he%, $(words))
$ make
he matches: he
%he matches: he the
he% matches: he hen
%he% matches: the%
3 wildcard
sources := $(wildcard *.c *.h)
4 $(foreach variable,list,body)


阅读(1082) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~