[CRIU] [PATCHv2] tools.mk: Define CC if not set to 'default'
Andrei Vagin
avagin at gmail.com
Thu Apr 18 20:28:49 MSK 2019
What problem are you solving? Do we have a github issue for this?
On Fri, Apr 12, 2019 at 09:04:43AM +0100, Radostin Stoyanov wrote:
> FOO ?= bar
>
> is equivalent to
>
> ifeq ($(origin FOO), undefined)
> FOO = bar
> endif
>
> However, when CC is not set its value is 'default' rather than
> 'undefined'.
>
> From [1]:
>
> 'undefined': if variable was never defined.
>
> 'default': 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.
>
> [1] https://www.gnu.org/software/make/manual/make.html
>
> Signed-off-by: Radostin Stoyanov <rstoyanov1 at gmail.com>
> ---
> scripts/nmk/scripts/tools.mk | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/scripts/nmk/scripts/tools.mk b/scripts/nmk/scripts/tools.mk
> index d756358d5..8620ded7c 100644
> --- a/scripts/nmk/scripts/tools.mk
> +++ b/scripts/nmk/scripts/tools.mk
> @@ -4,9 +4,13 @@ ifndef ____nmk_defined__tools
> # System tools shorthands
> RM := rm -f
> HOSTLD ?= ld
> -LD ?= $(CROSS_COMPILE)$(HOSTLD)
> +ifeq ($(origin LD), default)
> +LD := $(CROSS_COMPILE)$(HOSTLD)
> +endif
> HOSTCC ?= gcc
> -CC ?= $(CROSS_COMPILE)$(HOSTCC)
> +ifeq ($(origin CC), default)
> +CC := $(CROSS_COMPILE)$(HOSTCC)
> +endif
> CPP := $(CC) -E
> AS := $(CROSS_COMPILE)as
> AR := $(CROSS_COMPILE)ar
> --
> 2.20.1
>
> _______________________________________________
> CRIU mailing list
> CRIU at openvz.org
> https://lists.openvz.org/mailman/listinfo/criu
More information about the CRIU
mailing list