[L/unstable 03/13] UBUNTU: [Packaging] add -rR MAKEFLAGS to clear implicit rules

Juerg Haefliger juerg.haefliger at canonical.com
Wed Dec 7 06:43:07 UTC 2022


On Mon,  5 Dec 2022 17:56:09 +0900
Masahiro Yamada <masahiro.yamada at canonical.com> wrote:

> Cancel implicit rules, otherwise GNU Make will try to examine a lot of
> internal rules to update makefiles.

Are we certain we don't rely on any implicit rule?

...Juerg


> Add -rR, as the Kbuild does. [1]
> 
> If you want to see what is happening behind the scene:
> 
>     $ dpkg-buildpackage --rules-file="debian/rules -d"
> 
> [Before]
> 
>   Updating makefiles....
>    Considering target file 'debian/rules.d/4-checks.mk'.
>     Looking for an implicit rule for 'debian/rules.d/4-checks.mk'.
>     Trying pattern rule with stem '4-checks.mk'.
>     Trying implicit prerequisite 'debian/rules.d/4-checks.mk.o'.
>     Trying pattern rule with stem '4-checks.mk'.
>     Trying implicit prerequisite 'debian/rules.d/4-checks.mk.c'.
>     Trying pattern rule with stem '4-checks.mk'.
>     Trying implicit prerequisite 'debian/rules.d/4-checks.mk.cc'.
>     Trying pattern rule with stem '4-checks.mk'.
>     Trying implicit prerequisite 'debian/rules.d/4-checks.mk.C'.
>     Trying pattern rule with stem '4-checks.mk'.
>     Trying implicit prerequisite 'debian/rules.d/4-checks.mk.cpp'.
>     Trying pattern rule with stem '4-checks.mk'.
>     Trying implicit prerequisite 'debian/rules.d/4-checks.mk.p'.
>     Trying pattern rule with stem '4-checks.mk'.
>     Trying implicit prerequisite 'debian/rules.d/4-checks.mk.f'.
> 
>       [  snip a tons of examinations for implicit rules  ]
> 
>     No implicit rule found for 'debian/rules.d/4-checks.mk'.
>     Finished prerequisites of target file 'debian/rules.d/4-checks.mk'.
>    No need to remake target 'debian/rules.d/4-checks.mk'.
> 
> [After]
> 
>   Updating makefiles....
>    Considering target file 'debian/rules.d/4-checks.mk'.
>     Looking for an implicit rule for 'debian/rules.d/4-checks.mk'.
>     No implicit rule found for 'debian/rules.d/4-checks.mk'.
>     Finished prerequisites of target file 'debian/rules.d/4-checks.mk'.
> 
> [1]: https://github.com/torvalds/linux/blob/v6.0/Makefile#L41
> 
> Signed-off-by: Masahiro Yamada <masahiro.yamada at canonical.com>
> ---
>  debian/rules | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/debian/rules b/debian/rules
> index b5358727a901..f2b460354f6c 100755
> --- a/debian/rules
> +++ b/debian/rules
> @@ -7,6 +7,10 @@
>  # Copyright (c) 2007 Ben Collins <bcollins at ubuntu.com>
>  #
>  
> +# Do not use make's built-in rules and variables
> +# (this increases performance and avoids hard-to-debug behaviour)
> +MAKEFLAGS += -rR
> +
>  DEBIAN=$(shell awk -F= '($$1 == "DEBIAN") { print $$2 }' <debian/debian.env)
>  
>  # dpkg-buildpackage passes options that are incomptatible

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <https://lists.ubuntu.com/archives/kernel-team/attachments/20221207/01bfe16d/attachment.sig>


More information about the kernel-team mailing list