Skip to contentSkip to conversation

build: tweak variable exporting for make 3.82

PATCH In review Jan Beulich 4 participants 6 messages Jun 26, 2020 – Jul 2, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 build: tweak variable exporting for make 3.82

While I've been running into an issue here only because of an additional local change I'm carrying, to be able to override just the compiler in $(XEN_ROOT)/.config (rather than the whole tool chain), in config/StdGNU.mk:

ifeq ($(filter-out default undefined,$(origin CC)),)

I'd like to propose to nevertheless correct the underlying issue:
Exporting an unset variable changes its origin from "undefined" to "file". This comes into effect because of our adding of -rR to MAKEFLAGS, which make 3.82 wrongly applies also upon re-invoking itself after having updated auto.conf{,.cmd}.

Move the export statement past $(XEN_ROOT)/config/$(XEN_OS).mk inclusion such that the variables already have their designated values at that point, while retaining their initial origin up to the point they get defined.

xen/Makefile +2 -2
@@ -17,8 +17,6 @@ export XEN_BUILD_HOST	?= $(shell hostnam
 PYTHON_INTERPRETER	:= $(word 1,$(shell which python3 python python2 2>/dev/null) python)
 export PYTHON		?= $(PYTHON_INTERPRETER)
 
-export CC CXX LD
-
 export BASEDIR := $(CURDIR)
 export XEN_ROOT := $(BASEDIR)/..
 
@@ -42,6 +40,8 @@ export TARGET_ARCH     := $(shell echo $
 # Allow someone to change their config file
 export KCONFIG_CONFIG ?= .config
 
+export CC CXX LD
+
 .PHONY: default
 default: build
 
Tested-by on v1 1/1
#1 lore raw

Hi Jan,

Quoted 15 lines · Jan Beulich

While I've been running into an issue here only because of an additional local change I'm carrying, to be able to override just the compiler in $(XEN_ROOT)/.config (rather than the whole tool chain), in config/StdGNU.mk:

ifeq ($(filter-out default undefined,$(origin CC)),)

I'd like to propose to nevertheless correct the underlying issue:
Exporting an unset variable changes its origin from "undefined" to "file". This comes into effect because of our adding of -rR to MAKEFLAGS, which make 3.82 wrongly applies also upon re-invoking itself after having updated auto.conf{,.cmd}.

Quoted 4 lines

Move the export statement past $(XEN_ROOT)/config/$(XEN_OS).mk inclusion such that the variables already have their designated values at that point, while retaining their initial origin up to the point they get defined.

If I understand correctly you actually need this to be after include $(XEN_ROOT)/Config.mk

Which actually includes the .config and the StdGNU.mk
Maybe you could say this as $(XEN_ROOT)/config/$(XEN_OS).mk is not actually included directly in the Makefile itself ?

I tested the patch and it works on arm and x86 on my side.

Quoted 2 lines
Quoted 22 lines
xen/Makefile +0 -2
@@ -17,8 +17,6 @@ export XEN_BUILD_HOST	?= $(shell hostnam
 PYTHON_INTERPRETER	:= $(word 1,$(shell which python3 python python2 2>/dev/null) python)
 export PYTHON		?= $(PYTHON_INTERPRETER)
 
-export CC CXX LD
-
 export BASEDIR := $(CURDIR)

export XEN_ROOT := $(BASEDIR)/..

xen/Makefile +0 -0
@@ -42,6 +40,8 @@ export TARGET_ARCH     := $(shell echo $
 # Allow someone to change their config file

export KCONFIG_CONFIG ?= .config

xen/Makefile +2 -0
+export CC CXX LD
+

.PHONY: default
default: build

#2 lore raw
Quoted 22 lines · Bertrand Marquis

Hi Jan,

Quoted 15 lines · Jan Beulich

While I've been running into an issue here only because of an additional local change I'm carrying, to be able to override just the compiler in $(XEN_ROOT)/.config (rather than the whole tool chain), in config/StdGNU.mk:

ifeq ($(filter-out default undefined,$(origin CC)),)

I'd like to propose to nevertheless correct the underlying issue:
Exporting an unset variable changes its origin from "undefined" to "file". This comes into effect because of our adding of -rR to MAKEFLAGS, which make 3.82 wrongly applies also upon re-invoking itself after having updated auto.conf{,.cmd}.

Quoted 4 lines

Move the export statement past $(XEN_ROOT)/config/$(XEN_OS).mk inclusion such that the variables already have their designated values at that point, while retaining their initial origin up to the point they get defined.

Quoted 6 lines

If I understand correctly you actually need this to be after include $(XEN_ROOT)/Config.mk

Which actually includes the .config and the StdGNU.mk Maybe you could say this as $(XEN_ROOT)/config/$(XEN_OS).mk is not actually included directly in the Makefile itself ?

I thought it would be obvious enough, but since you ask, I've added half a sentence.

Quoted 5 lines

I tested the patch and it works on arm and x86 on my side.

Quoted 2 lines

Thanks much.

Jan

Reviewed-by on v1 1/1
#3 lore raw
In reply to Jan Beulich
Quoted 32 lines · Jan Beulich

While I've been running into an issue here only because of an additional local change I'm carrying, to be able to override just the compiler in $(XEN_ROOT)/.config (rather than the whole tool chain), in config/StdGNU.mk:

ifeq ($(filter-out default undefined,$(origin CC)),)

I'd like to propose to nevertheless correct the underlying issue:
Exporting an unset variable changes its origin from "undefined" to "file". This comes into effect because of our adding of -rR to MAKEFLAGS, which make 3.82 wrongly applies also upon re-invoking itself after having updated auto.conf{,.cmd}.

Move the export statement past $(XEN_ROOT)/config/$(XEN_OS).mk inclusion such that the variables already have their designated values at that point, while retaining their initial origin up to the point they get defined.

xen/Makefile +0 -2
@@ -17,8 +17,6 @@ export XEN_BUILD_HOST	?= $(shell hostnam
 PYTHON_INTERPRETER	:= $(word 1,$(shell which python3 python python2 2>/dev/null) python)
 export PYTHON		?= $(PYTHON_INTERPRETER)
 
-export CC CXX LD
-
 export BASEDIR := $(CURDIR)
 export XEN_ROOT := $(BASEDIR)/..
 

xen/Makefile export TARGET_ARCH := $(shell echo $ · line 46

Quoted 7 lines
xen/Makefile +2 -0
@@ -42,6 +40,8 @@ export TARGET_ARCH     := $(shell echo $
 # Allow someone to change their config file
 export KCONFIG_CONFIG ?= .config
 
+export CC CXX LD
+
 .PHONY: default
 default: build

That patch is fine and it is probably better to export a variable that has a value rather than before the variable is set.

Thanks,

Signature · 1 line
Anthony PERARD
#4 lore raw

Ping: [PATCH] build: tweak variable exporting for make 3.82

Quoted 44 lines · Anthony PERARD
Quoted 32 lines · Jan Beulich

While I've been running into an issue here only because of an additional local change I'm carrying, to be able to override just the compiler in $(XEN_ROOT)/.config (rather than the whole tool chain), in config/StdGNU.mk:

ifeq ($(filter-out default undefined,$(origin CC)),)

I'd like to propose to nevertheless correct the underlying issue:
Exporting an unset variable changes its origin from "undefined" to "file". This comes into effect because of our adding of -rR to MAKEFLAGS, which make 3.82 wrongly applies also upon re-invoking itself after having updated auto.conf{,.cmd}.

Move the export statement past $(XEN_ROOT)/config/$(XEN_OS).mk inclusion such that the variables already have their designated values at that point, while retaining their initial origin up to the point they get defined.

xen/Makefile +0 -2
@@ -17,8 +17,6 @@ export XEN_BUILD_HOST	?= $(shell hostnam
 PYTHON_INTERPRETER	:= $(word 1,$(shell which python3 python python2 2>/dev/null) python)
 export PYTHON		?= $(PYTHON_INTERPRETER)
 
-export CC CXX LD
-
 export BASEDIR := $(CURDIR)
 export XEN_ROOT := $(BASEDIR)/..
 

xen/Makefile export TARGET_ARCH := $(shell echo $ · line 46

Quoted 7 lines
xen/Makefile +2 -0
@@ -42,6 +40,8 @@ export TARGET_ARCH     := $(shell echo $
 # Allow someone to change their config file
 export KCONFIG_CONFIG ?= .config
 
+export CC CXX LD
+
 .PHONY: default
 default: build

That patch is fine and it is probably better to export a variable that has a value rather than before the variable is set.

Quoted 1 line

Paul - thoughts either way as to 4.14? If not to go in now, I definitely intend to backport it. (And in fact I'm meanwhile considering to enter a make bug for the behavior, unless its behavior has changed in later versions.)

Thanks, Jan

#5 lore raw

RE: Ping: [PATCH] build: tweak variable exporting for make 3.82

Quoted 55 lines

-----Original Message-----
From: Jan Beulich <[email protected]>
Sent: 02 July 2020 08:45
To: Paul Durrant <[email protected]>
Cc: Anthony PERARD <[email protected]>; [email protected]; Andrew Cooper <[email protected]>; George Dunlap <[email protected]>; Ian Jackson <[email protected]>; Julien Grall <[email protected]>; Wei Liu <[email protected]>; Stefano Stabellini <[email protected]>
Subject: Ping: [PATCH] build: tweak variable exporting for make 3.82

Quoted 44 lines · Anthony PERARD
Quoted 32 lines · Jan Beulich

While I've been running into an issue here only because of an additional local change I'm carrying, to be able to override just the compiler in $(XEN_ROOT)/.config (rather than the whole tool chain), in config/StdGNU.mk:

ifeq ($(filter-out default undefined,$(origin CC)),)

I'd like to propose to nevertheless correct the underlying issue:
Exporting an unset variable changes its origin from "undefined" to "file". This comes into effect because of our adding of -rR to MAKEFLAGS, which make 3.82 wrongly applies also upon re-invoking itself after having updated auto.conf{,.cmd}.

Move the export statement past $(XEN_ROOT)/config/$(XEN_OS).mk inclusion such that the variables already have their designated values at that point, while retaining their initial origin up to the point they get defined.

xen/Makefile +0 -2
@@ -17,8 +17,6 @@ export XEN_BUILD_HOST	?= $(shell hostnam
 PYTHON_INTERPRETER	:= $(word 1,$(shell which python3 python python2 2>/dev/null) python)
 export PYTHON		?= $(PYTHON_INTERPRETER)
 
-export CC CXX LD
-
 export BASEDIR := $(CURDIR)
 export XEN_ROOT := $(BASEDIR)/..
 

xen/Makefile export TARGET_ARCH := $(shell echo $ · line 46

Quoted 7 lines
xen/Makefile +2 -0
@@ -42,6 +40,8 @@ export TARGET_ARCH     := $(shell echo $
 # Allow someone to change their config file
 export KCONFIG_CONFIG ?= .config
 
+export CC CXX LD
+
 .PHONY: default
 default: build

That patch is fine and it is probably better to export a variable that has a value rather than before the variable is set.

Quoted 7 lines
Quoted 1 line

Paul - thoughts either way as to 4.14? If not to go in now, I definitely intend to backport it. (And in fact I'm meanwhile considering to enter a make bug for the behavior, unless its behavior has changed in later versions.)

I agree with Anthony's statement so I'm happy for this to go in 4.14.