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.

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

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

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

    后文待续

  • 相关阅读:
    C# 测试 modbusTCP 经验积累
    C#制作透明色GIF动画的类
    C# esc退出窗体
    让PPT演示文稿循环播放
    C# hex 转 float
    C# PowerPoint操作的基本用法。
    将listview的checkbox改成单选。
    google搜索栏设置
    如何在C++中实现Deprecated API Anthony
    只能用new生成的对象 Anthony
  • 原文地址:https://www.cnblogs.com/gaojian/p/2688603.html
Copyright © 2011-2022 走看看