zoukankan      html  css  js  c++  java
  • GNU make manual 翻译(六十七)

    继续翻译

     You can also mix in functions here, as long as they are properly escaped: 
                            
         main_SRCS := main.c try.c test.c                        
         lib_SRCS := lib.c api.c                        
                            
         .SECONDEXPANSION:                        
         main lib: $$(patsubst %.c,%.o,$$($$@_SRCS))                        
                            
       This version allows users to specify source files rather than object files, but gives the same resulting prerequisites list as the previous example. 
                            
       Evaluation of automatic variables during the secondary expansion phase, especially of the target name variable `$$@', behaves similarly to evaluation within recipes.  However, there are some subtle differences and "corner cases" which come into play for the different  types of rule definitions that `make' understands.  The subtleties of  using the different automatic variables are described below. 

    你也可以把函数混合在此:

    main_SRCS := main.c try.c test.c
    lib_SRCS := lib.c api.c

    .SECONDEXPANSION:
    main lib: $$(patsubst %.c,%.o,$$($$@_SRCS))

    我加段注解:
    
         main_SRCS := main.c try.c test.c                    
         lib_SRCS := lib.c api.c                    
                        
         .SECONDEXPANSION:                    
         main lib: $$(patsubst %.c,%.o,$$($$@_SRCS))                    
    
    main lib: $$(patsubst %.c, %.o, $$($$@_SRCS))转化为:
    ->
    main lib: $(patsubst %.c, %.o, $($@_SRCS))
    即:
    ->
    main: $(patsubst %.c, %.o, $(main_SRCS))
    和
    lib:     $(patsubst %.c, %.o, $(lib_SRCS))
    
    也就是:
    main: main.o try.o test.o
    和
    lib:    lib.o api.o

    Evaluation of automatic variables during the secondary expansion
    phase, especially of the target name variable `$$@', behaves similarly
    to evaluation within recipes. However, there are some subtle
    differences and "corner cases" which come into play for the different
    types of rule definitions that `make' understands. The subtleties of
    using the different automatic variables are described below.

    在二次扩展期间,对自动变量的求值,特别是 目的名变量 $$@,和在片段中的求值是一样的。

    然而,这里有一些微妙的查别,还有一些特例为不同类型的规则定义来进行了特殊处理。

    此种使用不同的自动变量的细微之处,将在如下描述。

    后文待续

  • 相关阅读:
    正则表达式
    小弟新从csdn搬迁到博客园,欢迎大家关注
    做完牛腩新闻发布系统之后的收获(牛腩总结)
    ValidateRequest="false" 无效
    sql server小技巧-自动添加时间与主键自增长
    css初接触
    Spark的Rpct模块的学习
    插入排序
    选择排序
    冒泡排序
  • 原文地址:https://www.cnblogs.com/gaojian/p/2688603.html
Copyright © 2011-2022 走看看