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

    继续翻译

    `.DEFAULT_GOAL'
         Sets the default goal to be used if no targets were specified on
         the command line (*note Arguments to Specify the Goals: Goals.).
         The `.DEFAULT_GOAL' variable allows you to discover the current
         default goal, restart the default goal selection algorithm by
         clearing its value, or to explicitly set the default goal.  The
         following example illustrates these cases:
    
              # Query the default goal.
              ifeq ($(.DEFAULT_GOAL),)
                $(warning no default goal is set)
              endif
    
              .PHONY: foo
              foo: ; @echo $@
    
              $(warning default goal is $(.DEFAULT_GOAL))
    
              # Reset the default goal.
              .DEFAULT_GOAL :=
    
              .PHONY: bar
              bar: ; @echo $@
    
              $(warning default goal is $(.DEFAULT_GOAL))
    
              # Set our own.
              .DEFAULT_GOAL := foo
    
         This makefile prints:
    
              no default goal is set
              default goal is foo
              default goal is bar
              foo
    
         Note that assigning more than one target name to `.DEFAULT_GOAL' is
         illegal and will result in an error.

    `.DEFAULT_GOAL'

    设置如果在命令行中没有制定目的场合,缺省的终点(*note Arguments to Specify the Goals :Goals)。

    .DEFAULT_GOAL 变量允许你发现当前的缺省的终点,通过清除它的值来重新设置缺省的终点。下面的例子给出了如何操作:

    # Query the default goal.
    ifeq ($(.DEFAULT_GOAL),)
      $(warning no default goal is set)
    endif

    .PHONY: foo
    foo: ; @echo $@

    $(warning default goal is $(.DEFAULT_GOAL))

    # Reset the default goal.
    .DEFAULT_GOAL :=

    .PHONY: bar
    bar: ; @echo $@

    $(warning default goal is $(.DEFAULT_GOAL))

    # Set our own.
    .DEFAULT_GOAL := foo

    这个 makefile 输出:

    no default goal is set
    default goal is foo
    default goal is bar
    foo

    请注意设置多余一个的目的名给`.DEFAULT_GOAL' 是无效的,会造成错误。

    后文待续

  • 相关阅读:
    api1
    录像时调用MediaRecorder的start()时发生start failed: -19错误
    继承AppCompatActivity的Activity隐藏标题栏
    Android 6.0 运行时权限处理完全解析
    Android开发用过的十大框架
    Lite Your Android English
    2015最流行的Android组件、工具、框架大全
    C#调用C++函数入口点的问题 z
    C#调用C++的DLL函数另一则(delegate) z
    C#调用C++编写的DLL函数, 以及各种类型的参数传递 z
  • 原文地址:https://www.cnblogs.com/gaojian/p/2712160.html
Copyright © 2011-2022 走看看