| 赋值=make 会将整个 makefile 展开后,再决定变量的值。也就是说,变量的值将会是整个makefile最后的被指定的值。 x = foo
y = $(x) bar
x = xyz
 以上例子中,y的值最终会是xyz bar,而不是foo bar。 :=:=表示变量的值取决于它在makefile里的位置。上述例子中,y的值将会是是
 foo bar。
 自动变量$@: 规则中的目标。$^: 规则中的所有先决条件。
 $<: 规则中的第一个先决条件。
 .PHONY:all
all:first second third
    @echo "\$$@ = $@"
    @echo "\$$^ = $^"
    @echo "\$$< = $<"
first second third:
 运行结果为: $@ = all
$^ = first second third
$< = first
 函数In Kernel Makefile I found the code like below:file path:
 /lib/modules/5.19.0/build/Makefile quiet_cmd_depmod = DEPMOD  $(MODLIB)
      cmd_depmod = $(CONFIG_SHELL) $(srctree)/scripts/depmod.sh $(DEPMOD) \
                   $(KERNELRELEASE)
modules_install:
    $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modinst
    $(call cmd,depmod)
 如何理解? 在scripts/Kbuild.include有如下定义: # echo command.
# Short version is used, if $(quiet) equals `quiet_', otherwise full one.
echo-cmd = $(if $($(quiet)cmd_$(1)),\
    echo '  $(call escsq,$($(quiet)cmd_$(1)))$(echo-why)';)
# printing commands
cmd = @set -e; $(echo-cmd) $($(quiet)redirect) $(cmd_$(1))
 以quiet_开头的是输出指令。以
 cmd_开头的会先打印指令,然后执行。所以实际指令是:
 set -e;  echo '  DEPMOD  /lib/modules/5.19.0';  sh ./scripts/depmod.sh depmod 5.19.0
 |