make的手册
https://www.gnu.org/software/make/manual/make.html#Double_002dColon
4.13 Double-Colon Rules
Double-colon rules are explicit rules written with ‘::’instead of ‘:’ after the target names. They are handleddifferently from ordinary rules when the same target appears in morethan one rule. Pattern rules with double-colons have an entirelydifferent meaning (see Match-Anything Rules).
When a target appears in multiple rules, all the rules must be the sametype: all ordinary, or all double-colon. If they are double-colon, eachof them is independent of the others. Each double-colon rule's recipeis executed if the target is older than any prerequisites of that rule. If there are no prerequisites for that rule, its recipe is alwaysexecuted (even if the target already exists). This can result inexecuting none, any, or all of the double-colon rules.
Double-colon rules with the same target are in fact completely separatefrom one another. Each double-colon rule is processed individually, justas rules with different targets are processed.
The double-colon rules for a target are executed in the order they appearin the makefile. However, the cases where double-colon rules really makesense are those where the order of executing the recipes would not matter.
Double-colon rules are somewhat obscure and not often very useful; theyprovide a mechanism for cases in which the method used to update a targetdiffers depending on which prerequisite files caused the update, and suchcases are rare.
Each double-colon rule should specify a recipe; if it does not, animplicit rule will be used if one applies. SeeUsing Implicit Rules.
Makefile示例1:
all:
@echo aaaa
all:
@echo bbbb
执行make报警告
Makefile:7: warning: overriding commands for target `all'
Makefile:4: warning: ignoring old commands for target `all'
bbbb
只有第2个规则的命令会被执行
Makefile示例2,在1上将单冒号改为双冒号:
all::
@echo aaaa
all::
@echo bbbb
执行make
aaaa
bbbb
2个规则的命令都会正确执行