请教一个makefile的问题

花公子的夏天 2015-08-03 02:25:44
makefile 中有这么一段话
subtarget-default = $(filter-out ., \ //在指定目录下过滤出不是 . 的字符
$(if $($(1)/builddirs-$(2)),$($(1)/builddirs-$(2)), \ //$(if <condition>,<then part>,<else part>)
$(if $($(1)/builddirs-default),$($(1)/builddirs-default), \
$($(1)/builddirs))))
这里的$(1)和$(2)是怎么理解的,前文中也没有提及,难道是makefile运行带的参数么,这样讲不通啊,求指教,感激不尽
...全文
356 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
feisonzl 2015-09-09
  • 打赏
  • 举报
回复
赞同2楼,安卓系统编译中经常需要make带参数的
甲丐内美吕 2015-08-05
  • 打赏
  • 举报
回复
美元符号后表示变量,前面应该有声明变量的值
nswcfd 2015-08-03
  • 打赏
  • 举报
回复
Some examples may make this clearer. This macro simply reverses its arguments: reverse = $(2) $(1) foo = $(call reverse,a,b) Here FOO will contain `b a'.
nswcfd 2015-08-03
  • 打赏
  • 举报
回复
此外,$(1) $(2)可用于call函数,作为参数,参见info make,第8.6节。 The syntax of the `call' function is: $(call VARIABLE,PARAM,PARAM,...) When `make' expands this function, it assigns each PARAM to temporary variables `$(1)', `$(2)', etc. The variable `$(0)' will contain VARIABLE. There is no maximum number of parameter arguments. There is no minimum, either, but it doesn't make sense to use `call' with no parameters.
花公子的夏天 2015-08-03
  • 打赏
  • 举报
回复
不对吧,我make是一般不带参数,那这一段是不是就用不上了,一般都是用make V=99,而且看这个$(1)和$(2)都应该是个路径,我从来没带过路径
充电宝111 2015-08-03
  • 打赏
  • 举报
回复
就是执行make的时候的参数啊
nswcfd 2015-08-03
  • 打赏
  • 举报
回复
make的变量,是可以以数字开头的,比较邪恶。 A variable name may be any sequence of characters not containing `:', `#', `=', or leading or trailing whitespace. However, variable names containing characters other than letters, numbers, and underscores should be avoided, as they may be given special meanings in the future, and with some shells they cannot be passed through the environment to a sub-`make' (*note Communicating Variables to a Sub-`make': Variables/Recursion.)

1,319

社区成员

发帖
与我相关
我的任务
社区描述
主要是开发驱动技术
社区管理员
  • 驱动程序开发区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧