[XEN PATCH v2 0/5] build: reduce number of $(shell) execution on make 4.4

Anthony PERARD posted 5 patches 10 months, 1 week ago
Failed in applying to current master (apply log)
There is a newer version of this series
Config.mk              |  6 +++---
xen/Makefile           | 40 ++++++++++++++++++----------------------
xen/Rules.mk           |  2 +-
xen/arch/riscv/arch.mk |  2 +-
xen/build.mk           |  6 +++---
5 files changed, 26 insertions(+), 30 deletions(-)
[XEN PATCH v2 0/5] build: reduce number of $(shell) execution on make 4.4
Posted by Anthony PERARD 10 months, 1 week ago
Patch series available in this git branch:
https://xenbits.xen.org/git-http/people/aperard/xen-unstable.git br.build-exported-shell-command-value-v2

v2:
- new patches removing TARGET_SUBARCH and TARGET_ARCH.
- style change in first patch

With GNU make 4.4, the number of execution of the command present in $(shell )
in exported variables increased greatly. This is probably because as of make
4.4, exported variable are also added to the environment of $(shell )
construct.

From the annoncement:

    https://lists.gnu.org/archive/html/info-gnu/2022-10/msg00008.html
    > * WARNING: Backward-incompatibility!
    >   Previously makefile variables marked as export were not exported to commands
    >   started by the $(shell ...) function.  Now, all exported variables are
    >   exported to $(shell ...).  If this leads to recursion during expansion, then
    >   for backward-compatibility the value from the original environment is used.
    >   To detect this change search for 'shell-export' in the .FEATURES variable.

Also, there's a new paragraph in the GNU make manual, but it's a warning about
exporting all variable, still it might be relevant to the new observed
behavior:

    https://www.gnu.org/software/make/manual/make.html#Variables_002fRecursion
    > Adding a variable’s value to the environment requires it to be expanded. If
    > expanding a variable has side-effects (such as the info or eval or similar
    > functions) then these side-effects will be seen every time a command is
    > invoked.

The issue was reported on IRC by jandryuk.

So, I've locate a few obvious candidate to fix, maybe there's more $(shell) to
change?

Anthony PERARD (5):
  build: define ARCH and SRCARCH later
  build: remove TARGET_SUBARCH, a duplicate of ARCH
  build: remove TARGET_ARCH, a duplicates of SRCARCH
  build: evaluate XEN_BUILD_* and XEN_DOMAIN on first use
  Config.mk: evaluate XEN_COMPILE_ARCH and XEN_OS on first use

 Config.mk              |  6 +++---
 xen/Makefile           | 40 ++++++++++++++++++----------------------
 xen/Rules.mk           |  2 +-
 xen/arch/riscv/arch.mk |  2 +-
 xen/build.mk           |  6 +++---
 5 files changed, 26 insertions(+), 30 deletions(-)

-- 
Anthony PERARD


Re: [XEN PATCH v2 0/5] build: reduce number of $(shell) execution on make 4.4
Posted by Jason Andryuk 10 months, 1 week ago
On Thu, Jun 22, 2023 at 11:31 AM Anthony PERARD
<anthony.perard@citrix.com> wrote:
>
> Patch series available in this git branch:
> https://xenbits.xen.org/git-http/people/aperard/xen-unstable.git br.build-exported-shell-command-value-v2
>
> v2:
> - new patches removing TARGET_SUBARCH and TARGET_ARCH.
> - style change in first patch

For the v2 series:
Tested-by: Jason Andryuk <jandryuk@gmail.com>

Thanks,
Jason