Makefile 的組成 (compoments)
1. explicit rules
2. implicit rules
3. variable definitions
1. 利用 origin function 可以知道某一個變數是從何處來的
ifeq ("$(origin V)", "command line")
The result of this function is a string telling you how the variable variable was defined:
if variable was never defined.
if variable has a default definition, as is usual with CC and so on. See Variables Used by Implicit Rules. Note that if you have redefined a default variable, the origin function will return the origin of the later definition.
if variable was defined as an environment variable and the `-e' option is not turned on (see Summary of Options).
if variable was defined as an environment variable and the `-e' option is turned on (see Summary of Options).
if variable was defined in a makefile.
if variable was defined on the command line.
if variable was defined with an override directive in a makefile (see The override Directive).
if variable is an automatic variable defined for the execution of the commands for each rule (see Automatic Variables).