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.

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

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

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

    后文待续

  • 相关阅读:
    MATLAB简易验证码识别程序介绍
    [Java面试三]JavaWeb基础知识总结.
    [Java面试十二]数据库概念相关
    [Java面试十一]数据库总结.
    [Java面试十]浏览器跨域问题.
    [Java面试九]脚本语言知识总结.
    [Java面试八]Hibernate总结以及在面试中的一些问题.
    [Java面试七]Mybatis总结以及在面试中的一些问题.
    [Java面试六]SpringMVC总结以及在面试中的一些问题.
    [Java面试五]Spring总结以及在面试中的一些问题.
  • 原文地址:https://www.cnblogs.com/gaojian/p/2688603.html
Copyright © 2011-2022 走看看