title: Makefile DEFAULT_GOAL variable
body: <p>This is an example of use of DEFAULT_GOAL Variable:</p>
  
  <pre><code>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
  
  
  The output is:
  
  no default goal is set
  default goal is foo
  default goal is bar
  foo
  </code></pre>
  
  <p>I stuck up understanding that what is the flow of the <strong>echo and $(warning )</strong> function i.e. when <strong>$(warning )</strong> function is called the <strong>echo $@</strong> output is suppressed and last output of <strong>echo $@</strong> is displayed. Because there is <strong>2 echo statement</strong> and <strong>3 $(warning ) function call</strong> but only one target id printed by echo the last one foo . Why others are not printed and why the last value is printed as foo why not bar?</p>